Difference between revisions of "Moodle Upgrade 4.2.3 to 5.1"

From Notes_Wiki
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Main Page|Home]] > [[Ubuntu]] > [[Ubuntu 22.04]] > [[Ubuntu 22.04 Moodle Upgrade]] > [[Moodle Upgrade 4.2.3 to 5.1]]
[[Main Page|Home]] > [[Ubuntu]] > [[Ubuntu 22.04]] > [[Ubuntu 22.04 Moodle Upgrade]] > [[Moodle Upgrade 4.2.3 to 5.1]]
* Take the DB dump
<pre>
mysqldump -u <db-user> -p <db-name> > moodle_db_backup_before_5.sql
</pre>
* Backup moodle directories
<pre>
sudo tar czf moodledata_backup_before_5.tar.gz /var/moodledata
sudo tar czf moodle_code_backup_before_5.tar.gz /var/www/html/moodle
</pre>
* Go to moodle directory
<pre>
cd /var/www/html
</pre>
* Rename the old moodle folder
<pre>
sudo mv moodle moodle_old_42
</pre>
* Download the moodle package from the official website and extract the package
<pre>
sudo tar -zxvf moodle-latest-501.tgz
</pre>
* Copy the configuration file from the old moodle
<pre>
sudo cp moodle_old_42/config.php moodle/
</pre>
* Give required permissions and ownership
<pre>
sudo chown -R www-data:www-data moodle
sudo chmod -R 755 moodle
sudo chown -R www-data:www-data /var/moodledata
</pre>
* Update the apache file:
<pre>
vim /etc/apache2/sites-available/000-default.conf
DocumentRoot /var/www/html/moodle/public
<Directory /var/www/html/moodle/public>
</pre>
* Update the default SSL file:
<pre>
vim /etc/apache2/sites-available/default-ssl.conf
DocumentRoot /var/www/html/moodle/public
</pre>
* Restart the webserver:
<pre>
sudo systemctl reload apache2
</pre>
* Install PHP 8.4:
<pre>
sudo apt update
sudo apt upgrade -y
sudo apt install software-properties-common ca-certificates lsb-release apt-transport-https -y
sudo add-apt-repository ppa:ondrej/php
sudo apt install php8.4 libapache2-mod-php8.4 -y
sudo apt install php8.4-mysql php8.4-cli php8.4-common php8.4-curl php8.4-gd php8.4-mbstring php8.4-xml php8.4-zip -y
</pre>
* Disable the php8.1 module (or the old php modules):
<pre>
a2dismod php8.1
</pre>
* Enable the php8.4:
<pre>
sudo a2enmod php8.4
</pre>
* Check the PHP Version:
<pre>
php -v
</pre>
* Use the below command to select the php8.4 version, if the version is not reflected:
<pre>
sudo update-alternatives --config php
</pre>
* Restart the webserver:
<pre>
sudo systemctl restart apache2
</pre>
* Edit the '''php.in''' file, uncomment and change the value to 5000
<pre>
vim /etc/php/8.4/apache2/php.ini
max_input_vars = 5000
</pre>
* Download MYSQL 8.4 version:
<pre>
wget https://dev.mysql.com/get/mysql-apt-config_0.8.33-1_all.deb
</pre>
* Install the package:
<pre>
sudo dpkg -i mysql-apt-config_0.8.33-1_all.deb
</pre>
* Select 8.4 version
* Update the repositories:
<pre>
sudo apt update
</pre>
* Install mysql-server:
<pre>
sudo apt install mysql-server -y
</pre>
* Restart mysql and apache:
<pre>
sudo systemctl restart mysql
sudo systemctl restart apache2
</pre>
* Install php extensions:
<pre>
sudo apt install -y php8.4-curl php8.4-intl php8.4-soap
sudo apt-get install php8.4-ldap
</pre>
* Restart the webserver:
<pre>
sudo systemctl restart apache2
</pre>
* Install composer:
<pre>
apt install composer
</pre>
* Run the below command in the moodle directory:
<pre>
composer install --no-dev --classmap-authoritative
</pre>
* Give required permissions and ownerships:
<pre>
sudo chown -R www-data:www-data /var/www/html/moodle/vendor
sudo chmod -R 755 /var/www/html/moodle/vendor
</pre>
* Restart the web server:
<pre>
sudo systemctl restart apache2
</pre>
* Open the website on a browser and follow the steps to upgrade Moodle.

