Thre are four backups have to be done before an update can be done. Below are the backups that have to be done.

Main code base of Moodle – As a sample I am copying it in the home folder. In the home folder, I have created a folder called as moodle and four sub-folders inside it – code, config, data, and database

  • Backing up the moodle code in /home/robert/moodle/code
#sudo zip -r moodle.zip moodle
#sudo cp moodle.zip /home/robert/moodle/code/
  • Backing up config file
#sudo cp /var/www/moodle/config.php /home/robert/moodle/config/
  • Backup data folder
#sudo su
#cd /
#zip -r data.zip mooodledata
#cp data.zip /home/robert/moodle/data/

Database backup

#sudo mysqldump --single-transaction -u robert -p moodle_db > /home/robert/moodle_db.sql
#mysql -u root -p moodle_db >moodle.sql
#cp moodle.sql /home/robert/moodle/sql_baks/

Upgrading Moodle

Download the latest version of moodle from the website. Change the version in the command below to get the latest one. Jumping version numbers should be avoided as it might break the installation.

/home/robert/# wget https://download.moodle.org/download.php/stable403/moodle-latest-403.zip
/home/robert/# unzip moodle-latest-403.zip

#cd /var/www/
/var/www/# sudo mv moodle moodle_old

####copying new unzipped moodle to www directory######
/home/robert/# sudo cp -r moodle /var/www/
/var/www/# sudo cp /var/www/moodle_old/config.php /var/www/html/moodle/
#sudo chown -R root:www-data moodle
#sudo chmod -R 755 moodle
#cd /var/www/moodle
#/var/www/moodle# /usr/bin/php admin/cli/upgrade.php
#sudo systemctl restart apache2
#sudo systemctl restart mariadb

Once all is done, go and load the URL of the moodle platform to see if it has been upgraded

Share this post