+3 votes
1.3k views
How to install Moodle on Ubuntu Server 20.04

in Linux / Unix by (552k points)
reopened | 1.3k views

1 Answer

+4 votes
Best answer

1. How to install PHP Ubuntu Server 20.04 extensions
2. How to install Nginx Ubuntu Server 20.04
3. How to install MariaDB Ubuntu Server 20.04
4. Installation of PHP Ubuntu Server 20.04
5. How to create a database for Moodle Ubuntu Server 20.04 and download repositories
5. Nginx configuration for Moodle Ubuntu Server 20.04 application
6. How to finish the installation of Moodle Ubuntu Server 20.04
7. HTTPS configuration in Moodle Ubuntu Server 20.04

Online learning has taken a much greater boom in this time where global circumstances have had an impact on the meeting of people and therefore it is vital to have platforms that adapt to these needs, offering unique but safe and highly recurrent functionalities..

 

In this scenario, Moodle has become the online learning management platform (e-learning), which is open source under the GNU General Public License, more functional and dynamic and Moodle is available both for web environments and mobile devices.

 

 

Moodle aims to provide its users with a platform where there is a robust and secure integrated system allowing each object created and managed to be as recursive as possible.
Moodle gives us a simple interface which integrates drag and drop features and we find it available in more than 120 languages..

 

Use Moodle
We can use Moodle in two essential scenarios which are:
  • Blended learning
  • Online courses

 

Regardless of the scenario used, with Moodle you can enable or not the kernel features and adjust its modular configuration so that the work is as complete as possible.

 

characteristics
Some of the most relevant features of Moodle are:
  • Custom dashboard where we can access current, past or future courses, as well as review pending work
  • Accessible user interface
  • Integrate collaborative activities and tools such as forums, wikis, glossaries, database activities and more
  • Simple and intuitive text editor that allows editing the elements integrated in Moodle
  • Add an all-in-one calendar
  • Allows you to upload files to the cloud with services such as OneDrive, Dropbox and Google Drive
  • Offers activity progress monitoring
  • Generate notifications about new events
  • Secure authentication and secure bulk enrollments
  • It is compatible with open standards such as IMS-LTI or SCORM
  • We can mass create courses if necessary
  • Constant security updates

 

Let's see how to install Moodle on Ubuntu Server 20.04..

 

 


1. How to install PHP Ubuntu Server 20.04 extensions

 

Step 1

We update the system with the following command:
 sudo apt update 
image

 

Step 2

After this we are going to install the PHP extensions and libraries that are necessary for Moodle to work as expected, we will do this with the apt package manager like this:
 sudo apt install php-common php-iconv php-curl php-mbstring php-xmlrpc php-soap php-zip php-gd php-xml php-intl php-json libpcre3 libpcre3-dev graphviz aspell ghostscript clamav 
image

 

We enter the letter S to confirm the download and installation of these packages.

 

LEMP installation on Ubuntu Server 20.04
LEMP (Linux, Nginx (EngineX), MariaDB and PHP), is a set of utilities with which we can implement web applications, we must install this stack before installing and configuring Moodle.

 


2. How to install Nginx Ubuntu Server 20.04

 

Step 1

To install Nginx we execute:
 sudo apt install nginx 
image

 

Step 2

We accept the download and installation of the packages, at the end we will see the following:

 

image

 

The Nginx configuration files are stored in the / etc / nginx directory and the main configuration file is /etc/nginx/nginx.conf.

 

Step 3

We check the status of Nginx:
 sudo systemctl status nginx 
image

 

Step 4

We enable Nginx at Ubuntu Server startup:
 sudo systemctl is-enabled nginx 
image

 

Step 5

From a browser we can go to the server's IP address and validate that Nginx has been installed:

 

image

 


3. How to install MariaDB Ubuntu Server 20.04

 

Step 1

MariaDB offers us a relational database administration system, for its installation we execute the following command:
 sudo apt install mariadb-server mariadb-client 
image

 

Step 2

We accept the download and installation:

 

image

 

Step 3

We validate the current state of MariaDB:
 sudo systemctl status mariadb 
image

 

Step 4

We enable MariaDB with the server startup:

 

image

 

Step 5

Now we must ensure the installation of MariaDB, for this we execute:
 sudo mysql_secure_installation 
In the first section we can

 

 

image

 

Step 6

Then we answer the following:
  • Remove anonymous users? [Y / n] and
  • Disallow root login remotely? [Y / n] and
  • Remove test database and access to it? [Y / n] and
  • Reload privilege tables now? [Y / n] and

 

 

image

 


4. Installation of PHP Ubuntu Server 20.04

 

Step 1

PHP is a dynamic, flexible and open source programming language with which it will be possible to create websites and web applications, its installation is carried out with the following command:
 sudo apt install php php-mysql php-fpm 
image

 

Step 2

We enter the letter S to complete the process, then we check the status of PHP:

 

image

 

Step 3

We enable it at Ubuntu boot with the command:
 sudo systemctl is-enabled php7.4-fpm 

5. How to create a database for Moodle Ubuntu Server 20.04 and download repositories

 

Step 1

We are going to create the database to administer Moodle, for this we access MySQL with the following command:
 sudo mysql 
There we are going to execute the following lines:
 CREATE DATABASE moodle; GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, CREATE TEMPORARY TABLES, DROP, INDEX, ALTER ON moodle. * TO 'moodleadmin' @ 'localhost' IDENTIFIED BY 'password'; FLUSH PRIVILEGES; quit; 
