Do you want to install Moodle on Ubuntu and initiate your online education portal?
Don't you know the commands and steps to install Moodle on Ubuntu?
Since Ubuntu uses the command line interface, It will be difficult for you to remember the steps and commands all the time.
Don't worry about that.
Here in this Tutorial, I am going to show you how to install Moodle on Ubuntu 16.04.
Not only that But also I am going to show you the following things in this moodle step by step tutorial.
- How to configure the database for Moodle
- How to Configure Moodle in the Browser
- How to Customise the Moodle
- How to Create the First Course
For those who are not much aware of Moodle, Here is a short note about it.
Moodle is an open source web based application which is used for online learning.
It connects the instructors and the students with each other. The instructor can create courses and provide it to the students.
Here, the instructor creates courses, readings, and group discussions with their students.
You can manage user roles in the Moodle. So that, the student and instructors will have the different level of access to the contents.
After the installation of Moodle on the web server, people with access to your site can participate in the browser-based learning platform.
Here, I am going to show you the following.
How to set up noodles?
Install all the software requires for Moodle.
Going through the Setup wizard.
Choosing the theme.
Creating the first course on Moodle.
let us see the moodle user system requirements here.
You need to have the minimum of 160 MB to install Moodle and more memory for storing data.
It is recommended to have 1 GB of memory for Moodle to run properly.
In order to support more number of concurrent users, it requires more RAM.
For every 10 to 20 concurrent users, Moodle requires 1GB of additional RAM.
The non-root user with sudo privileges and firewall.
Follow this guide to setup the Ubuntu Server 16.04.
- You should have LAMP stack installed(Apache MySQL and PHP) on your server.
Note the MySQL root password you set. Follow the Moodle installation steps.
Moodle installation ubuntu
Let us see the Moodle installation process.
Moodle is a PHP application and it requires some of the PHP libraries to run.
Moodle also requires some more software such as spell checking the library and graphing library.
We are going to set up moodle from scratch. So, let us install those requirements by the Moodle before we install the Moodle.
First, update the existing packages and ensure that they are up to date.
$ sudo apt-get update
After that install the Moodle Dependencies
$ sudo apt-get install aspell graphviz php7.0-curl php7.0-gd php7.0-intl php7.0-ldap php7.0-mysql php7.0-pspell php7.0-xml php7.0-xmlrpc php7.0-zip
Now you have to restart the Apache web server to make the changes work.
$ sudo systemctl restart apache2
You can download the Moodle and install Moodle.
Here we will use curl to download the moodle package from the official site.
Here is the command to download the standard moodle packages from the official site. You can also look for the moodle latest version.
$ curl -L https://download.moodle.org/download.php/direct/stable32/moodle-latest-32.tgz > moodle.tgz
Here the -L tells the curl to follow the redirects.
moodle.tgz contains the current and stable of Moodle.
The file is in a compressed format. Now your task is to uncompress and extract the files.
After that, you have to place the files in web document root.
Here is the command for that.
$ sudo tar -xvzf moodle.tgz -C /var/www/html
Now you have to verify that you have placed the files at web directory.
Check it using ls command which will display the directory.
$ ls /var/www/html
The output should look like this
Output index.html moodle
Let us go in-depth and look at the directories inside the moodle directory.
$ ls /var/www/html/moodle
Execute the above command and the output will list the uncompressed directories.
Output admin composer.json grade message README.txt auth composer.lock group mnet report availability config-dist.php Gruntfile.js mod repository backup config.php help_ajax.php my rss badges CONTRIBUTING.txt help.php notes search behat.yml.dist COPYING.txt index.php npm- shrinkwrap.json tag blocks course install package.json tags.txt blog dataformat install.php phpunit.xml.dist theme brokenfile.php draftfile.php INSTALL.txt pix TRADEMARK.txt cache enrol iplookup plagiarism user calendar error lang pluginfile.php userpix cohort file.php lib portfolio version.php comment files local PULL_REQUEST_TEMPLATE.txt webservice competency filter login question completion githash.php media rating
After all, you have to create a directory away from the moodle root. It will store data on the server and does not store data in the database.
All the course related data will be stored here.
Here it is secure to create a directory outside of the webroot. So that, they cannot be directly accessed from the browser.
Use the below command:
$ sudo mkdir /var/moodledata
Here, you have to set up the ownership of the directory so that it can be accessed by the web service user www-data.
$ sudo chown -R www-data /var/moodledata
Now change the permissions of the directory and ensure that only the owner has full permission.
$ sudo chmod -R 0770 /var/moodledata
You have the Moodle on your server and now it's the time to set up the database that it will use.
Configure the Database
Here you have to do three tasks. That is
Create a MySQL database in which the moodle store most of its data.
Create the structure which the Moodle code expects.
Create the user which will be used by Moodle to access the database.
To work with Moodle, the MySQL should be compatible.
To do that, we are going to make some changes to the MySQL configuration.
First, open the MySQL configuration file.
$ sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
Here are the lines which you have to add to the basic settings area. The basic Settings configure the storage type for the new database.
mysqld configuration ... [mysqld] # # * Basic Settings # user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp lc-messages-dir = /usr/share/mysql skip-external-locking default_storage_engine = innodb innodb_file_per_table = 1 innodb_file_format = Barracuda ## Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. ...
Now, save the changes to the file and restart the MySQL Server to take effect of changes in the MySQL configuration.
$ sudo systemctl restart mysql
Let us create the MySQL database using the MySQL command line.
$ mysql -u root -p
Here, you have to give the MySQL root password which I have mentioned you to note earlier in this article.
Now you will be logged in and you can see the mysql> prompt.
Use the below command to create a database.
mysql> CREATE DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Now you have to create a Moodle user so that you do not need to tell the MySQL root password to the moodle.
== In the following two commands, you just have to use your Moodle username and Moodle password.==
mysql> create user 'moodler'@'localhost' IDENTIFIED BY 'moodlerpassword';
Now you have created the user. Your next is to give permission to the user.
Here is the command for that.
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO 'moodler'@'localhost' IDENTIFIED BY 'moodlerpassword';
That's all. Now you have to come out of the MySQL prompt. Use the below command to exit from MySQL prompt.
The database configuration is finished. Now you have to initiate the moodle in the browser and continue the remaining setup there.
Configuring Moodle in the browser.
To finalize the configuration, we have to bring up a site on the web browser and add some configuration details there.
The web server has to save those configurations.
For that, you have to change some permissions temporarily for the Moodle web root.
== When you change the permission, the access to the folder will be granted to everyone. if you don't like to do this, then don't change the permissions.==
The web interface has the instructions for you to manually change the configuration.
If you still change the permissions, make sure to undo it once you finished the configuration setup using the web interface.
We have included those steps in this article.
$ sudo chmod -R 777 /var/www/html/moodle
Open the browser and put http://server_ip/moodle in the address bar.
Now you will a page with installation setup.
Follow the below instructions to setup the configuration.
First set your language and click next
Change the data directory to /var/moodledata then click next.
Now, choose database driver page will open. here set the database driver to improved sql(native sql). Click next.
Here, The database settings page will open. Enter the Moodle username and password you created and left other fields as they are.
Go through the license agreement and agree with it by clicking continue button.
Look at the server check page and ensure that shows " your server environment meets all minimum requirements" at the bottom and click continue.
Now Moodle will install many components and show the status as a success. Scroll to the bottom and click continue.
You can see the administrator setup page for Moodle.
- Give the username as you like.
- Leave the choose authentication method as it is.
- Enter the new password.
- Enter your email
- Fill the remaining field with appropriate values.
- Click on Update Profiles.
9.Now at the Front Page Settings screen, you have to set the following,
- Full site name
- Short Name of the site
- Set location
- Mention whether you allow self-registration via email and Click on Save Changes.
After all, you will be brought to the dashboard of the Moodle Installation and you will be logged in as an admin user.
== All of your setup is complete now. So, you have to revert all the permissions. To do that execute the below command.==
$ sudo chmod -R 0755 /var/www/html/moodle
We have to make one more additional changes to the moodle permissions to improve the security.
Moodle creates the file at /var/moodledata folder with worldwide writeable permissions by default.
Now let us make changes to it.
Open the module configuration file using the command.
$ sudo nano /var/www/html/moodle/config.php
Find the below line.
config.php $CFG->directorypermissions = 0777;
Change them to this.
config.php $CFG->directorypermissions = 0770;
Save the file and exit.
Now, Reset the permission for the /var/moodledata directory where some of the files are already created by Moodle.
$ sudo chmod -R 0770 /var/moodledata
We have configured the moodle, the next step is to customize it further and create courses.
Customize the Moodle and Creating the First Course.
The very first thing you have to do is to register your Moodle site.
It will get you to the moodle mailing list. You will start to receive the emails regarding security alert and new releases.
When you register your site, others will get to know about that.
To register the site Go to Site Administration-> Registration.
A web form is available there and you just have to fill out. You can also publish your Moodle site.
Now, We have to change the theme for the site.
Just go to Site Administration->Appearance->Theme Selector.
A page will appear like below image. It will show you that you are using the Boost Theme by default.
Click on change theme. now you can see a lot of themes available there. If you want to choose any theme, click on use theme under the theme name.
Then, the Moodle site will use a theme and shows you content according to the theme settings.
You can use the different theme for different devices such as desktop, mobile phone, and other devices.
it is time to create your first course. Now, you have to select Site Home from Menu. You will see the course list being empty and add new course button.
Just click that button and you will see a form like below one.
Fill out the course details such Name, Short Name, Description and other relevant details.
After that scroll and click on Save and Display
That's all. Your first Moodle course is ready. Now you can add lessons and activities to the course using the interface.
Once again you have to check whether your Moodle site ready for production before allowing people to signup for your course.
You would like to add SSL/TSL to your apache to encrypt the connection between the server and client.
==You have to secure your Moodle site and should take Backup of MySQL site in regular interval.
Along with that, you also take backup of the files on the server. Especially /var/moodledata/ folder.==
In this article, you have learned how to set up moodle. For additional reference read the Moodle documentation and approach the worldwide moodle community.
it will help you in utilizing your Moodle site very well. You can get the most of out of it by learning from the Moodle Administrators.