Bobcares

Setting Up Moodle on Ubuntu: A Tutorial

by | May 23, 2024

Learn how to set up Moodle on Ubuntu. Our Moodle Support team is here to help you with your questions and concerns.

Setting Up Moodle on Ubuntu: A Tutorial

Moodle is a popular open-source LMS. It is widely used by educational institutions, training organizations, and individual instructors.

Setting Up Moodle on Ubuntu: A Tutorial

Our experts have put together these steps to help you set up Moodle on a VPS server running Ubuntu.

Pre-requisites for Installing Moodle

  • Make sure you have a VPS server running Ubuntu.
  • Get a fully-qualified domain name pointing to your server’s IP address.

Step-by-step Guide

  1. First, connect to the server via SSH and update system packages:
    sudo apt update && apt upgrade -yCopy Code
  2. Then, install Apache web server, MySQL client and server, and PHP 7.4 along with the required modules:
    sudo apt install apache2 mysql-client mysql-server php7.4 libapache2-mod-php
    Copy Code
  3. After that, install additional software and PHP libraries needed for Moodle:
    sudo apt install graphviz aspell ghostscript clamav php7.4-pspell php7.4-curl php7.4-gd php7.4-intl php7.4-mbstring php7.4-xml php7.4-xmlrpc php7.4-zipCopy Code
  4. Now, restart Apache to apply the changes:
    sudo service apache2 restartCopy Code

    We can check the status of Apache with this command:

    sudo systemctl status apache2Copy Code
  5. Then, go to the /opt directory and clone the Moodle repository:
    cd /opt
    sudo git clone git://git.moodle.org/moodle.git
    Copy Code
  6. Next, go to the Moodle directory, list the available branches, and check out the desired branch:
    cd moodle
    sudo git branch -a
    sudo git branch --track MOODLE_39_STABLE origin/MOODLE_39_STABLE
    sudo git checkout MOODLE_39_STABLE
    Copy Code
  7. Then, copy the Moodle directory to the Apache document root:
    sudo cp -R /opt/moodle /var/www/html/Copy Code
  8. After that, create and set permissions for the Moodle data directory:
    sudo mkdir /var/moodledata
    sudo chown -R www-data /var/moodledata
    sudo chmod -R 777 /var/moodledata
    sudo chmod -R 0755 /var/www/html/moodle
    Copy Code
  9. Now, open the MySQL configuration file and add these lines:
    default_storage_engine = innodb
    innodb_file_per_table = 1
    innodb_file_format = Barracuda
    Copy Code
  10. Next, save the file and restart MySQL.
  11. Now, connect to MySQL and create the Moodle database:
    mysql -u root -p
    CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    CREATE USER 'moodleuser'@'localhost' IDENTIFIED BY 'yourpassword';
    GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO 'moodleuser'@'localhost';
    quit
    Copy Code
  12. Then, set permissions for the Moodle directory:
    sudo chmod -R 777 /var/www/html/moodleCopy Code
  13. Finally, restart Apache.
  14. Open the web browser and go to the server’s IP address followed by `/moodle/install.php`. For example:
    http://our-server-ip/moodle/install.phpCopy Code
  15. then, complete the setup by following the instructions in the web installer.
  16. After installation, log in to the Moodle admin panel to customize settings, manage courses, and oversee user accounts.

With these steps, we will have Moodle up and running on our Ubuntu server in no time.

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

In brief, our Support Experts demonstrated how to set up Moodle on Ubuntu.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Speed issues driving customers away?
We’ve got your back!