Moodle/C2/Installing-and-configuring-Moodle/English
Title of the script: Installing and configuring Moodle
Author: Nancy Varkey
Keywords: Moodle, Moodle LMS, LMS, Learning Management System, Educational LMS, Open-source LMS, server setup for Moodle installation, Moodle installation, Moodle configuration
| Visual Cue | Narration |
| Title Slide | Welcome to the spoken tutorial on installing and configuring Moodle. |
| Pre-requisite slide:
You will need:
|
To follow this tutorial, you will need a machine with Ubuntu 22.04 OS.
You will need minimum 50 GB of free space on your machine. You will also need internet connection. |
| Pre-requisite slide:
You should have
|
You should also have done Server setup. |
| Only narration | We have completed the essential server setup steps earlier.
Now, let’s move onto installing and configuring Moodle 4.5. |
| On-screen-text can display the website in large text
Open a web browser and go to: https://download.moodle.org/download.php/stable405/moodle-4.5.3.zip |
First, we have to download Moodle from the official site.
Open a web browser and go to: https://download.moodle.org/download.php/stable405/moodle-4.5.3.zip |
| Switch to the Downloads folder and point to the zip file | The zip file is saved in the Downloads folder. |
| Switch to the terminal window | Next, go to the terminal window. |
| On-screen-text inside the terminal window>>
“Press Enter to run every command on the terminal.” |
Please note: After typing each command, press Enter to run it. |
| Slide: moodle-commands.txt file
For your convenience, a text file named moodle-commands.txt has been provided to you. Please copy-paste the commands from that file. |
A text file named moodle-commands.txt has been provided for your convenience.
Please copy-paste the commands from that file. |
| Type: cd Downloads/ | We will first navigate to the Downloads folder by typing:
cd Downloads/ |
| Type: sudo unzip moodle-4.5.3.zip -d /var/www/html/ | Unzip the Moodle package into the web directory by running:
sudo unzip moodle-4.5.3.zip -d /var/www/html/ This extracts all the Moodle files into the web server directory. |
| Type: sudo mkdir /var/www/moodledata | Now, we have to create a folder for the Moodle data. So run:
sudo mkdir /var/www/moodledata |
| Type: sudo chown -R www-data:www-data /var/www/moodledata | After that, we will change the ownership of this folder to the web server user.
So run: sudo chown -R www-data:www-data /var/www/moodledata |
| Type: sudo chown -R www-data:www-data /var/www/html/moodle | Next, we will set the permission for the Moodle files.
So run: sudo chown -R www-data:www-data /var/www/html/moodle |
| Type: sudo chmod -R 755 /var/www/moodledata >> press Enter
sudo chmod -R 755 /var/www/html/moodle |
Now we will specifically adjust some permissions.
So run the following 2 commands one after the other. sudo chmod -R 755 /var/www/moodledata sudo chmod -R 755 /var/www/html/moodle |
| Type: sudo chown -R www-data:www-data /var/lib/php/sessions | We also have to ensure that the PHP session files belong to the web user.
So run: sudo chown -R www-data:www-data /var/lib/php/sessions |
| Type: cd /var/www/html/moodle | Next, switch to the Moodle directory by typing:
cd /var/www/html/moodle |
| Type: sudo cp config-dist.php config.php | Copy the default configuration file by running this command:
sudo cp config-dist.php config.php |
| Type: sudo gedit config.php | Now, we will edit config.php to set the database and site details.
So type: sudo gedit config.php |
| Press Ctrl+F to find these lines if you cannot locate them easily with a visual search
<?php // Moodle configuration file $CFG->dbtype = 'mariadb'; $CFG->dblibrary = 'native'; $CFG->dbhost = 'localhost'; $CFG->dbname = 'moodledb'; $CFG->dbuser = 'moodleuser'; $CFG->dbpass = 'moodle123'; $CFG->prefix = 'mdl_'; $CFG->dboptions = array(); $CFG->wwwroot = 'http://localhost'; $CFG->dataroot = '/var/www/moodledata'; $CFG->dirroot = '/var/www/html/moodle'; // Leave if not available $CFG->admin = 'admin'; $CFG->directorypermissions = 02777; |
Add, modify or verify these parameters one by one. |
| Save and close the file | Save and close the file. |
| Next, we will configure Nginx for Moodle. | |
| Type: sudo gedit /etc/nginx/sites-available/moodle | Open a new site configuration file by running this command.
sudo gedit /etc/nginx/sites-available/moodle |
| Copy-paste this configuration code inside this file:
server { listen 80; server_name localhost; root /var/www/html/moodle; index index.php index.html index.htm; access_log /var/log/nginx/moodle_access.log; error_log /var/log/nginx/moodle_error.log; location / { try_files $uri $uri/ =404; } location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+\.php)(/.+)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_index index.php; fastcgi_pass unix:/var/run/php/php8.3-fpm.sock; } location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ { try_files $uri /index.php?$query_string; expires max; log_not_found off; } } |
Paste this configuration code inside this file. |
| Save and close the file | Save and close the file. |
| Type: sudo ln -s /etc/nginx/sites-available/moodle /etc/nginx/sites-enabled/ | Next, we will create a symbolic link to enable the site.
So run: sudo ln -s /etc/nginx/sites-available/moodle /etc/nginx/sites-enabled/ |
| On-screen-text:
“If you encounter port conflicts with the default site, change the default port in /etc/nginx/sites-available/default”. |
If you encounter port conflicts with the default site, change the default port in /etc/nginx/sites-available/default. |
| Type: sudo nginx -t | Finally, we will test the Nginx configuration.
So run: sudo nginx -t |
| Type: sudo systemctl reload nginx.service | If there are no errors, reload Nginx by typing:
sudo systemctl reload nginx.service |
| Only narration | Moodle is now installed and configured and the server setup is complete.
After this, we will setup the Moodle site. |
| Thank you slide | Thank you for following along. You are now on your way to hosting Moodle 4.5 on Ubuntu 22.04! |
| Slide: Acknowledgement | This spoken tutorial is brought to you by EduPyramids Educational Services Private Limited, SINE, IIT Bombay. |