How to install Moodle in Ubuntu?

How to install Moodle in Ubuntu?

Moodle – Software can be installed in all types of operating systems. No restrictions are used for the installation of Moodle in the current trend! You might know about a few programs like Softaculous and Fantastico which installs Moodle by using GUI (Graphical User Interface). But, in many cases, users would love to install it manually in the operating system. Here for the installation, we are going to use the command-line interface SSH for completion. Most of them would say only experts can use the SSH command line for installation but let’s see the luck over here!


In this article, we can cover topics like Moodle installation and the pre-flight checklist:

Pre-flight checklist:

Step 1:
You can start to install the Moodle but make sure whether you have Apache webserver software first. If not, kindly install it without fail. Next, start installing the PHP requisite version of MySQL database server.

Step 2: Use the below command for installing the Moodle modules:

sudo apt install graphviz aspell ghostscript clamav php7.4-pspell php7.4-curl php7.4-gd php7.4-intl php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-ldap php7.4-zip php7.4-soap php7.4-mbstring
Step 3: Don’t forget to do Apache restart after installing the modules one by one:

sudo service apache2 restart
Step 4: Now, it’s time to get access to repository git so, do the installation for git in this step. Git installation should be made after the restart of Apache.

sudo apt install git
Step 5: Cross-check the installation of git and then use command cd for changing the directory as opt folder:

cd /opt
Moodle installation:

Step 1:
In opt folder; use the command “git” for downloading the Moodle.

sudo git clone git://
Step 2: Previously, you have changed the directory into opt folder. Here, again you need to change the directory folder to “moodle”

cd moodle
Don’t forget to use the command “cd”.

Step 3: You must know the availability of the git branch right! Then execute the below command to cross-check the availability:

sudo git branch –a
Step 4: Now, instruct allotting in which branch of git Moodle should be installed:

sudo git branch --track MOODLE_39_STABLE origin/MOODLE_39_STABLE
Step 5: Check out the Moodle version using the below-mentioned command:

sudo git checkout MOODLE_39_STABLE
Step 6: Go to MySQL and start creating the database. Execute the below command after creating the database so that, you can copy the entire content of Moodle to the root folder of the website.

cp -R /opt/moodle /var/www/html
Step 7: Use the command “mkdir” for creating the folder moodledata into folder of var:

mkdir /var/moodledata
Step 8: Start giving the update of ownership in this step:

sudo chown -R www-data /var/moodledata
Step 9: Again, use the command “chmod” for updating moodledata and moodle permission.

sudo chmod -R 777 /var/moodledata
sudo chmod -R 0755 /var/www/html/moodle
Step 10: Don’t start the installer now! You can give authorization for Moodle first. Then, you can start the installer in the next step:

sudo chmod -R 777 /var/www/html/moodle
Step 11: Go to the web browser, tap on the domain name which is in the format like domain name/moodle. It will ask you to update the language settings based on your requirement. Give details like document root(/var/www/html/moodle) and web address.

Step 12: You need to update the data directory and database driver as per the instruction of the installer. Go to step 6 and enter database information without fail.

Step 13: You will be notified of the terms and conditions. Read it thoroughly and accept it by pressing the button “Continue”. For the dashboard of Moodle, you can create an administrator account for other works.

Step 14: Use the below-mentioned command for default access by reverting the permission of the root directory:

sudo chmod -R 0755 /var/www/html/moodle
Hereby, we have explained more about Moodle installation. So, the turn is yours now!
First release
Last update
0.00 star(s) 0 ratings

More resources from kumkumsharma