Moodle is free software you can use to build a learning platform website. This allows you to create a personalized learning environment on any topic you wish. From Moodle's About page:
Moodle's worldwide numbers of more than 213 million users across both academic and enterprise level usage makes it the world's most widely used learning platform.
DreamHost does not offer Moodle as a One-Click Install, however you can install it manually using the following instructions in this article.
Step 1 — Install an SSL certificate
All modern websites should be secured with an SSL certificate. This ensures that all traffic to and from your site is secure. There are two SSL certificate options in the DreamHost panel.
- Let's Encrypt (Free)
- Sectigo (Paid)
Both of these certificates can be used to secure your site. View the following article for further details.
View the following article for instructions on how to install your chosen certificate.
Step 2 — Create a database and change its collation
Moodle requires a database to store your user and course data. View the following article to create a new database in your DreamHost panel.
Moodle also recommends the database use utf8mb4 collation. View the following article for instructions on how to change the collation of your database to utf8mb4_unicode_ci.
This should be changed before installing the software.
Step 3 — Update your site's web directory in the panel
When you install the software as shown below, a directory named moodle is created within your website directory. For example.
The panel is configured to serve the files in the example.com directory by default. You must update this to serve the files from example.com/moodle.
Step 4 — Download the Moodle software
There are two options to add the Moodle software to your site.
- FTP (NOT RECOMMENDED) — The Moodle download contains around 250MB of files. Due to its size, it will take a very long time to download, extract, and upload. Uploads may also fail due to the large size. For this reason, it's not recommended to download/upload Moodle via FTP.
- SSH — Downloading the software via SSH is the fastest and most reliable option.
Downloading via SSH
- Log into your server via SSH.
- Navigate into your website directory.
[server]$ cd ~/example.com
- In your website directory, run the following command to download Moodle.
[server]$ git clone -b MOODLE_39_STABLE git://git.moodle.org/moodle.git
- This downloads the software into a new file directory named moodle.
Step 5 — Install the software
- Run the following command to create your site's config.php file.
[server]$ php moodle/admin/cli/install.php .-..-. _____ | || | /____/-.---_ .---. .---. .-.| || | .---. | | _ _ |/ _ \/ _ \/ _ || |/ __ \ * | | | | | || |_| || |_| || |_| || || |___/ |_| |_| |_|\_____/\_____/\_____||_|\_____) Moodle 3.9.1+ (Build: 20200903) command line installation program -------------------------------------------------------------------------------
- A series of questions display.
- Enter the code of the language you wish to install on your site. For example, English would be en. View Moodle's language guide for further information. ISO codes should be used.
== Choose a language == en - English (en) ? - Available language packs type value, press Enter to use default value (en) : en
- Press the Enter key to use the default permissions.
== Data directories permission == type value, press Enter to use default value (2777) :
- Enter your website URL. Make sure to include https:// at the beginning.
== Web address == type value : https://example.com
- Press the Enter key to create the moodledata directory in the default website directory.
== Data directory == type value, press Enter to use default value (/home/username/example.com/moodledata) :
- Press the Enter key to use the default mysqli setting.
== Choose database driver == mysqli mariadb type value, press Enter to use default value (mysqli) :
- Enter your database hostname. This was created in Step #2 above.
== Database host == type value, press Enter to use default value (localhost) : mysql.example.com
- Enter your database name. This was created in Step #2 above.
== Database name == type value, press Enter to use default value (moodle) : dbname
- Choose a table prefix, or press the Enter key to use the default prefix.
== Tables prefix == type value, press Enter to use default value (mdl_) :
- Press the Enter key to use the default port.
== Database port == type value, press Enter to use default value () :
- Press the Enter key to use the default socket.
== Unix socket == type value, press Enter to use default value () :
- Enter your database user. This was created in Step #2 above.
== Database user == type value, press Enter to use default value (root) : dbuser
- Enter the database user's password.
== Database password == type value : ********
- Enter a name for your site.
== Full site name == type value : Fundamentals of Physics
- Enter a short name for your site.
== Short name for site (eg single word) == type value : Physics101
- Create an admin username.
== Admin account username == type value, press Enter to use default value (admin) :MyAdminUsername
- Create an admin user password.
== New admin user password == type value : ********
- Add an admin email address.
== New admin user email address == type value, press Enter to use default value () : email@example.com
- Press the Enter key to use the default key.
== Upgrade key (leave empty to not set it) == type value :
- Type in y to accept the terms and conditions.
== Copyright notice == Moodle - Modular Object-Oriented Dynamic Learning Environment Copyright (C) 1999 onwards Martin Dougiamas (https://moodle.com) This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version. This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the Moodle License information page for full details:
https://docs.moodle.org/dev/License Have you read these conditions and understood them? type y (means yes) or n (means no) : y
- The database installation begins.
This installation will take over 40 minutes to complete.
Do not touch your terminal during this process. When finished, your terminal will display:
Installation completed successfully.
Step 6 — Create a cron job
Moodle requires a cron job to run every minute. Their documentation states the following.
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.
Your site will not work properly unless cron is running regularly. It is very important you do not skip this step.
There are two options to create the cron job.
Option 1 — Create the cron job in the panel
View the following article for instructions on how to create a cron job in the panel.
The problem with this method is that the panel only allows 12 cron jobs per hour. So you would have to run the cron job every 5 minutes.
Option 2 — Create the cron job manually via SSH
You can create it manually via SSH to run every minute.
Run the command crontab -e to open the crontab file. You would then enter the following to run every minute.
Make sure to change username to your actual shell username and example.com to your website.
[server]$ crontab -e MAILTO="firstname.lastname@example.org" * * * * * php /home/username/example.com/moodle/admin/cli/cron.php >/dev/null