Tuesday, March 19, 2024
HomeTutorialsHow to Install Moodle Learning Platform in Ubuntu Linux

How to Install Moodle Learning Platform in Ubuntu Linux

Modular Object-Oriented Dynamic Learning Platform, or in short, Moodle is one of the best online learning platforms for all levels of students. Graduate and undergraduate students can use the Moodle platform to continue their courses under the direct inspection of a course teacher. Typically, the teacher is the host of the Moodle learning platform. The teacher can assign courses, assignments, quiz exams through the Moodle tool. The teacher can schedule a whole educational calendar for the students and ask the students to enroll themselves in the courses by entering the course enrollment key. The teacher will provide the course enrollment key. Moodle learning platform is a cross-platform application so that you can use it on Ubuntu and other Linux distributions.

Moodle Learning Platform in Ubuntu Linux


Moodle is an open-source and cloud storage based learning tool runs by the PHP framework. In Ubuntu, you need to have the PHP framework and a SQL database installed in your system to run the Moodle learning platform. The Primary Features of Moodle are listed below:

  • Online Course Advising
  • Assigning Assignments
  • Video Presentation
  • Set a Deadline for Workshop
  • Evaluate Students by Performance
  • Teaching Evaluation
  • Moodle Browser Extension

In this post, I will guide you on how you can install the Moodle learning platform in Ubuntu Linux.

Step 1: Install PHP Framework for Moodle Learning Platform


First, install the PHP framework on your Ubuntu system. Before installing the PHP framework, make sure that you don’t have the PHP framework installed previously. To check whether the PHP framework is installed or not, you can run a PHP version check from your Ubuntu shell command.

php -v

Now install the PHP framework inside your Ubuntu machine.

apt-get update && apt-get upgrade
sudo apt-get install php libapache2-mod-php

Now restart the Apache service to get the full advantages of the PHP framework.

sudo systemctl restart apache2

After the PHP installation is finished, you can run a version check command to make sure that you have installed the PHP framework correctly. 

php version moodle learning platform for ubuntu

Step 2: Install an SQL Database for Moodle


As the Moodle learning platform requires to have an SQL database to maintain the server and users, we can choose any suitable for database for Ubuntu. You can use either the Mysql or the MariaDB. In this case, I am going to choose the MySQL database.

Be mindful that you will need the sound knowledge of SQL to operate and maintain the database engine no matter which database you choose. If you are a PostgreSQL fan, you can go ahead with the pgAdmin. You can use the following terminal commands to install the MySQL database server inside your Ubuntu machine.

sudo apt-get update
sudo apt-get install mysql-server

After the installation of the MySQL server is done, perform a version check to verify that the SQL server is installed correctly.

mysql –version

mysql version moodle learning platform for ubuntu

Step 3: Download and Install Moodle Learning Platform


Moodle learning platform is available for Ubuntu and other Linux distributions. You can download the compressed file of the Moodle application from its official website. After the download is finished, you would find the compressed file inside the Download folder.

download moodle learning platform for ubuntu

Now extract the compressed file. You can use any decompression tool to unzip the file. Then copy the Moodle file folder and paste it in the /var/www directory. If you find any access directory issue, that is because you don’t have the root user permission. You can resolve that problem by running the following terminal command in your Ubuntu shell.

sudo chmod -R 777 /var/www/html/

Now open your web browser and type the following address in the address bar and hit the enter button, which will lead you to the installation page of the Moodle e-learning webpage.

localhost/moodle/install.php

moodle learning platform open in browser

Step 4: Set Up the Localhost for Moodle


After the Moodle setup webpage is opened, it is time to do a little configuration of the web address, moodle directory, and database. Make sure that your configurations are exactly the same as given below.

Web address: https://localhost.moodle 
Moodle directory: var/www/html/moodle
Data directory: var/www/moodledata

There is a chance that you might get a parent directory permission error. To avoid that error, you can run the following command line in your terminal command shell.

sudo chmod 777 /var/www/

Now hit the Next button and go to the next setup page. On this page, you will be asked to choose your database engine. As I have installed the MySQL database server, so I will continue with the native MySQL settings.

Step 5: Create a Database for Moodle


Now you have to create a database for Moodle. First, log in to your database engine. To login to your account, use the following terminal command-line. Then assign a new password of your database engine.

