Learn How To Install Moodle on Ubuntu Server 16.04
Table of Contents
Moodle is a popular, robust open-source learning platform to create personalized learning environments supported by a global community of people that powers learning environments worldwide. In this guide you will learn how to install and setup Moodle on your Ubuntu 16.04 server instance.
- A 1GB Ubuntu Server 16.04 server instance.
- The typical LAMP stack (Apache, MySQL and PHP).
- Update the OS packages:
- Install the required PHP modules:
apt-get install aspell graphviz php7.0-curl php7.0-gd php7.0-intl php7.0-ldap php7.0-mysql php7.0-pspell php7.0-xml php7.0-xmlrpc php7.0-zip
- Restart the Apache web server:
service apache2 restart
Download Moodle via Curl from the official Moodle distribution server.
- Download the Moodle files:
curl -L https://download.moodle.org/download.php/direct/stable32/moodle-latest-32.tgz > moodle.tgz
- Extract the Moodle files from the downloaded archive and place them in the default Apache document root:
sudo tar -xvzf moodle.tgz -C /var/www/html
We are now going to create a directory for Moodle outside the web root folder to store course related data. This is a more secure approach compared to storing the course data inside the Moodle root directory:
- Create the directory:
- Change the ownership of the directory so the web server user has access to it:
chown -R www-data /var/moodledata
- Set the proper permissions of the directory:
chmod -R 0770 /var/moodledata
Now we need to create the MySQL database that Moodle will use to store its data. We’ll configure MySQL to follow the structure which Moodle expects. and create a user for the database.
Open up the MySQL config file.
Under the “Basic Settings” section, add the following lines.
default_storage_engine = innodb innodb_file_per_table = 1 innodb_file_format = Barracuda
Save the config file and restart MySQL.
service mysql-server restart
Now we can create the database.
Login to MySQL.
mysql -u root -p
Enter the root password when prompted which you specified during the MySQL setup.
Enter the following command to create the database.
CREATE DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Create the database user permissions for the database.
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO 'moodler'@'localhost' IDENTIFIED BY 'YourMoodlePassword';
Exit the MySQL CLI.
Note: You should use a secure password for your database.
Congratulations! You now have a successful installation of Moodle running on your Ubuntu Server 16.04 instance. To complete the installation, open your browser and navigate to
http://YOUR_SERVER_IP/moodle. This should be very straightforward but you can always refer to the official installation guide.
Do you need help setting up this on your own service?
Please contact us and we’ll provide you the best possible quote!