News
Seven days of Black Friday madness — great deal from Serverspace!
Serverspace Black Friday
BM
September 19, 2022
Updated July 7, 2023

Installing Moodle on an Ubuntu 20.04 server

Linux Ubuntu VPS

What is Moodle ?

Moodle is a learning management system.

Essentially, it's an easy way for schools and teachers to give students marks, check their own work and keep track of their grades.

And it's all online. If you've ever worked with something like an online whiteboard or taken part in a course, then you know what we're talking about.

Why moodle? First of all for our demonstration purposes it was perfect, it has all the features we were looking for and at the end of the day, the license for moodle is free up to a certain number of users. The limit is on having more than 5,000 users connected to your moodle, so if you have fewer people then you are not required to pay for a license.

Extensive communication is one of the strengths of moodle:

  • The system supports the exchange of files in different formats.
  • The newsletter service allows all course participants or individual groups to be informed promptly about current events.
  • Course users can also communicate with one another by email, forum, chat, messaging, and webinar.
  • A large selection of blocks (calendar, latest news, upcoming events etc. ) expand the functionality and usability of the system.

Additional function modules can be installed as needed. Moodle can be used for:

  • Distance learning, where the teacher and learner do not meet in person most of the time;
  • Distance support for face-to-face education, where the student can receive and submit assignments via moodle;
  • Support for face-to-face education, allowing individual practical assignments, tests in moodle to be completed during face-to-face classes.

Preparing the system to install and configure moodle:

In order for moodle to work, you will need to install apache web server,

this step will be skipped as we use an out-of-the-box solution when we set up the server. On our website we have instructions on how to install and configure apache.

On serverspace you can create a server with apache already installed.

Because apache was installed during the creation of the server, we can access our ip address in the webstring and we will see this message that apache is up and running.

Message of availability

Update our machine using the commands below:

sudo apt-get update && sudo apt-get upgrade

System update

It is required to install mysql client and server library, also don't forget php library to communicate with apache.

sudo apt install apache2 mysql-client mysql-server php7.4 libapache2-mod-php

After this, additional software will need to be installed.
This will take longer because you need to install the multi-layered compatibility of the php, mysql,
prerequisite libraries to make them work together.

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 git -y

Installing additional software

Do not forget to restart the apache web server:

sudo service apache2 restart

To check the status of the web server, type the command below:

sudo systemctl status apache2

Go to the "opt" directory and clone what we need:

cd opt

Navigating to the opt directory

Cloning data to our server:

sudo git clone git://git.moodle.org/moodle.git

Once installed, navigate to the folder where we will download the desired files.(When we're done, we will simply move the folder to the directory we want)

Navigating to the moodle directory:

cd moodle

List available branches, if needed:

sudo get branch -a

Available branches

After that, select a particular branch and install it:

sudo git branch --track MOODLE_39_STABLE origin/MOODLE_39_STABLE

Selecting a branch

Check the installed version of Moodle on our server:

sudo git checkout MOODLE_39_STABLE

moodle 8

Copy the directory where we downloaded all the data (in our case /opt/moodle, to the apache directory.

Example command:

sudo cp -R /opt/moodle /var/www/html/

Copying the catalogue

Let's create a folder where the moodle data will be stored:

sudo mkdir /var/moodledata

Do not forget to give it certain permissions:

sudo chown -R www-data /var/moodledata
sudo chmod -R 777 /var/moodledata
chmod ugoa=rwx /var/moodledata
sudo chmod -R 0755 /var/www/html/moodle

Licence issue

This folder will store lesson documents, not configuration files!

Preparing the Database:

The following configuration is only for those with MySQL version below 8.0, you can check the MySQL version with the command:

mysql --version

Configure the MySQL configuration file

Fore configure config you could use any text editor as you like, in our case it will be "nano".

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

Open the configuration file

It's required to add 3 lines of code at the end of the configuration file,
see how it's implemented in our case:

default_storage_engine = innodb
innodb_file_per_table = 1
innodb_file_format = Barracuda

moodle 12

Save the configuration file and restart the database.

Creating a database

The command below we connects to mysql:

mysql -u root -p

Connecting to a database

Turn on support for 4 byte UTF 8:

CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Turning on UTF 8 support

Create a user for the database:

create user serverspace@'localhost' IDENTIFIED BY 'P@ssw0rd';

Grant full rights for our user:

GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO serverspace @'localhost';

Granting rights to a user

Exit MySQL:

quit

Exiting the database

Grant access rights to the "moodle" folder:

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

moodle 17

Restart your server:

systemctl restart apache2

moodle 18

Completing the installation, setting up Moodle

After restarting, further configuration can be done from within the web interface:

If you have done everything correctly,
open your browser and type the ip address of your server into the web interface,
after it add the following " x.x.x.x/moodle/install.php".
You should get a window like this:

Web interface window

Then follow the instructions on the screen and set it up the way you want it!
Don't forget to change the path to your data folder:

Configuration via the web interface

In the following screenshot, specify the login and password for your created database.

Next you will need to wait for the installation to complete.

After the correct installation you will have the admin panel open.

Admin panel

Conclusion

This publication will make it easy for you to install moodle and get it up and running for your own needs.

Do not be afraid to check out the moodle tutorial, you will find many unique information on how to fine tune your moodle service.

Vote:
3 out of 5
Аverage rating : 3.1
Rated by: 7
1101 CT Amsterdam The Netherlands, Herikerbergweg 292
+31 20 262-58-98
700 300
ITGLOBAL.COM NL
700 300
We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.