Note: You are currently viewing documentation for Moodle 3.2. Up-to-date documentation for the latest stable version of Moodle is probably available here: Installation quick guide.

Installation quick guide: Difference between revisions

From MoodleDocs
m (removing broken interlang links)
m (→‎Getting Moodle: Corrected command which was causing confusion)
 
(46 intermediate revisions by 11 users not shown)
Line 1: Line 1:
{{Installing Moodle}}
{{Installing Moodle}}
'''This page is intended for administrators who are experienced with installing web server applications and are in a hurry to get up and running. For everybody else, please see [[Installing Moodle]]'''.
''This page is intended for administrators who are experienced with installing web server applications and are in a hurry to get up and running. Otherwise please see [[Installing Moodle]]''.


===Basic Requirements===
==Basic Requirements==


* You will need a working web server (e.g. [[Apache]]), a database (e.g. [[MySQL]] or [[PostgreSQL]]) and have [[PHP]] configured.  
* You will need a working web server (e.g. [[Apache]]), a database (e.g. [[MySQL]], [[MariaDB]] or [[PostgreSQL]]) and have [[PHP]] configured. See the [{{Release notes}} release notes] in the dev docs for software requirements.
* Moodle requires a number of [[PHP]] extensions. However, Moodle checks early in the installation process and you can fix the problem and re-start the install script if any are missing.
* Moodle requires a number of [[PHP]] extensions. However, Moodle checks early in the installation process and you can fix the problem and re-start the install script if any are missing.
* If you want Moodle to send email (you probably do) you need a working Sendmail (Unix/Linux) on your server or access to an SMTP mail server.
* If you want Moodle to send email (you probably do) you need a working Sendmail (Unix/Linux) on your server or access to an SMTP mail server.


===Getting Moodle===
==Getting Moodle==


You have two basic options:
You have two basic options:
Line 14: Line 14:
* Pull the code from the Git repository (recommended for developers and also makes upgrading very simple):
* Pull the code from the Git repository (recommended for developers and also makes upgrading very simple):
<pre>
<pre>
git clone -b MOODLE_21_STABLE git://git.moodle.org/moodle.git  
git clone -b MOODLE_32_STABLE git://git.moodle.org/moodle.git  
</pre>
</pre>
...this fetches a complete copy of the Moodle repository and then switches to the 2.1 Stable branch.
...this fetches a complete copy of the Moodle repository and then switches to the {{Version}} Stable branch.  


