Set up Moodle LMS on Debian/Ubuntu operating system

Moodle Learning Management System

Moodle is an open-source platform for managing online learning. It’s built with PHP and freely available under the GNU General Public License. Based on educational principles, Moodle supports various learning environments, including blended learning, distance education, flipped classrooms, and other e-learning initiatives. Used in schools, universities, workplaces, and more, its customizable features allow educators and trainers to build private websites with online courses tailored to their learning objectives. Moodle, short for “modular object-oriented dynamic learning environment,” can be expanded and customized further using plugins created by the Moodle community.

To install Moodle, begin by opening a terminal window through Applications > System Tools. Execute the following commands, one by one:

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

Next, install the LAMP stack, referring to the following resources:

Important Notes:

  • During the LAMP installation, you might be prompted to set a MySQL root password. If you are installing Moodle on the same server where Koha is already installed, this step might not be necessary.

  • If your Koha OPAC port is set to 80, you will need to change it to either 8001 or 8081. Add ‘Listen 80’ to your ports.conf file:

    sudo nano /etc/apache2/ports.conf

    Add: Listen 80 **
    cd /var/www/html**

Download the latest version of Moodle from the official website: https://download.moodle.org/releases/latest/

sudo wget https://download.moodle.org/download.php/stable39/moodle-latest-39.zip

**sudo unzip **moodle-latest-39.zip

Rename the extracted folder to ‘moodle’:

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

Alternatively:

Download the moodle-3.7.tgz file from this link: https://drive.google.com/open?id=19oFxvOsisHzSpm3jrSwbKCVkvriit75B . Extract the contents, rename the folder to ‘moodle’, and move it to /var/www/html.

Adjust the ownership and permissions of the Moodle directory:

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

sudo chmod -R 775 moodle**

Create a virtual host configuration file for Moodle access:

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

Add the following lines:

ServerName www.yourdomain.com DocumentRoot /var/www/html/moodle/

AllowOverride All allow from all

Enable the new Moodle site:

sudo a2ensite moodle.conf

Disable the default Apache site:

sudo a2dissite 000-default.conf

Reload apache2:

sudo systemctl reload apache2

Enable the rewrite module:

sudo a2enmod rewrite

Reload and restart Apache for the changes to take effect:

sudo systemctl reload apache2 && sudo systemctl restart apache2

You can now proceed with the web-based installation and configuration by visiting your server’s IP address or domain name: http://youripaddress or domainname.com

During the setup:

  • Specify installation paths as needed.

  • Create a new directory for Moodle data and set appropriate ownership and permissions:

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

Restart Apache:

sudo systemctl restart apache2

  • Choose MySQL/MariaDB as your database.

  • Create the Moodle database and user:

    sudo mysql -uroot -p
    (Enter your MySQL root password)

    create database moodle; CREATE USER ‘moodle’@’localhost’ IDENTIFIED BY ‘moodle123’; GRANT ALL PRIVILEGES ON *.* TO ‘moodle’@’localhost’ WITH GRANT OPTION; FLUSH PRIVILEGES; quit;

  • Provide these database connection details during setup:

    • Database connection: localhost
    • Database name: moodle
    • Username: moodle
    • Password: moodle123
  • Install any required PHP extensions:

    sudo apt-get install php-intl

    sudo apt-get install php-xmlrpc

    sudo apt-get install php-soap

Restart Apache and MySQL for the changes to take effect:

sudo systemctl restart apache2 mariadb

Your Moodle installation should now be complete. Proceed with the admin user setup and start using your new learning platform.

References:

Licensed under CC BY-NC-SA 4.0
Last updated on Mar 25, 2023 14:23 +0100