If you’re planning to set up Moodle on Ubuntu 22.04 for your educational institution or business, follow this detailed installation guide.
Moodle stands for Modular Object-Oriented Dynamic Learning Environment.
It is a free, open-source Learning Management System (LMS) used to create online courses and websites for e-learning, training, and education.
Key Features of Moodle:
Course Management – Create and manage online courses, assignments, and quizzes
User Roles – Multiple roles like Admin, Teacher, Student, Guest
Content Delivery – Share videos, documents, links, and presentations
Assessment Tools – Online quizzes, gradebook, feedback, and assignments
Communication – Forums, messaging, and announcements
Reports & Analytics – Student progress tracking and reports
Security – User authentication, backups, and permissions
Mobile-Friendly – Comes with Moodle Mobile App for learning on the go
Technical Overview:
Programming Language: PHP
Database: MySQL / MariaDB / PostgreSQL / MSSQL / Oracle
Web Server: Apache / Nginx
Platform: Cross-platform (Linux, Windows, macOS)
Who Uses Moodle?
Schools and Colleges
Universities
Training Organizations
Corporate Training Departments
Government & NGOs
Access and Use
Self-hosted: You install and manage Moodle on your own server (e.g., Ubuntu, Windows Server)
MoodleCloud: Hosted Moodle instance by Moodle.org (paid/free limited plans)
Free and Open Source
Highly Customizable (Themes, Plugins)
Supports Blended and Distance Learning
Active Community and Long-Term Support
Step 1: Update System
sudo apt update && sudo apt upgrade -y
Step 2: Install Required Packages (LAMP Stack)
sudo apt install apache2 -y
sudo apt install mysql-server -y
Secure MySQL (Set root password and remove insecure defaults):
sudo mysql_secure_installation
Choose:
sudo apt install php php-cli php-curl php-gd php-mbstring php-mysql php-xml php-xmlrpc php-zip php-soap php-intl php-bcmath php-opcache libapache2-mod-php -y
Moodle recommends PHP 8.0 or 8.1. Ubuntu 22.04 includes PHP 8.1 by default.
Step 3: Create Moodle Database
Log into MySQL:
sudo mysql
Run these commands inside MySQL:
CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER ‘moodleuser’@’localhost’ IDENTIFIED BY ‘StrongPassword@123’;
GRANT ALL PRIVILEGES ON moodle.* TO ‘moodleuser’@’localhost’;
FLUSH PRIVILEGES;
EXIT;
Step 4: Download Moodle
Go to /var/www/html
cd /var/www/html
sudo rm index.html
2. Download Moodle latest version
sudo apt install git -y
sudo git clone
sudo mv moodle/* .
3. Set Permissions
sudo chown -R www-data:www-data /var/www/html
sudo chmod -R 755 /var/www/html
Step 5: Create Moodle Data Directory
sudo mkdir /var/moodledata
sudo chown -R www-data:www-data /var/moodledata
sudo chmod -R 755 /var/moodledata
Step 6: Configure Apache
Create a virtual host file:
sudo nano /etc/apache2/sites-available/moodle.conf
Paste the following:
ServerAdmin admin@example.com
DocumentRoot /var/www/html
ServerName example.com
Options FollowSymLinks
AllowOverride All
Require all granted
ErrorLog ${APACHE_LOG_DIR}/moodle_error.log
CustomLog ${APACHE_LOG_DIR}/moodle_access.log combined
Enable site and rewrite module:
sudo a2ensite moodle.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
Step 7: Finalize Moodle Installation in Web Browser
1 Open browser and go to:
http://
3 Choose:
Language
Web address: http://
Moodle directory: /var/www/html
Data directory: /var/moodledata
4 Choose MySQL, enter database details:
5 Follow the prompts and complete the setup.