Software Tech

Host your E-Learning platform with Moodle

If you like this article, we would appreciate a comment and a like! ❤️ In this guide we will

Host your E-Learning platform with Moodle

If like this article, we would appreciate a comment and a like! ❤️

In this guide we will show you today how to install the learning platform Moodle.

It's best if we start right !

Don't you like to do this installation or don't have the possibility? Then register on our website, here you also have the to create your own courses for free.
We would be pleased!

We switch to the terminal, and then with


in our data .

Here we also download the latest Moodle files

sudo wget

In our case, this ZIP file is now called “” and we unpack it

sudo unzip

And we've already unzipped the folder. If you want, we can or rename the folder, we'll take care of everything

mv foldername folderpath

We rename the folder that has now been extracted (moodle-master) to “moodle”.

We'll do that

sudo mv moodle-master/ moodle/

Then we still have to adjust the permissions, we'll do that with you

sudo chown -R root moodle/
sudo chmod -R 0755 moodle/

Now we have to create our database.

We'll do that

sudo mysql
CREATE DATABASE database-name;
CREATE ‘username'@'localhost' IDENTIFIED BY ‘password';
GRANT ALL PRIVILEGES ON dbname.* TO ‘username'@'localhost';

You can define the username, database name and password as you – but we will need the data again later!

When we have done that, we can already call the IP address/moodle and we have arrived at our web installer!

Optionally, we can now specify a domain.

For this we create

sudo nano /etc/apache2/sites-available/moodle.conf

a new file.

The content can look something like this:

VirtualHost *:80>
DocumentRoot /var/www/moodle/
Server name
Server alias www.learn.schä
Alias /moodle “/var/www/moodle/”
Directory /var/www/moodle/>
Require all granted
IfModule mod_dav.c>
dav off
SetEnv /var/www/moodle
SetEnv HTTP_HOME /var/www/moodle
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} [OR]
RewriteCond %{SERVER_NAME} =www.learn.schä
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

We activate the page with,

sudo a2ensite moodle.conf

adjust the privileges again:

sudo chown -R www-data:www-data /var/www/moodle/
sudo chmod -R 755 /var/www/moodle/

and restart our :

sudo service apache2 restart
sudo systemctl restart apache2.service

Now all we need is a Let's Encrypt SSL certificate to keep our website secure.

For that we run this code:

sudo certbot –apache

Here we have to choose our domain with the number and it's done!

Now we can really start installing Moodle on the web.

Note here that you the web installer via the IP address!

First we choose our language

Then we need to confirm our paths.

You can either create the data directory yourself (it is not safe in the specified folder) or we can create the directory ourselves

sudo mkdir /var/moodledata/
sudo chmod 0777 /var/moodledata/

Then we have that too.

We let that as it is.

Here you have to enter the password and username from the database. You can leave the last two fields empty.

Now we have to confirm the conditions.

And then everything is checked again:

If the PHP extension is missing, you can usually use it with

sudo apt install php-EXTENSIONNAME

to install.

But the red bug is worse; to do this we need to edit the config.php file. We'll do that

sudo nano config.php

And here we change the line

$CFG->dbtype = ‘mysqli';


$CFG->dbtype = ‘mariadb';


At the bottom is the error because of the max_input_vars.

We can remove it by adding in the file with

sudo nano /etc/php/8.1/apache2/php.ini

open and the line

;max_input_vars = 1000


max_input_vars = 5000



Then we start the server and PHP

sudo service apache2 reset


If this error comes up, you have to wait a few minutes or start the installation again.

You can also simply try to check the permissions again.

(almost 6 hours later when we finally solved the problem)

Here we see that everything is finally ready.

Then we go to “next”

and general – it doesn't matter how you configure them!

Last but not least, we specify the name of the website and other settings.

Thanks for reading,

About Author

Benedikt Schächner

Leave a Reply

SOFAIO BLOG We would like to show you notifications for the latest news and updates.
Allow Notifications