$ sudo mysql -u root -p

To create a database for Moodle, you need to open the terminal command shell and type the following line given below. That will open the SQL command line.

sudo mysql

Now, to create a database, use the following SQL command given below. You can give the database name as you wish.

mysql> create database my_moodle

create database for moodle

You can view all the databases of your MySQL server by using the following SQL command given below.

mysql> show databases;

show databases

Now before you click on the Next button, you need to install an SQL extension package for the PHP framework. Run the following terminal command to run the MySQL extension tool for PHP.

sudo apt-get install php-mysql

You can check whether the MySQL extension package is installed or not by performing the following terminal command.

php -m

Now restart the Apache server and hit the Next button to continue the setup.

sudo service apache2 restart

Then fill up the database hostname, database name, database username, database password, table prefix, database port, and the Unix socket to continue the setup. You can keep the database port empty if the default port doesn’t work for your localhost. Don’t forget to make a note of your database username and password. You will need that information later to log in to your account.

moodle learning platform for ubuntu database setup

Now, make a note that sometimes you may fail to load to the next setup page due to the PHP configuration script. If something goes wrong and you can’t find the error, you need to check the config.php file. Make sure that you have granted root access to your database and the PHP configurations are all correct. Normally you can find the PHP configuration file in the /var/www/html/moodle directory.

Step 6: Set-Up Moodle in Ubuntu Linux


At this stage, we have already configured the PHP framework, database server, and the moodle directory. We are just a few clicks behind the e-learning platform of Moodle. Now, in this step, we will need to install the XML PHP extension to continue the Moodle setup. Use the following terminal command below to install the PHP XML extension. Then restart the Apache server.

sudo apt-get install php-xml

Now, we are on the installation page of the Moodle learning environment. You will see Moodle’s copyright notice, confirm the terms and conditions, and click on the Continue button.

moodle confirm page on ubuntu

On the next page, you will see some server checking status. You will see that some PHP extension packages are failed to load or not installed. Now you need to install a few PHP extension packages. Use the following terminal command lines given below to install those PHP extension packages in your Ubuntu machine.

If you have done everything correctly, you will be able to see the OK status in every report. Then restart the Apache server, reload the setup page and continue.

sudo apt-get install php-curl
sudo apt-get install php-zip php-gd php-intl php-mbstring php-xmlrpc php-soap

moodle ok status in ubuntu

At the next page, you will see all the installation status. You will be able to see the system status, antivirus status, availability status, block setting status, block section status, and some other system statuses on this page. This page may take a little long time to finish the system checking. Click on the continue button when the page is loaded.

moodle success message in ubuntu

On the next page, you will be asked to set a username, password, email address, city, county details to finalize your moodle setup. Then you will be transferred to the next page where you have to put the full name of your site. You can also write a short description of your site in the summary section. Now, save all the changes and go to the dashboard of your Moodle learning platform in your Ubuntu.

moodle dashboard

Extra Tip: Use Bitnami LAMP Stack


If you find that the installation process of MySQL and PHP framework is complicated for you, you can continue the process of installing Moodle with the LAMP stack package instead. You will get all the PHP framework, database server, and Apache server installed inside the LAMP stack program. But be careful, you need to have a piece of sound knowledge on phpMyAdmin. You can download the Bitnami LAMP stack from here for Ubuntu.

Final Words


Typically Moodle is maintained by the college or university authority. The IT section of the institute runs the Moodle learning platform and add it with their website. Later, they handover the dashboard panel to the teacher so that they can customize and add rules in the Moodle platform. No matter how the Moodle is maintained, the features and quality will be the same.

Nowadays, many reputed universities are continuing their online classes through the Moodle learning platform. In this post, I have described how you can install and configure the Moodle learning platform in your Ubuntu machine. If you think this post was helpful and informative, please share it with your friend and community. You can write your opinions in the comment segment below.

Mehedi Hasan
Mehedi Hasan
Mehedi Hasan is a passionate enthusiast for technology. He admires all things tech and loves to help others understand the fundamentals of Linux, servers, networking, and computer security in an understandable way without overwhelming beginners. His articles are carefully crafted with this goal in mind - making complex topics more accessible.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

You May Like It!

Trending Now