Installing moodle in Centos Print

  • 1

Install LAMP STACK

1.1 Web server

Install apache 2

$ Sudo dnf install -y @httpd

 

Apache 2 activation

$ Sudo systemctl start httpd

 

Start apache2 on restart(startup)

$ Sudo systemctl enable httpd

 

Check if httpd/httpd working

$ Sudo systemctl status httpd

http://your-ip-address-here



1.2 Database

nstall MariaDB 10.5 (or the newest one)

$ Sudo dnf module reset mariadb

$ Sudo dnf module install mariadb:10.5

 

Start MariaDB service

$ Sudo systemctl start mariadb

 

Start mariadb at startup

$ Sudo systemctl enable mariadb

 

Check mariadb working or not

$ Sudo systemctl status mariadb

 

Securing mariadb installation

$ Sudo mysql_secure_installation




1.3 PHP

For moodle 3.5 use PHP 7.2

Installing remi repo

$ Sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

$ Sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm

 

Install php 7.2

$ Sudo dnf module reset php

$ Sudo dnf install php:remi-7.2

$ Sudo dnf update

 

If you already know what php-modules to install. If you don’t know, skip this

$ Sudo dnf install php-xxx (php-gd, php-zip, etc)

 

To check if php working and check php version

$ Php -v

$ Php -m



























Installing Moodle 3.5

2.1 Playing with git

Install git

$ Sudo dnf install git

 

Installing moodle 3.5 with git

$ Cd /var/www/html

 

$ git clone git://git.moodle.org/moodle.git

If error (connection refuse error)

$ Git clone https://github.com/moodle/moodle.git

See more at https://docs.moodle.org/311/en/Git_for_Administrators#Git_Connection_Refused_Error

2.2 instruction? for moodle installation

$ cd /var/www/html/moodle

$ git branch -a

$ git branch --track MOODLE_35_STABLE origin/MOODLE_35_STABLE

$ git checkout MOODLE_35_STABLE

$ Git pull

 

$ Mkdir /var/www/moodledata

 

Editing permission for folder moodle and moodledata so apache can modify them

$ Cd /var/www/html

$ Sudo chown -R apache:apache moodle

$ Sudo chown -R apache:apache ../moodledata

 

Setting up the database for moodle

$ Mysql -u root -p

Then enter your mysql root password

 

Mysql > CREATE DATABASE -Moodle-database-name- DEFAULT CHARACTER SET utf8mb4 mysql > COLLATE utf8mb4_unicode_ci;

Change -Moodle-database-name- to your database name choice

 

Mysql > create user 'moodledude'@'localhost' IDENTIFIED BY 'passwordformoodledude';

Change moodledude to other new user example sammy

Change passwordformoodledude with new password for the use

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

Change moodledude to the user you just created above

 

Finish the moodle installation

http://your-ip-address-here/moodle

Follow the instruction there

 

If you need to install php modules

$ Sudo dnf install php-xxx
Change xxx to the name of modules, example : php-gd, php-zip

If moodle cannot create config.php, then create it manually

$ Cd /var/www/html/moodle

$ Vim config.php

Copy paste everything from the installation instruction to config.php

 

2.3 Set up cron

Setting up cron for moodle every minute

$ Cd /var/www/html/moodle

$ Crontab -e

Then add this text below :

* * * * * php admin/cli/cron.php >/dev/null
















Installing plugin from terminal

I don’t really have any instruction for this, because every plugin has a different folder destination. And sometimes there are complicated plugin installation like Atto MorefontColors

In that plugin you need to rename ndunand-moodle-atto_morefontcolors-872a60c to morefontcolors
Then add In the "Toolbar config" box, I typed "morefontcolors=morefontcolors" without the quotes.

 

The detailed explanation is always at “Source Control URL” in the plugin page, then go to readme.txt and/or readme.md. Or sometimes someone pointed the right way in the comment section on the plugin page.

It’s not complicated, it just needs basic understanding of how to move between folders with console in Linux.

 