Latest revision as of 06:41, 16 October 2025

Home > Ubuntu > Ubuntu 22.04 > Ubuntu 22.04 Moodle Upgrade > Moodle Upgrade 4.2.3 to 5.1

  • Take the DB dump
mysqldump -u <db-user> -p <db-name> > moodle_db_backup_before_5.sql
  • Backup moodle directories
sudo tar czf moodledata_backup_before_5.tar.gz /var/moodledata
 
sudo tar czf moodle_code_backup_before_5.tar.gz /var/www/html/moodle
  • Go to moodle directory
 
cd /var/www/html
  • Rename the old moodle folder
 
sudo mv moodle moodle_old_42
  • Download the moodle package from the official website and extract the package
sudo tar -zxvf moodle-latest-501.tgz
  • Copy the configuration file from the old moodle
sudo cp moodle_old_42/config.php moodle/
  • Give required permissions and ownership
sudo chown -R www-data:www-data moodle

sudo chmod -R 755 moodle

sudo chown -R www-data:www-data /var/moodledata
  • Update the apache file:
vim /etc/apache2/sites-available/000-default.conf

	DocumentRoot /var/www/html/moodle/public
	<Directory /var/www/html/moodle/public>	
  • Update the default SSL file:
vim /etc/apache2/sites-available/default-ssl.conf

	DocumentRoot /var/www/html/moodle/public
  • Restart the webserver:
sudo systemctl reload apache2
  • Install PHP 8.4:
sudo apt update

sudo apt upgrade -y

sudo apt install software-properties-common ca-certificates lsb-release apt-transport-https -y

sudo add-apt-repository ppa:ondrej/php

sudo apt install php8.4 libapache2-mod-php8.4 -y

sudo apt install php8.4-mysql php8.4-cli php8.4-common php8.4-curl php8.4-gd php8.4-mbstring php8.4-xml php8.4-zip -y
  • Disable the php8.1 module (or the old php modules):
a2dismod php8.1
  • Enable the php8.4:
sudo a2enmod php8.4
  • Check the PHP Version:
php -v
  • Use the below command to select the php8.4 version, if the version is not reflected:
sudo update-alternatives --config php
  • Restart the webserver:
sudo systemctl restart apache2
  • Edit the php.in file, uncomment and change the value to 5000
vim /etc/php/8.4/apache2/php.ini

	max_input_vars = 5000
  • Download MYSQL 8.4 version:
wget https://dev.mysql.com/get/mysql-apt-config_0.8.33-1_all.deb
  • Install the package:
sudo dpkg -i mysql-apt-config_0.8.33-1_all.deb
  • Select 8.4 version
  • Update the repositories:
sudo apt update
  • Install mysql-server:
sudo apt install mysql-server -y
  • Restart mysql and apache:
sudo systemctl restart mysql

sudo systemctl restart apache2
  • Install php extensions:
sudo apt install -y php8.4-curl php8.4-intl php8.4-soap

sudo apt-get install php8.4-ldap
  • Restart the webserver:
sudo systemctl restart apache2
  • Install composer:
apt install composer
  • Run the below command in the moodle directory:
composer install --no-dev --classmap-authoritative
  • Give required permissions and ownerships:
sudo chown -R www-data:www-data /var/www/html/moodle/vendor

sudo chmod -R 755 /var/www/html/moodle/vendor
  • Restart the web server:
sudo systemctl restart apache2
  • Open the website on a browser and follow the steps to upgrade Moodle.