官术网_书友最值得收藏!

Installation in a LAMP Environment

Moodle is developed in Linux using Apache, MySQL, and PHP (also known as the LAMP platform). If you have a choice, this is the preferred environment to be used.

Downloading Moodle

Go to http://download.moodle.org to download Moodle. As you can see, there are quite a number of distributions to choose from:

Downloading Moodle

For the current version of Moodle, there are two releases: the latest stable build and the latest official release. The latest stable version is created weekly (every Wednesday) and is the best choice for a new server. The latest official release contains the stable build as well as new fixes, but the version will not have gone through the weekly code review and might contain unresolved issues.

Versions that are older than the current one are maintained by the Moodle development team, and bug fixes are back-ported. Sometimes newly added functionality is back-ported. Currently, the oldest supported version is 1.6, but this will certainly change in the future. For older versions, a stable build and the last release are made available.

Moodle (that is http://download.moodle.org) also offers you to download beta releases of the software (if available) and also the latest development release. These should only be downloaded for testing or development purposes, and never used in production environments.

Each version is made available in two compressed formats TGZ (use the tar command to uncompress) and ZIP (requires unzip). You can either download them by clicking on the respective link or, if you have (secure) shell access, retrieve the file directly using the wget command:

wget http://download.moodle.org/stable19/moodle-weekly-19.zip

Tip

The location where you install Moodle is referred to as dirroot.

Once you have moved the file to the location where you want to install it on your web server (dirroot), extract the file using the unzip command (or tar zxvf if you downloaded the TGZ version). In a hosted environment, you might have to use the uncompressing method provided by the web administration interface (CPanel, Plesk, or any customized system).

If you place the entire folder in your web server documents directory, the site will be located at http://www.yourwebserver.com/moodle. To access your site from http://www.yourwebserver.com, copy the contents directly into the main web server's documents directory.

Tip

The URL via which Moodle is accessed is referred to as wwwroot.

Downloading Moodle

This screenshot is taken from a secure shell (SSH) in a hosted environment. Four commands were used:

  • Pwd: To make sure we are in the correct path
  • wget: To download Moodle
  • ls la: To verify that the file had been downloaded correctly
  • tar xvfz: To unpack the archive.

Once this is successful, you have to create the database that Moodle uses to store its data.

Creating the Moodle Database and the Data Directory

Moodle requires a database where it stores information. While it is possible to share an existing database, it is highly recommended to create a separate MySQL database for Moodle. This can either be done via a web interface as provided for hosted servers or via the Unix command line.

Using a Hosted Server

Most hosting providers provide a dedicated web interface to carry out basic database operations. Alternatively, you can use phpMyAdmin, an open-source software that allows you to manage MySQL databases over the Web. It is a part of most Linux distributions, and also a part of many control panels such as CPanel or Plesk. (phpMyAdmin is often configured to stop new databases from being created. If this is the case, you have to create the database from the database manager in CPanel or Plesk).

Once you have started phpMyAdmin, go to the Database section and create a new database using the UTF collation. You don't need to create any tables; Moodle will be populating the database during the installation process.

While you can use an existing database user account, it is good practice to create a dedicated user for the Moodle database. This step is carried out in the Privileges section.

Tip

Do not use the MySQL root account for your Moodle database!

phpMyAdmin allows you to perform both steps—creating a database and adding a new user—in a single action, which is shown in the following screenshot. We create a user book and also a database with the same name granting all privileges:

Using a Hosted Server

Using the Command Line

If you don't have access to a web interface to create MySQL databases and user accounts, or if you prefer to use a Linux shell, you can perform the steps via the command line:

  1. Start the database command line tool: mysql u root p and enter the password at the prompt
  2. Create a database (here called book): CREATE DATABASE book; (all mysql commands have to be completed with a semicolon)
  3. Set the default character set and collation order to UTF8: ALTER DATABASE book DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
  4. Create a user and password (here both are book) and grant database access permissions:

    GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON book.* TO book@localhost IDENTIFIED BY 'book';

  5. Exit the mysql command tool: QUIT
Using the Command Line

It is necessary to reload the grant tables using the following command line:

mysqladmin -u root -p reload

You have now completed the database setup. All we have to do now is to create Moodle's data directory before we are ready to start the installation of Moodle per se.

Creating the Moodle Data Directory

Moodle stores most of its information in the database you have just created. However, any uploaded files such as assignments or pictures are stored in a separate directory. This data directory in Moodle is usually referred to as moodledata.

Tip

The location that holds your Moodle data files is referred to as dataroot.

Later on, the Moodle installer will attempt to create this directory, but in some setups this is not possible due to security restrictions. To be on the safer side, it is better to create moodledata manually or via a web-based file manager as provided by systems such as CPanel and Plesk.

  1. Create the directory: mkdir moodledata
  2. Change permissions recursively: chmod R 0770 moodledata (if you use 0777, then everybody on the server will have access to the files)
  3. Change user of the directory to that of your web server (usually Apache or www-data): chown R apache moodledata
  4. Change the group of the directory to that of your web server (usually nobody or www-data): chgrp R nobody moodledata
Creating the Moodle Data Directory

It is important to create moodledata on your server where it cannot be accessed publicly, that is, outside your web directory! If you don't have permissions to create the data directory in a secure location, create the .htaccess file in your home directory containing the following two lines:

order deny,allow
deny from all

This will protect any files from being accessed without having permissions to do so.

Running the Installer Script

The installer script performs two main actions: populating the database and creating the configuration file config.php. The Moodle installer is initiated by entering the URL of the wwwroot (the location where you copied Moodle) into your web browser. The installer will recognize that Moodle hasn't been installed yet and will start the process automatically.

The Moodle installer has to set a session cookie. If your browser has been configured to trigger a warning, make sure you accept that cookie.

The first installation screen lets you choose the language to be used during the installation. This is not the locale used for Moodle, but only the installation:

Running the Installer Script

Before the Moodle installer continues, it checks that all your PHP settings are correct. If any of the tests are not passed, it is important that you go back to the software prerequisites section, resolve any problems, and restart the installation process after the issues have been fixed:

Running the Installer Script

The next screen displays the expected values for the Web address of the site (wwwroot), the Moodle Directory (dirroot), and the Data Directory (dataroot). You might have to modify the data directory entry if the location of your moodledata differs:

Running the Installer Script

If dataroot cannot be located or does not have the correct permissions, the following error message will be displayed:

"The'Data Directory' you specified could not be found or created. Either correct the path or create that directory manually."

If that is the case, go back to the Data Directory section to check for any problems.

The next screen deals with the configuration of your database, which we set up earlier:

Running the Installer Script

Once you are through the database details screen, the Moodle installer checks to see if a number of components are installed. Not all modules are compulsory (see the section on Prerequisites in this chapter).

Running the Installer Script

The next screen allows you to install additional language packs that are required if you want to support languages other than the one selected for the installer. See Chapter 8 for details on language packs.

Running the Installer Script

You will see in the next screen that the Moodle configuration file config.php has been successfully created. If the creation of the configuration file fails, the installer will let you download config.php. You will have to copy the text from the screen and paste it into a file called config.php in your dirroot:

Running the Installer Script

Before Moodle can proceed with the installation, you have to agree to the GPL (General Public Licence) agreement. You will find the full license text at http://docs.moodle.org/en/License:

Running the Installer Script

This screen is followed by the current release information that includes the version and built to be installed as well as a link to the current release notes.

Once this screen has been confirmed, the Moodle installer will create all tables in the database. If you untick the Unattended operation option, each screen will have to be confirmed. Unless this is your first installation or you have encountered problems with previous installations, it is usually not necessary to run the rest of the installation in attended operation mode:

Running the Installer Script

Once the table creation and population have been concluded, you will see the screen to set up the administrator account. The default username is admin, which can be changed. The self-explanatory fields you have to fill in are password, First name, Surname, Email address, City/town, and country. All other fields are explained in great detail in Chapter 5.

Running the Installer Script

The last screen of the installation script asks you to enter some Front Page settings, namely the Full site name, the Short name of your site, and a Site description. These front page settings can be modified later on (see Chapter 7 for detailed explanation).

Once this information has been entered and the screen has been confirmed, you are ready to start using Moodle. However, it is recommended to finalize the installation and to set up the execution of the Moodle maintenance script.

Finalizing the Installation

To make sure that Moodle is running without problems, go to Notifications in the Site Administration block. Your installation has been successful if the following screen is displayed:

Finalizing the Installation

Moodle provides some statistics about its usage on http://moodle.org/stats. To be included in these figures, you have to register your Moodle site. Registration is optional and free, and you decide which information will be made public. You will get occasional notices from moodle.org, for example about advance security alerts.

Moodle states that once you are registered the Moodle Registration button will be removed, which is not the case. The fact that the button remains actually makes sense, as it is used to change any of your registration details at a later stage:

Finalizing the Installation

The settings of the registration screen are as follows:

Setting up the Cron Process

Moodle has to perform a number of background tasks on a regular basis. The script that is performing these tasks is known as a cron script, which is executed by the so-called cron process. An entire page has been dedicated in the Moodle documentation and you can find it at http://docs.moodle.org/en/Cron. It is important that you set up the cron process. Otherwise, any timed Moodle features such as scheduled backups, sending forum notifications, statistics processing, and so on will not work.

The script cron.php is located in the admin directory and can be triggered manually through a web browser (unless your security settings have been changed). Once executed, the output from the script (http://yoursite/admin/cron.php) is shown on screen and you have to navigate back to your Moodle system manually.

Most control panels allow you to set up scheduled tasks via their interface. The following is a screenshot from the widely used Plesk system that executes the script every 5 minutes:

Setting up the Cron Process

There are a number of ways to call the cron script. wget q O /dev/null http://<yoursite>/admin/cron.php is the most popular option in a Linux environment (see Command in the preceding screenshot). However, if this does not suit your environment, check out http://docs.moodle.org/en/Cron for alternatives.

The above interface creates an entry in the crontab, a file located in the /etc directory that contains all system-wide cron entries. This file can also be added manually using crontab -e, but be careful to get the syntax right.

This concludes the entire installation process of Moodle. If you have come across any problems that have not been covered in these instructions, or your setup differs from the one described, go to http://docs.moodle.org/en/Installing_Moodle where more installation details are provided along with exceptions covered in great detail.

主站蜘蛛池模板: 文安县| 普安县| 于都县| 司法| 怀来县| 沽源县| 图木舒克市| 涡阳县| 调兵山市| 勃利县| 奉节县| 凌云县| 慈溪市| 财经| 永顺县| 东源县| 尤溪县| 承德县| 瑞安市| 贵阳市| 天镇县| 宝兴县| 扎鲁特旗| 威信县| 张家港市| 廉江市| 静乐县| 凤台县| 安顺市| 富民县| 科技| 灵寿县| 广宗县| 清徐县| 印江| 四子王旗| 饶阳县| 永年县| 芮城县| 富阳市| 汕尾市|