How to Install Moodle on Ubuntu

How to Install Moodle on Ubuntu
  1. Introduction to Moodle
  2. Benefits of Using Moodle
  3. Prerequisites for Installing Moodle on Ubuntu
    • Ubuntu Server
    • LAMP Stack
  4. Step-by-Step Guide to Installing Moodle on Ubuntu
    • Update Ubuntu
    • Install Apache
    • Install MySQL
    • Install PHP
    • Download Moodle
    • Extract Moodle
    • Configure Apache
    • Create Moodle Database
    • Configure Moodle
    • Complete Installation via Web Interface
  5. Troubleshooting Common Installation Issues
  6. Conclusion
  7. FAQs

How to Install Moodle on Ubuntu

Moodle is a popular open-source learning management system (LMS) used by educators and institutions worldwide to create online learning environments. Installing Moodle on Ubuntu can provide a powerful platform for delivering courses and managing educational content. In this guide, we will walk you through the process of installing Moodle on an Ubuntu server.

Benefits of Using Moodle

Moodle offers several advantages, including:

  • Customizable: Moodle can be tailored to fit the specific needs and requirements of different educational institutions.
  • Collaborative: It supports collaboration among students and teachers through forums, wikis, and other interactive tools.
  • Scalable: Moodle can scale to accommodate the needs of both small classrooms and large institutions.
  • Community Support: As an open-source platform, Moodle benefits from a large community of developers and users who contribute to its development and provide support.

Prerequisites for Installing Moodle on Ubuntu

Before installing Moodle on Ubuntu, make sure you have the following prerequisites in place:

  • Ubuntu Server: You'll need a running instance of Ubuntu Server to host Moodle.
  • LAMP Stack: Moodle requires a LAMP (Linux, Apache, MySQL, PHP) stack to function properly. Make sure Apache, MySQL, and PHP are installed and configured on your server.

Step-by-Step Guide to Installing Moodle on Ubuntu

Update Ubuntu

Before installing any new software, it's essential to update your Ubuntu system to ensure you have the latest security patches and updates.

sudo apt update && sudo apt upgrade -y

Install Apache

Apache is the web server software that will serve Moodle to your users. Install Apache using the following command:

sudo apt install apache2 -y

Install MySQL

Moodle requires a database to store its data. Install MySQL using the following command:

sudo apt install mysql-server -y

Install PHP

PHP is the scripting language that powers Moodle. Install PHP and required extensions using the following command:

sudo apt install php libapache2-mod-php php-mysql php-xml php-soap php-intl php-curl php-zip php-gd php-xmlrpc php-mbstring -y

Download Moodle

Download the latest version of Moodle from the official website or using the following command:

sudo wget

Extract Moodle

Extract the downloaded Moodle archive to the Apache web root directory:

sudo tar -zxvf moodle-latest.tgz -C /var/www/html/

Configure Apache

Configure Apache to serve Moodle by creating a new virtual host configuration file:

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

Add the following configuration:

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

    <Directory /var/www/html/moodle>
        Options FollowSymLinks
        AllowOverride All
        Require all granted

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

Enable the new virtual host and restart Apache:

sudo a2ensite moodle.conf 
sudo systemctl restart apache2

Create Moodle Database

Create a new MySQL database and user for Moodle:

sudo mysql -u root -p

CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'moodleuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL ON moodle.* TO 'moodleuser'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;

Configure Moodle

Open your web browser and navigate to your Moodle site (e.g., Follow the on-screen instructions to configure Moodle. When prompted, enter the database details created earlier.

Complete Installation via Web Interface

Follow the on-screen instructions to complete the Moodle installation. You'll need to provide some basic information about your site and create an admin account.

Troubleshooting Common Installation Issues

If you encounter any issues during the installation process, refer to the Moodle documentation or community forums for assistance. Common issues include database connection errors, file permission issues, and PHP configuration problems.


Installing Moodle on Ubuntu can provide educators and institutions with a powerful platform for creating online learning environments. By following the steps outlined in this guide, you can set up Moodle on your Ubuntu server and start delivering courses to your students.


Can Moodle run on other operating systems besides Ubuntu?

Yes, Moodle can run on various operating systems, including Windows and macOS, but the installation process may differ slightly.

Do I need a dedicated server to run Moodle?

While a dedicated server is recommended for larger installations, Moodle can run on a shared server or virtual private server (VPS) with sufficient resources.

Can I customize the look and feel of my Moodle site?

Yes, Moodle offers extensive customization options, allowing you to personalize the appearance and functionality of your site to meet your specific needs.

Is Moodle free to use?

Yes, Moodle is open-source software released under the GNU General Public License (GPL), which means it is free to download, install, and modify.

Where can I find additional plugins and resources for Moodle?

You can find a wide range of plugins, themes, and other resources for Moodle on the official Moodle plugins directory and community forums.

Leave a Comment


No comments yet. Why don’t you start the discussion?

Leave a Reply