Difference between revisions of "Moodle/C2/Installing-and-configuring-Moodle/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
 
Line 21: Line 21:
 
* Minimum 50 GB of free space on your machine
 
* Minimum 50 GB of free space on your machine
 
* Internet connection
 
* Internet connection
 +
 
||To follow this tutorial, you will need a '''machine''' with '''Ubuntu 22.04 OS'''.
 
||To follow this tutorial, you will need a '''machine''' with '''Ubuntu 22.04 OS'''.
  
Line 31: Line 32:
  
 
You should have
 
You should have
*Done Server setup
+
* Done Server setup
 
||You should also have done '''Server setup'''.
 
||You should also have done '''Server setup'''.
 +
 +
For the prerequisite Moodle tutorials please visit this website.
  
 
|-
 
|-
Line 44: Line 47:
  
 
Open a web browser and go to:
 
Open a web browser and go to:
 +
 
https://download.moodle.org/download.php/stable405/moodle-4.5.3.zip
 
https://download.moodle.org/download.php/stable405/moodle-4.5.3.zip
 
||First, we have to '''download Moodle''' from the '''official site'''.  
 
||First, we have to '''download Moodle''' from the '''official site'''.  
  
 
Open a '''web browser''' and go to:
 
Open a '''web browser''' and go to:
 +
 
'''https://download.moodle.org/download.php/stable405/moodle-4.5.3.zip'''
 
'''https://download.moodle.org/download.php/stable405/moodle-4.5.3.zip'''
  
Line 61: Line 66:
 
||On-screen-text inside the terminal window>>
 
||On-screen-text inside the terminal window>>
 
“Press Enter to run every command on the terminal.”
 
“Press Enter to run every command on the terminal.”
 +
 
||Please note: After typing each '''command''', press '''Enter''' to '''run''' it.
 
||Please note: After typing each '''command''', press '''Enter''' to '''run''' it.
  
Line 70: Line 76:
 
Please copy-paste the '''commands''' from that '''file'''.
 
Please copy-paste the '''commands''' from that '''file'''.
 
||A text file named '''moodle-commands.txt''' has been provided for your convenience.
 
||A text file named '''moodle-commands.txt''' has been provided for your convenience.
 +
 
Please copy-paste the '''commands''' from that file.
 
Please copy-paste the '''commands''' from that file.
  
Line 88: Line 95:
 
|-
 
|-
 
||Type: sudo mkdir /var/www/moodledata
 
||Type: sudo mkdir /var/www/moodledata
||Now, we have to create a '''folder''' for the '''Moodle data'''.  So '''run''':
+
||Now, we have to create a '''folder''' for the '''Moodle data'''.   
 +
 
 +
So '''run''':
  
 
'''sudo mkdir /var/www/moodledata'''
 
'''sudo mkdir /var/www/moodledata'''
Line 184: Line 193:
  
 
server {
 
server {
listen 80;
+
listen 80;
server_name localhost;
+
server_name localhost;
root /var/www/html/moodle;
+
root /var/www/html/moodle;
  
index index.php index.html index.htm;
+
index index.php index.html index.htm;
  
access_log /var/log/nginx/moodle_access.log;
+
access_log /var/log/nginx/moodle_access.log;
error_log /var/log/nginx/moodle_error.log;
+
error_log /var/log/nginx/moodle_error.log;
  
location / {
+
location / {
    try_files $uri $uri/ =404;
+
try_files $uri $uri/ =404;
}
+
}
  
location ~ [^/]\.php(/|$) {
+
location ~ [^/]\.php(/|$) {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
+
fastcgi_split_path_info ^(.+\.php)(/.+)$;
    include fastcgi_params;
+
include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
+
fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_index index.php;
+
fastcgi_index index.php;
    fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
+
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
}
+
}
  
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
+
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
    try_files $uri /index.php?$query_string;
+
try_files $uri /index.php?$query_string;
    expires max;
+
expires max;
    log_not_found off;
+
log_not_found off;
}
+
}
 
}
 
}
 
||Paste this '''configuration code''' inside this '''file'''.
 
||Paste this '''configuration code''' inside this '''file'''.
Line 232: Line 241:
 
|-
 
|-
 
||Type: sudo nginx -t
 
||Type: sudo nginx -t
||Finally, we will test the '''Nginx configuration'''.
+
||Finally, we will test the '''nginx configuration'''.
  
 
So '''run: sudo nginx -t'''
 
So '''run: sudo nginx -t'''
Line 238: Line 247:
 
|-
 
|-
 
||Type: sudo systemctl reload nginx.service
 
||Type: sudo systemctl reload nginx.service
||If there are no '''errors''', '''reload Nginx''' by typing:
+
||If there are no '''errors''', '''reload nginx''' by typing:
  
 
'''sudo systemctl reload nginx.service'''
 
'''sudo systemctl reload nginx.service'''
Line 250: Line 259:
 
|-
 
|-
 
||Thank you slide
 
||Thank you slide
|Thank you for following along.  You are now on your way to '''hosting Moodle 4.5''' on '''Ubuntu 22.04!'''
+
|Thank you for following along.   
 +
 
 +
You are now on your way to '''hosting Moodle 4.5''' on '''Ubuntu 22.04!'''
  
 
|-
 
|-
Line 257: Line 268:
  
 
|-
 
|-
 +
|}

Latest revision as of 19:10, 15 March 2026

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, video tutorial.


Visual Cues Narration
Title Slide Welcome to the spoken tutorial on installing and configuring Moodle.
Pre-requisite slide:

You will need:

  • A machine with Ubuntu 22.04 OS
  • Minimum 50 GB of free space on your machine
  • Internet connection
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

  • Done Server setup
You should also have done Server setup.

For the prerequisite Moodle tutorials please visit this website.

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.

Contributors and Content Editors

Madhurig, Nancyvarkey