How To Install Moodle with Linux Servers
Reason to
prefer ubuntu server over Ubuntu desktop
- Nowadays in IT, industry Command-line Interface (CLI) is getting used as it is safe and less prone to hack.
- If we are using Moodle lms server for local and for experimental purpose then there is need of installing the desktop version of Ubuntu.
Once we install CLI and downstream we
anguish, then we can add a graphical desktop: Though it is not recommended by
the expert, graphical user interface(desktop) can be added by using a
command ‘sudotasksel’(Space
bar) to install ‘Ubuntu Desktop’
- All three Ubuntu packages are LTS(Long Term Service) releases.
- There is difference in Ubuntu release 18.04 and 16.04 than 14.04LTS
- Moodle 3.01 onword is required PHP 7.0
- If we are using external authentication or enrollment plug-ins, note that in Moodle 3.0.1 release MSSQL and SQLSRV are not available in PHP 7.0. Also depending upon a configuration some of the extension might be missing or working in progress for our contribution. We need to check exact availability of OS.
Ø Procedure
- Amd64 server is preferred
- · Ubuntu Server 18.04LTS amd64 has all packages which are required
- · Ubuntu 18.04LTs has slight difference from 14.04LTS mainly in php7.0
- · There are two editors VI(lightware editor) and VIM(heavyweight edito) we can use either one of them using below;-
sudo apt-get install vim
- · Commonds mainly used in VI or VIM
Ø For editing
file press “Insert” key
Ø For
finishing edit file press “ESC” key
Ø For write in
the file press “.w”
Ø To exit
editor press “.q”
Last two
option be done together i.e write and quite using “.wq”
- In Ubuntu ,standard user which we create while during installation do not have rights to install/write with respect to many directories Because of this we use ‘sudo’(super user do) term while using every command.
Step 2: Install Apache/MySQL/PHP
Open the
terminal for adding phpppa:
sudo add-apt-repository
ppa:ondrej/php
sudo apt-get update
sudo apt-get install
apache2 mysql-client mysql-server php7.0 libapache2-mod-php7.0
After
this it will give us password for mysql kindly please store that because in
letter steps we need to use that password.
Step 3:
Install Additional Software
sudo apt-get install graphvizaspellghostscriptclamav
php7.0-pspell php7.0-curl php7.0-gd php7.0-intl php7.0-mysql php7.0-xml
php7.0-xmlrpc php7.0-ldap php7.0-zip php7.0-soap php7.0-mbstring
To locate amodule correctly kindly restart the Apache
sudo service apache2 restart
To store Moodle core
application Git will be used
sudo apt-get install git-core
Step 4:
Download Moodle
In
other terms, Git is known as ‘Version Control System’. By using Git it will
ultimately update the Moodle lms core application. Next step will illustrate reason of putting Moodle core
application code in /opt directory.
cd /opt
To download Moodle lms code &
index
sudogit clone git://git.moodle.org/moodle.git
Changing directory where
Moodle folder is downloaded
cdmoodle
To retrieve all available
branches
sudogit branch -a
For track or use of git
branch
sudogit branch --track MOODLE_33_STABLE
origin/MOODLE_33_STABLE
Most
important to check Moodle version
sudogit checkout MOODLE_33_STABLE
Step 5: Copy
local repository to /var/www/html/
sudocp -R /opt/moodle /var/www/html/
sudomkdir /var/moodledata
sudochown -R www-data /var/moodledata
sudochmod -R 777 /var/moodledata
sudochmod -R 0755 /var/www/html/moodle
The
idea behind creating repository is to formulate and lap our upgrades in the
more decisive way.
Step 6: Setup
MySQL Server
Before
MySQL setup we first need to change storage engine to innodb and file format to
Barrcuda. This is new in Ubuntu 18.04LTS version not available in previous.
Also need to set up innodb_file_per_tableso that
Barrcuda will work properly.
v No need to
make innodb as default storage engine because latest Moodle lms version
automatically does the same. It is a best practice to make it default anyway.
Whoever we neeed to set default file format!
v If we have
choosen vim instaead please reserve vi for vim
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
Scroll
dowon to [mysqld] and go to basic setting to add below mentioned line in last
statement. As preiuoslytols press “insert” key on a keyboard for the same.
default_storage_engine = innodb
innodb_file_per_table = 1
innodb_file_format = Barracuda
To save my.cnf file using
editor kindly press Esc key, also type below sequence
:w
:q
To know change made are
affecting restart MySQL
sudo service mysql restart
We have to create Moodle
database and Moodle MySQL user with correct permissions, here we need to use
password which we created in above step
mysql -u root –p
mysql>CREATE DATABASE moodle DEFAULT CHARACTER SET utf8
COLLATE
utf8_unicode_ci;
In place of “moodlecloud” and
“passwordformoodlecloude” we can enter username and password of our choice
mysql>create user 'moodledude'@'localhost' IDENTIFIED BY
'passwordformoodledude';
mysql>GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE
TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO moodledude@localhost
IDENTIFIED BY 'passwordformoodledude';
mysql>quit;
Note: While using MySql 5.6+
if we get an error about the password for creating a user, at that time we have
to adjust the value of the hash. We can get this by flowed steps;-
mysql>SELECT password('passwordformoodledude');
Result of above comond will come as “*AD51BAFB2GD003D3480BCED0DH81AB0BG1712535, WE
WILL USE THIS AS IDENTIFIED BY’part
Step 7:
Complete Setup
Note: If anyone is not
comfortable to create config.php by terminal while going through installation,
then there is a need for creating webroot writable by following
sudo chmod -R 777 /var/www/html/moodle
After we ran the installer,
we have Moodle lms set up, there is a need to revert permission so that file will
no longer writable by using below command;-
sudo chmod -R 0755 /var/www/html/moodle
Open the browser and type the moodle site address and
follow below prompts
Change the path for
moodledata
/var/moodledata
Database Type
Choose: mysqli
Database Settings
Host server: localhost
Database: moodle
User: moodledude (the user you created when setting up the
database)
Password: passwordformoodledude (the password for the user
you created)
Tables Prefix: mdl_
Environment Checks
Environment check will
illustrate requirement of additional element for Moodle installation
This will indicate if any
elements required to run moodle haven't been installed.
Next next next...
follow prompts and confirm installation
Create a Site Administrator Account
Here create user which will
be having all rights of site administrator.
For password Moodle lms has
certain security requirement make sure we follow that.
Installation Complete
Congrats! You can now start
using Moodle!
Don't Forget
If webroot is writable don’t
forget following;-
sudo chmod -R 0755 /var/www/html/moodle
System Paths After Install
After installation completed
we should set system path which will help to improve Moodle LMS performance. So
that each and every enrty of Moodle will have own explanation.
Navigate,on Moodle lms webpage,
Site Administration > Server > System Paths
Input the following;
Path to Du: /usr/bin/du
Path to Apsell: /usr/bin/aspell
Path to dot: /usr/bin/dot
Save Changes.