'''NOTE: only download Moodle from one of the moodle.org sources. Other versions (e.g. control panel based installers, Linux distribution repositories) cannot be guaranteed to work properly, be upgradable or be supportable.
See [[Git_for_Administrators|Git for Administrators ]] for details on using Git to install Moodle code.


===Create a database===
Note: Only download Moodle from one of the moodle.org sources. Other versions (e.g. control panel based installers, Linux distribution repositories) cannot be guaranteed to work properly, be upgradable or be supportable.
 
==Create a database==


* Using your chosen database server, create a new empty database. The default encoding must be UTF8. For example, using MySQL:
* Using your chosen database server, create a new empty database. The default encoding must be UTF8. For example, using MySQL:
<pre>
<pre>
CREATE DATABASE moodle DEFAULT CHARACTER SET UTF8 COLLATE utf8_unicode_ci;
CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
</pre>
</pre>
* Create a user/password combination with appropriate permissions for the database. For example (MySQL again):
* Create a user/password combination with appropriate permissions for the database. For example (MySQL again):
<pre>
<pre>
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO moodleuser@localhost IDENTIFIED BY 'yourpassword';
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO 'moodleuser'@'localhost' IDENTIFIED BY 'yourpassword';
</pre>
</pre>


===Create data directory===
Notes: It is important to GRANT ON moodle.* as the database name including the '.*' and not just the bare database name. Save this password you use for the Moodle user, since you will need it later in the install.
 
==Create data directory==


* Create an empty directory to hold Moodle files. It '''must not''' be in the area served by the web server and must have permissions so that the web server user can write to it. Typically, either make it owned by the web server user or give it write permissions for 'everyone'.
* Create an empty directory to hold Moodle files. It '''must not''' be in the area served by the web server and must have permissions so that the web server user can write to it. Typically, either make it owned by the web server user or give it write permissions for 'everyone'.


===Install Moodle code===
==Install Moodle code==


* Unzip / move / copy the Moodle code (obtained above) so that it will be served by your web server (e.g. on Debian based Linux, move to /var/www/moodle)
* If you downloaded the zip or tgz file earlier, then unzip / untar / move / copy the Moodle code (obtained above) so that it will be served by your web server (e.g. on Debian based Linux, move to /var/www/moodle)
* Check the permissions and make sure that the web server does '''not''' have permissions to write to any of the files in the Moodle code directories (a very common root cause of sites being hacked).
* Check the permissions and make sure that the web server does '''not''' have permissions to write to any of the files in the Moodle code directories (a very common root cause of sites being hacked).
* If you need to, configure your web server to serve the Moodle site with your chosen URL.
* If you need to, configure your web server to serve the Moodle site with your chosen URL.


===Configure Moodle===
==Configure Moodle==


* In the Moodle code directory, find the file ''config-dist.php'' and copy it to a new file called ''config.php'' (but read next step, 'Install Moodle', first).
* In the Moodle code directory, find the file ''config-dist.php'' and copy it to a new file called ''config.php'' (but read next step, 'Install Moodle', first).
* Edit config.php with your favourite editor and change the appropriate settings to point to your site, directories and database. ''Note: the Moodle install script will create config.php for you if it does not exist but make sure you (re-)set permissions appropriately afterwards''
* Edit config.php with your favourite editor and change the appropriate settings to point to your site, directories and database. ''Note: the Moodle install script will create config.php for you if it does not exist but make sure you (re-)set permissions appropriately afterwards''


===Install Moodle===
==Install Moodle==


* Go to the URL for your moodle site in a browser (installation will complete automatically) or run the command line version at (requires cli version of PHP):
* Go to the URL for your moodle site in a browser (installation will complete automatically) or run the command line version at (requires cli version of PHP):
Line 55: Line 59:
* After completing the install make sure your file permissions are ok for the Moodle program files (not writeable by web server) and the Moodle data files (writeable by web server).
* After completing the install make sure your file permissions are ok for the Moodle program files (not writeable by web server) and the Moodle data files (writeable by web server).


===Set up cron===
==Set up cron==


* You will need a cron job to run periodically. A typical Unix cron entry will be as follows:
You will need a cron job to run periodically. It is recommended that ''the cron is run every minute'', as required for asynchronous activity deletion when using the [[Recycle bin|recycle bin]]. A typical Unix cron entry will be as follows:
<pre>
<pre>
*/15 * * * *    /usr/bin/php /path/to/moodle/admin/cli/cron.php >/dev/null
* * * * *    /usr/bin/php /path/to/moodle/admin/cli/cron.php >/dev/null
</pre>
</pre>
See [[Cron]] for more options.
You do not set up Cron inside Moodle but on your server.  Your site '''will not work properly''' unless cron is running regularly. It is very important you do not skip this step.
 
See [[Cron]] for details.


===Congratulations!===
==Congratulations!==


You are now ready to use your Moodle site. If you run into problems see the 'See Also' below or ask in the forums at http://moodle.org.
You are now ready to use your Moodle site.


==See also==
If you run into problems, check the [[Installation FAQ]] and visit the [http://moodle.org/mod/forum/view.php?id=28 Installation help forum].


* [[Installing Moodle]] A more detailed installation guide
[[Category:Quick guide]]
* [[Installation FAQ]]


[[ja:インストールクイックスタート]]
[[ja:インストールクイックスタート]]
[[de:Installation in Kürze]]
[[de:Installation in Kürze]]
[[fr:Installation_rapide]]
[[es:Inicio_Rápido_de_Instalación]]

Latest revision as of 18:14, 27 November 2017

This page is intended for administrators who are experienced with installing web server applications and are in a hurry to get up and running. Otherwise please see Installing Moodle.

Basic Requirements

  • You will need a working web server (e.g. Apache), a database (e.g. MySQL, MariaDB or PostgreSQL) and have PHP configured. See the release notes in the dev docs for software requirements.
  • Moodle requires a number of PHP extensions. However, Moodle checks early in the installation process and you can fix the problem and re-start the install script if any are missing.
  • If you want Moodle to send email (you probably do) you need a working Sendmail (Unix/Linux) on your server or access to an SMTP mail server.

Getting Moodle

You have two basic options:

  • Download your required version from http://moodle.org/downloads ... OR
  • Pull the code from the Git repository (recommended for developers and also makes upgrading very simple):
git clone -b MOODLE_32_STABLE git://git.moodle.org/moodle.git 

...this fetches a complete copy of the Moodle repository and then switches to the 3.2 Stable branch.

See Git for Administrators for details on using Git to install Moodle code.

Note: Only download Moodle from one of the moodle.org sources. Other versions (e.g. control panel based installers, Linux distribution repositories) cannot be guaranteed to work properly, be upgradable or be supportable.

Create a database

  • Using your chosen database server, create a new empty database. The default encoding must be UTF8. For example, using MySQL:
CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
  • Create a user/password combination with appropriate permissions for the database. For example (MySQL again):
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO 'moodleuser'@'localhost' IDENTIFIED BY 'yourpassword';

Notes: It is important to GRANT ON moodle.* as the database name including the '.*' and not just the bare database name. Save this password you use for the Moodle user, since you will need it later in the install.

Create data directory

  • Create an empty directory to hold Moodle files. It must not be in the area served by the web server and must have permissions so that the web server user can write to it. Typically, either make it owned by the web server user or give it write permissions for 'everyone'.

Install Moodle code

  • If you downloaded the zip or tgz file earlier, then unzip / untar / move / copy the Moodle code (obtained above) so that it will be served by your web server (e.g. on Debian based Linux, move to /var/www/moodle)
  • Check the permissions and make sure that the web server does not have permissions to write to any of the files in the Moodle code directories (a very common root cause of sites being hacked).
  • If you need to, configure your web server to serve the Moodle site with your chosen URL.

Configure Moodle

  • In the Moodle code directory, find the file config-dist.php and copy it to a new file called config.php (but read next step, 'Install Moodle', first).
  • Edit config.php with your favourite editor and change the appropriate settings to point to your site, directories and database. Note: the Moodle install script will create config.php for you if it does not exist but make sure you (re-)set permissions appropriately afterwards

Install Moodle

  • Go to the URL for your moodle site in a browser (installation will complete automatically) or run the command line version at (requires cli version of PHP):
/usr/bin/php /path/to/moodle/admin/cli/install.php

The CLI creates the config.php for you and will not run if you created one in the previous step.

  • After completing the install make sure your file permissions are ok for the Moodle program files (not writeable by web server) and the Moodle data files (writeable by web server).

Set up cron

You will need a cron job to run periodically. It is recommended that the cron is run every minute, as required for asynchronous activity deletion when using the recycle bin. A typical Unix cron entry will be as follows:

* * * * *    /usr/bin/php /path/to/moodle/admin/cli/cron.php >/dev/null

You do not set up Cron inside Moodle but on your server. Your site will not work properly unless cron is running regularly. It is very important you do not skip this step.

See Cron for details.

Congratulations!

You are now ready to use your Moodle site.

If you run into problems, check the Installation FAQ and visit the Installation help forum.