Moodle is a learning platform designed to provide educators, administrators and learners with a single robust, secure and integrated system to create personalized learning environments, also allows you to manage user roles, so students and instructors can have different levels of access to materials.
Once installed on your web-server, everyone have access to the site can create and participate in “browser-based learning”.
In this tutorial, you will learn how to install and set up Moodle on your Ubuntu 16.04 server, run through the setup wizard, choose a theme, and create your first course, but make sure first that you had installed LAMP, if not then go install it first and proceed with this tutorial.
1. First, Make sure that your linux packages is up to date, run the below command to update it.
sudo apt-get update
2. Install Moodle’s dependencies by running the below command on “Terminal”.
sudo 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
type “Y” and press Enter to continue.
2. Now we are totally ready to download “Moodle”, you can download it by the command below.
curl -L https://download.moodle.org/download.php/direct/stable32/moodle-latest-32.tgz > moodle.tgz
3. You can extract the file, in the web document root, by the command below.
sudo tar -xvzf moodle.tgz -C /var/www/html
4. You have to run the below command to make sure that “Moodle” directory in your server web directory.
5. View the files in the “Moodle” directory, by the below command.
6. Create a new directory outside the web-root for Moodle to store all its data, create it by the below command.
sudo mkdir /var/moodledata
7. Set ownership to make sure that web-service user “www-data” can access the directory.
sudo chown -R www-data /var/moodledata
8. Change the permissions on the created directory so that only the owner got full permissions.
sudo chmod -R 0770 /var/moodledata
Configure “Moodle” Database
1. At the first we need to configure MySQL installation so it can be compatible with “Moodle”, open it with nano editor by running the below command.
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
2. Add the below 3 lines and as it shown on the screenshot, you will have to add the below 3 lines under “Basic Setting” area.
default_storage_engine = innodb
innodb_file_per_table = 1
innodb_file_format = Barracuda
3. Save the file and restart MySQL server by the below command.
sudo systemctl restart mysql
4. Now create Moodle database on MySQL, Execute the below command.
sudo mysql -u root -p
5. You are now logged in, execute the below command to create the database.
CREATE DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
6. Create user so “Moodle” can’t know what is the root password, create your own user by the below command and don’t forget to set your own username & password.
create user ‘avoiderrors’@’localhost’ IDENTIFIED BY ‘YOUR PASSWORD HERE’;
7. Grant your user full permissions, so the user can create tables and change permissions, make sure to edit the code with your user & password.
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO ‘avoiderrors’@’localhost’ IDENTIFIED BY ‘PASSWORD U HAD SET’;
8. End MySQL command line, by the below command.
Run Moodle through Web browser
1. Open your web browser and enter your IP address following by “/moodle”.
2. Set your preferred language and click “Next”.
3. On the second page, set “Data Directory” to this path “/var/moodledata/”, and click Next.
4. On the Database page, enter the user name and password that we had created from MySQL command line-interface.
5. The configuration is complete now, proceed by clicking “Next”.
In this tutorial you had learned how to install and set up “Moodle” on an Ubuntu 16.04 server, if you need any additional help please comment below and i shall reply to you ASAP.