Install Moodle LMS on Debian/Ubuntu

Moodle_Learning Management System
Moodle is a free and open-source learning management system (LMS) written in PHP and distributed under the GNU General Public License. Developed on pedagogical principles, Moodle is used for blended learning, distance education, flipped classroom, and other e-learning projects in schools, universities, workplaces, and other sectors. With customizable management features, it is used to create private websites with online courses for educators and trainers to achieve learning goals. Moodle (an acronym for modular object-oriented dynamic learning environment) allows for extending and tailoring learning environments using community sourced plugins.

Open Applications > System Tools > Terminal and execute commands one by one mentioned on this page.

sudo apt-get update && sudo apt-get upgrade -y

Install LAMP Stack

Use this If you are using Ubuntu 20.04 LTS 

  • While installing LAMP stack you may have to  set MySQL root password) If you are installing moodle on the same server in which koha has  installed, you may not be asked for setting MySQL root password
  • Change opac port to 8001/8081 or else If your koha opac port is 80 and add  Listen 80 in ports.conf

sudo nano /etc/apache2/ports.conf

Listen 80

cd /var/www/html

Download Moodle from the official website to web root directory /var/www/html

sudo wget

sudo unzip

Rename moodle-latest-39 to moodle

sudo mv /var/www/html/moodle-latest-39 /var/www/html/moodle


get moodle-3.7.tgz below link, extract, rename it into moodle and move from Download directory into /var/www/html

Change ownership and permission of the as Moodle follows

sudo chown -R www-data.www-data moodle

sudo chmod -R 775 moodle

Create a new virtual host configuration for accessing the Moodle

sudo nano /etc/apache2/sites-available/moodle.conf

add these lines

<VirtualHost *:80>
DocumentRoot /var/www/html/moodle/

<Directory /var/www/html/moodle/>
AllowOverride All
allow from all

Enable site access

sudo a2ensite moodle.conf

Disable default access

sudo a2dissite 000-default.conf

Reload apache2 again

sudo systemctl reload apache2
Enable rewrite module

sudo a2enmod rewrite

Reload & restart the apache service to make the changes effect

sudo systemctl reload apache2 && sudo systemctl restart apache2

Now you can proceed the further installation and configuration from the browser by navigating to the following URL: http://youripaddress or

Choose the installation paths

Create a new directory and set permission and ownership

sudo mkdir moodledata
sudo chown -R www-data.www-data moodledata
sudo chmod -R 775 moodledata

Restart the apache service to make the changes effect

sudo systemctl restart apache2

Choose the Database as shown in it


Create database and username and assign a password

sudo mysql -uroot -p
(mysql root password)

create database moodle;
CREATE USER 'moodle'@'localhost' IDENTIFIED BY 'moodle123';

Now provide database connection details

Database connection          : localhost
Database name                   : moodle
Username                           : moodle
Password                            : moodle123

If PHP needs below extensions please install that too

php extension/intl

sudo apt-get install php-intl

php extension/xmlrpc

sudo apt-get install php-xmlrpc

php extension/soap

sudo apt-get install php-soap

Restart the apache & MySQL service to make the changes effect

sudo systemctl restart apche2 mariadb

That's it, now configures the Admin user setup and starts working on moodle


0 Komentar