How to Set Up Moodle on Ubuntu 22.04

How to Set Up Moodle on Ubuntu 22.04


What is Moodle?

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.

Set up Moodle on ubuntu 22.04

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)

Benefits of Using Moodle

Free and Open Source

Highly Customizable (Themes, Plugins)

Supports Blended and Distance Learning

Active Community and Long-Term Support

How to Install It on Ubuntu 22.04

            sudo apt update && sudo apt upgrade -y

  1. Install Apache

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:

  • VALIDATE PASSWORD PLUGIN: No (or Yes if you want)
  • Set root password
  • Remove anonymous users: Yes
  • Disallow root login remotely: Yes
  • Remove test database: Yes
  • Reload privilege tables: Yes
  • Install PHP and Required Extensions

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.

  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;

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

sudo mkdir /var/moodledata

sudo chown -R www-data:www-data /var/moodledata

sudo chmod -R 755 /var/moodledata

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

1   Open browser and go to:

      http:///

  •  You’ll see the Moodle web installer.

                      3      Choose:

                        Language

                        Web address: http://

                                   Moodle directory: /var/www/html

                        Data directory: /var/moodledata

4   Choose MySQL, enter database details:

  • Database: moodle
  • User: moodleuser
  • Password: StrongPassword@123

5   Follow the prompts and complete the setup.

Limited Time Offer: Get Up to 50% OFF on Dedicated Cloud Ubuntu Servers!

High performance, full control, and unbeatable prices.



Source link