A few basic commands that used in plugin installation :

  • $ Pwd : where you are right now in linux
  • $ Ls -la : to see what is inside folder
  • $ Cd : to change active folder
  • $ Unzip (filename.zip) : unzip the file
  • $ Wget (link) : to download the plugin
  • $ tar --exclude="*/*" -tf filename.zip : to check folder inside the zip file in 1 depth

 

For more detailed instruction, pdf from Andre is waaaayyy better than my doodles : MOODLE-InstallingorupgradingMoodleplugins-020721-0852-40.pdf

 

After done installing all the plugins/themes upgrade the database.

$ Cd /var/www/html/moodle

$ Php admin/cli/upgrade.php














Upgrading to Moodle 3.9

4.1 Enable Maintenance mode

$ Cd /var/www/html/moodle

$ php admin/cli/maintenance.php --enable

 

You can disable later it by changing the option to –disable

 

4.2 Upgrade moodle with git

Check what is the installed moodle version first

$ cd /var/www/html/moodle

$ cat version.php

 

Check if .git exist or not

$ ls .git

4.2.1 If .git exist

$ cd /var/www/html/moodle

$ git pull

You can check what branch exist inside Moodle Git using

$ git branch -a

Choose your branch (in this chase moodle 39) then update your moodle

$ git branch –track MOODLE_39_STABLE origin/MOODLE_39_STABLE

$ git checkout MOODLE_39_STABLE

$ git pull

 

Then check the updated moodle version

$ cat version.php

 

Dont use upgrade moodle command yet for now (admin/cli/upgrade/php)

Update the PHP first

4.2.2 If .git doesn’t exist (somehow…)

$ cd /var/www/html/moodle

$ git clone https://github.com/moodle/moodle.git -b MOODLE_39_STABLE temp

$ mv temp/.git .

$ rm -rf temp

$ git pull

You can check what branch exist inside Moodle Git using

$ git branch -a

Choose your branch (in this chase moodle 39) then update your moodle

$ git branch –track MOODLE_39_STABLE origin/MOODLE_39_STABLE

$ git checkout MOODLE_39_STABLE

$ git pull

$ git reset --hard MOODLE_39_STABLE origin/MOODLE_39_STABLE

$ git clean -f -d

 

Then check the updated moodle version

$ cat version.php

 

Dont use upgrade moodle command yet for now (admin/cli/upgrade/php)

Update the PHP first

4.3 Upgrading php to 7.4

Remi repo have very good configuration wizard

https://rpms.remirepo.net/wizard/

 

Pick the operating system EL8
Wanted PHP Version 7.4
Type of installation Single Version

Then just follow the wizard answer.
I don’t think you need to download php modules again, php and the modules will be updated to 7.4

After that check the php version

$ php -v

 

4.4 Finishing upgrading moodle with the cli command

$ cd /var/www/html/moodle

$ sudo php admin/cli/upgrade.php

Just wait until it done.

 

4.5 Upgrade moodle plugin

Login as admin in http://youriphere/moodle/admin/login.php

Then go to administration site -> plugin -> plugin overview -> check for update

 

4.6 Disable maintenance mode
$ Cd /var/www/html/moodle

$ php admin/cli/maintenance.php --disable



































Installing phpmyadmin

5.1 Easy way with portable phpmyadmin

 

$ cd /var/www/html

$ mkdir dbviewer

$ cd dbviewer

$ wget http://phpmyadminurlhere
$ unzip phpmyadminfile.zip

$ mv phpmyadminfolder/* .

$ rm -rf phpmyadminfolder

http://youriphere/dbviewer

 

5.2 Somehow if you want using hard way by installing phpmyadmin

Install phpmyadmin

$ sudo dnf install phpmyadmin


Add /dbviewer alias on apache

$ sudo vim /etc/httpd/conf.d/phpmyadmin.conf

Change this line ‘Alias /phpMyAdmin /usr/share/phpMyAdmin’ to ‘Alias /dbviewer /usr/share/phpMyAdmin’

 

Then restart apache

$ sudo systemctl restart httpd














Miscellaneous

To do later





Was this answer helpful?

« Back