Moodle is a free and open-source learning management system (LMS) written in PHP and released under the GNU General Public License. It is used in universities, businesses, and in many organizations to create and deliver online courses and other learning materials. You can create learning courses from Moodle and share them with your viewers/friends/students e.t.c.

Some of the good Moodle features are:

  • It is Open source: This gives you the freedom to adopt and modify the source code to fit your desired needs.
  • It is a Cost-effective solution: Being open source there’s no hidden charges or licensing fees involved.
  • Highly Flexible: You enjoy high level of customization of Moodle with a wide range of features.
  • Scalable learning solution: Moodle is suitable for use in small, medium and also large-scale deployments suiting many organization sizes.

1) Moodle Dependencies

Moodle has the following dependencies

  • PHP
  • Apache / Nginx Web server
  • MySQL / MariaDB database server

In this tutorial, we will install and configure Moodle to use MariaDB database and Apache web server.

2) Install PHP and required modules

PHP is available on both Debian and Ubuntu repositories. Install it by running the following commands

sudo apt update
sudo apt -y install vim php-cli php-intl php-xmlrpc php-soap php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath libapache2-mod-php

To verify PHP version installed run:

$ php --version
PHP 8.3.6 (cli) (built: Jun 13 2024 15:23:20) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.6, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.6, Copyright (c), by Zend Technologies

3) Install MariaDB Database Server

After installing PHP, next is to setup MariaDB database

sudo apt install mariadb-server

Once the database server is installed, open the configuration file

sudo vim /etc/mysql/mariadb.conf.d/50-server.cnf

Then add below lines under  [mysqld] section

innodb_file_format = Barracuda 
default_storage_engine = innodb
innodb_large_prefix = 1
innodb_file_per_table = 1

Save the changes and restart MariaDB systemd service.

sudo systemctl restart mariadb

Login to the mysql console as root user to create database and user.

sudo mysql -u root -p

Create a database and user for Moodle

CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
GRANT ALL ON  moodle.* TO 'moodle'@'localhost' IDENTIFIED BY "StrongDBPassw0$D";
FLUSH PRIVILEGES;
QUIT

4) Download and Configure Moodle

Download the latest release of Moodle from Github

sudo apt -y  install wget
wget https://download.moodle.org/download.php/direct/stable404/moodle-latest-404.tgz

Extract the downloaded file

tar xvf moodle-latest-404.tgz

Move the created directory to /var/www directory

sudo mv moodle /var/www/html/moodle/

Create an empty directory to hold Moodle files.

sudo mkdir /var/www/moodledata

Set permissions for Moodle web directory

sudo chown -R www-data:www-data /var/www/html /var/www/moodledata

5) Set up Apache Web Server

We also need Apache web server to host our Moodle application. Install it like below:

sudo apt -y install vim apache2 libapache2-mod-php

Create an Apache VirtualHost configuration file

sudo vim /etc/apache2/sites-enabled/moodle.conf

Put the contents below into the file

<VirtualHost *:80>
     DocumentRoot /var/www/html/moodle/
     ServerName elearning.example.com
     ServerAlias www.elearning.example.com
     ServerAdmin [email protected]
 
     <Directory /var/www/html/moodle/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
     </Directory>

     ErrorLog /var/log/apache2/moodle_error.log
     CustomLog /var/log/apache2/moodle_access.log combined
</VirtualHost>

Replace elearning.example.com with your domain name for Moodle, save the file and exit. The name used should have an A record in DNS or mapping done in your local system /etc/hosts file.

Enable the Apache rewrite module

sudo a2enmod rewrite
sudo systemctl restart apache2

6) Access Moodle Setup Wizard

Now browse to your Moodle server IP or Hostname to finish the setup of Moodle on Ubuntu.

1. Choose your installation language for Moodle and click “Next”

install moodle ubuntu 18.04 debian 9 01

2. Setup Web address, Moodle directory, and Data directory

install moodle ubuntu 18.04 debian 9 02

3. On the next page, choose a database driver – Mariadb (native/mariadb)

install moodle ubuntu 18.04 debian 9 03

4. Provide Database host, Database name, Database user and Database password

install moodle ubuntu 18.04 debian 9 04

5. Confirm that you have read the conditions and understood them

install moodle ubuntu 18.04 debian 9 05

6. If your server environment meets all minimum requirements, click Continue to finish the installation.

install moodle ubuntu 18.04 debian 9 06

7. Create an admin user account on the next page

install moodle ubuntu 18.04 debian 9 07

8. Configure your Front page settings

install moodle ubuntu 18.04 debian 9 08

10. You should now get to Moodle dashboard.

install moodle ubuntu 18.04 debian 9 09

Congratulation!!. You just installed Moodle E-Learning platform on Ubuntu / Debian. Enjoy and stay connected for more nice how-to guides.

LEAVE A REPLY

Please enter your comment!
Please enter your name here