image

 

Step 2

Downloading the Moodle Ubuntu Server 20.04 repositories
We are going to download the latest version of Moodle with the following command:
 wget -c https://download.moodle.org/download.php/direct/stable39/moodle-latest-39.tgz 
image

 

Step 3

We extract the content of the compressed file to the / var / www / html directory:
 sudo tar -zvxf moodle-latest-39.tgz -C / var / www / html / 
image

 

Step 4

We list the content that has been extracted:
 ls / var / www / html / 
image

 

Step 5

We are going to grant the required permissions for the use of Moodle:
 sudo chown www-data: www-data -R / var / www / html / moodle sudo chmod 775 -R / var / www / html / moodle 
image

 

Step 6

The next step will be to create the Moodle data directory, there Moodle will save the uploaded files:
 sudo mkdir -p / var / moodledata 
We grant the permissions:
 sudo chmod 775 -R / var / moodledata sudo chown www-data: www-data -R / var / moodledata 
image

 

Step 7

We are going to edit the Moodle configuration file, for this we execute the following commands:
 cd / var / www / html / moodle / sudo cp config-dist.php config.php sudo nano config.php 
image

 

Step 8

In the file we are going to locate the following lines:
 $ CFG-> dbtype $ CFG-> dblibrary $ CFG-> dbhost $ CFG-> dbname $ CFG-> dbuser $ CFG-> dbpass $ CFG-> prefix 
image

 

Step 9

There we replace the values ​​with the ones we registered in the created database:

 

image

 

Step 10

A little further down we will edit the following lines:
 $ CFG-> wwwroot = 'http: // computer_name'; $ CFG-> dataroot = '/ var / moodledata'; 
image

 

We save the changes with the Ctrl + O keys and exit the editor with Ctrl + X.

 


5. Nginx configuration for Moodle Ubuntu Server 20.04 application

 

Step 1

In order for NGINX to support the Moodle site, we must create a new server block configuration in the /etc/nginx/conf.d/ directory, we enter:
 sudo nano /etc/nginx/conf.d/moodle.conf 
There we enter the following information with the domain name:
 server { listen 80; server_name "Team"; root / var / www / html / moodle; index index.php; location / { try_files $ uri $ uri / /index.php?$query_string; } location ~ ^ (. + \. php) (. *) $ { fastcgi_split_path_info ^ (. + \. php) (. *) $; fastcgi_index index.php; fastcgi_pass unix: /run/php/php7.4-fpm.sock; include /etc/nginx/mime.types; include fastcgi_params; fastcgi_param PATH_INFO $ fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name; } } 
image

 

Step 2

We save the changes and after that we validate that the Nginx configuration is correct and we restart the service:
 sudo nginx -t sudo systemctl reload nginx 
image

 


6. How to finish the installation of Moodle Ubuntu Server 20.04

 

Step 1

To do this we go to a browser and enter the following:
 http: // "team" 
In the first instance the following will be displayed:

 

 

image

 

Step 2

There a brief introduction to Moodle is given, we click on "Continue" to advance, then we will see if the server meets the installation requirements:

 

image

 

Step 3

At the bottom we will click on "Continue" if everything is OK, then the system will be installed and we will see a summary of each installed add-on:

 

image

 

Step 4

At the end we will see this:

 

image

 

Step 5

Click on Continue and then we define:
  • Administrator user name and password
  • Email to use for notifications
  • Current city and region

 

 

image

 

Step 6

At the bottom we will click on "Update profile" to apply the changes:

 

image

 

Step 7

Then we access the following window where we enter the name of the site and a description if we wish:

 

image

 

Step 8

We click on Finish and we will access Moodle in Ubuntu Server 20.04:

 

image

 


7. HTTPS configuration in Moodle Ubuntu Server 20.04

 

Step 1

This is an additional security method to use in Moodle so it is optional, to carry out this action we will execute the following:
 sudo snap install --classic certbot 
image

 

Step 2

At the end of this process we will see the following:

 

image

 

Step 3

Next, we are going to generate a certificate for Certbot to edit the NGINX configuration:
 sudo certbot –nginx 
We enter an email for notifications:

 

 

image

 

Step 4

Then the process will be completed:

 

image

 

Step 5

Now we access the Moodle configuration file:
 sudo nano /var/www/html/moodle/config.php There we go to the CFG-> wwwroot line and set HTTPS: CFG-> wwwroot = 'https://learning.testprojects.me'; 
image

 

We save the changes and exit the editor and with it now the navigation in Moodle will be safe.
In Moodle we can access its various options such as:

 

Calendars:

 

image

 

Private files:

 

image

 

 

Site administration:

 

image

 

Moodle undoubtedly integrates the necessary functions to create optimal learning sites full of key features for each type of user.

 


by (3.5m points)

Related questions

+4 votes
1 answer
asked Nov 12, 2020 in Linux / Unix by backtothefuture (552k points) | 398 views
+4 votes
1 answer
asked Sep 29, 2020 in Linux / Unix by backtothefuture (552k points) | 1.4k views
+4 votes
1 answer
asked Apr 29, 2020 in Linux / Unix by backtothefuture (552k points) | 347 views
+3 votes
1 answer
asked Mar 13, 2020 in Linux / Unix by backtothefuture (552k points) | 2.3k views
+3 votes
1 answer
asked Sep 28, 2020 in Linux / Unix by backtothefuture (552k points) | 506 views
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users