Moodle is an open-source learning management system that is used by educators and institutions to create and deliver comprehensive online courses. This tutorial will guide you through the process of installing Moodle on Ubuntu Server Latest edition.
Before starting the installation process, you need to make sure that you meet the following requirements:
It's always a good idea to update your Ubuntu Server to the latest version. Run the following command to update the server:
sudo apt update && sudo apt upgrade
To install Apache Web Server, run the following command:
sudo apt install apache2
Once the installation is complete, start the Apache webserver using the following command:
sudo systemctl start apache2
You can also check the status of Apache using the following command:
sudo systemctl status apache2
If everything is working correctly, you should see the running status of Apache.
MariaDB is a popular open-source database server that is used by Moodle. To install MariaDB, Run the following command:
sudo apt install mariadb-server
Once the installation is complete, start the MariaDB server using the following command:
sudo systemctl start mariadb
You can also check the status of MariaDB using the following command:
sudo systemctl status mariadb
Before installing Moodle, you first need to create a database that it can use. To create a database, run the following command:
sudo mysql -u root -p
Enter your password when prompted. Once you're logged in to MariaDB CLI, run the following command to create a database:
CREATE DATABASE moodle;
Next, create a user and password for the database using the following command:
CREATE USER 'moodleuser'@'localhost' IDENTIFIED BY 'password';
Finally, grant the necessary permissions to the user and allow them to access the database:
GRANT ALL PRIVILEGES ON moodle.* TO 'moodleuser'@'localhost';
Exit the MariaDB CLI by typing exit;
.
Moodle requires PHP to function correctly. To install PHP, run the following command:
sudo apt install php libapache2-mod-php php-mysql php-gd php-xmlrpc php-curl php-intl php-soap php-xml php-mbstring zip unzip
Once the installation is complete, restart Apache using the following command:
sudo systemctl restart apache2
Next, download the Moodle installation files. You can download the latest version of Moodle from their official website (https://moodle.org/).
You can download the file directly to the server using the following command:
wget https://download.moodle.org/download.php/direct/stable310/moodle-latest-310.tgz
Extract the archive file using the following command:
sudo tar -zxvf moodle-latest-310.tgz -C /var/www/html/
Next, rename the extracted folder to moodle
:
sudo mv /var/www/html/moodle* /var/www/html/moodle
To configure Moodle, you need to create a config.php
file. Navigate to the following directory:
cd /var/www/html/moodle
sudo cp config-dist.php config.php
Open the config.php
file using a text editor:
sudo nano config.php
Find the following lines in the file:
$CFG->dbtype = '***';
$CFG->dblibrary = '***';
$CFG->dbhost = '***';
$CFG->dbname = '***';
$CFG->dbuser = '***';
$CFG->dbpass = '***';
Replace the lines with the following details:
$CFG->dbtype = 'mysqli';
$CFG->dblibrary = 'native';
$CFG->dbhost = 'localhost';
$CFG->dbname = 'moodle';
$CFG->dbuser = 'moodleuser';
$CFG->dbpass = 'password';
Save and close the file by pressing CTRL+X
, followed by Y
.
To configure Apache Web Server, you need to create a new virtual host. Create a new file called moodle.conf
:
sudo nano /etc/apache2/sites-available/moodle.conf
Add the following lines to the file:
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/moodle
ServerName example.com
ServerAlias www.example.com
<Directory /var/www/html/moodle>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/moodle-error.log
CustomLog /var/log/apache2/moodle-access.log common
</VirtualHost>
Replace example.com
with your domain name or IP address. Save and close the file.
Next, enable the newly created virtual host:
sudo a2ensite moodle.conf
Finally, restart Apache:
sudo systemctl restart apache2
You can now access Moodle by navigating to your server's IP address or domain name in a web browser. The installation process will begin automatically, and you will be asked a few questions regarding the installation.
Once the installation is complete, you can log in to your Moodle site and create your first course.
In this tutorial, you have learned how to install Moodle on Ubuntu Server Latest. We've covered all the necessary steps, from installing Apache Web Server and MariaDB to configuring Apache and Moodle. With your Moodle site now up and running, you can start creating comprehensive online courses for your students.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!