Introduction
This document provides the steps for performing an in-place upgrade from CentOS 7.x to Alma Linux 8.x and ensures JetPatch still runs after OS upgrade.
Pre-Requisites
- A system running CentOS 7.X.
- Administrator access.
- Internet connection.
The following sections demonstrate how to migrate CentOS 7.X to Alma Linux 8.X using the Elevate project and the Leapp framework. The two projects support migration between different RHEL-based distributions.
Step 1: Create a Backup
Take the snapshot of your centos server
Before migrating any system, the best practice is to create a snapshot of the system. Take a Snapshot of your centos machine before performing the in-place upgrade
If you are unable to take a snapshot, then you need to backup a series of files and folders.
Step 2: Install Migration Packages
1. Install the elevate-release package from the repository for the latest version
sudo yum install -y http://repo.almalinux.org/elevate/elevate-release-latest-el$(rpm --eval %rhel).noarch.rpm
2. Install the Leapp migration data packages for Alma Linux and the upgrade utility with the following:
sudo yum install -y leapp-upgrade leapp-data-almalinux
Step 3: Disable PostgreSQL Repository and Stop PostgreSQL Service
sudo sed -i -e '/\[pgdg-common\]/,/\[.*\]/{s/enabled=1/enabled=0/}' -e '/\[pgdg15\]/,/\[.*\]/{s/enabled=1/enabled=0/}' -e '/\[pgdg14\]/,/\[.*\]/{s/enabled=1/enabled=0/}' -e '/\[pgdg13\]/,/\[.*\]/{s/enabled=1/enabled=0/}' -e '/\[pgdg12\]/,/\[.*\]/{s/enabled=1/enabled=0/}' /etc/yum.repos.d/pgdg-redhat-all.repo
systemctl stop postgresql-<version>.service
Step 4: Run Pre-Upgrade Checks
Run a pre-upgrade to do a system check before upgrading
sudo leapp preupgrade
Pre-upgrade will take some time. When completed, it will generate files in the /var/log/leapp/ directory that contain all potential upgrade issues and how to fix them. The below files contain important information:
- answer file - Contains questions that require a true or false answer to proceed with the upgrade.
- leapp-report.txt - Contains all possible problems and fixes to perform before or after the upgrade.
- leapp-preupgrade.log - The complete pre-upgrade log and debug output.
The upgrade will be inhibited the first time due to the following problem.
Inhibitor: Missing required answers in the answer file
Check the pre-upgrade report for details and possible remediation.
Check the first two files and perform all required pre-upgrade actions. Some common pre-upgrade fixes when migrating from CentOS 7 are:
1. Removing the pata_acpi kernel module:
sudo rmmod pata_acpi
2. Updating the SSH config file to permit root login:
echo PermitRootLogin yes | sudo tee -a /etc/ssh/sshd_config
3. Confirming the removal of the PAM PKCS#11 module:
sudo leapp answer --section remove_pam_pkcs11_module_check.confirm=True
The command updates the answer file, confirming the removal.
Address all fixes and rerun the pre-upgrade command to confirm everything is fixed:
sudo leapp preupgrade
The system is ready for upgrade when the "Upgrade Inhibited" message disappears.
Step 5: Run Upgrade
When no more suggested actions exist, the system is ready to upgrade. Proceed with the OS upgrade steps below:
1. Run the Leapp upgrade command:
sudo leapp upgrade
Wait for the upgrade to complete. If the upgrade fails, return to the previous step and address any issues missed in the pre-upgrade check.
2. When the process completes successfully, reboot the machine:
reboot
3. The GRUB menu shows a new entry called ELevate-Upgrade-Initramfs.
After a few seconds, the system automatically boots into this selection and continues the upgrade process.
4. The system restarts twice more after the upgrades. When the restarts are complete, the GRUB menu shows the Alma Linux entries .
The entries indicate a successful upgrade from CentOS 7 to Alma Linux 8. The system automatically boots into the upgraded version.
Step 6: Post-Upgrade Steps
6.1.Validate the upgradation
1.After the reboot you can login to the server using the same username and password
2.Check the OS details using the below command
cat /etc/os-release
3.Check the almalinux version using the below command
cat /etc/almalinux-release
The above output shows that your CentOS 7.x has been successfully upgraded to AlmaLinux 8.10
6.2.Use baseurl Instead of mirrorlist in almalinux.repo:
The mirrorlist URL for AlmaLinux is not working currently , so you can use baseurl by running the below command
sudo sed -i -e 's/^mirrorlist/#mirrorlist/' -e 's/^# baseurl/baseurl/' -e 's/^#baseurl/baseurl/' /etc/yum.repos.d/almalinux.repo
6.3.Remove the existing PostgreSQL Data folder
sudo rm -rf /var/lib/pgsql/<version>/*
6.4.Install the PostgreSQL for almalinux
6.4.1 Install the repository RPM:
sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
6.4.2 Disable the built-in PostgreSQL module
sudo dnf -qy module disable postgresql
6.4.3 Change the gpgkey file name in pgdg-redhat-all.repo using the following command
sudo sed -i 's/RHEL7/RHEL/' /etc/yum.repos.d/pgdg-redhat-all.repo
6.4.4 Enable PostgreSQL Repository
sudo sed -i -e '/\[pgdg-common\]/,/\[.*\]/{s/enabled=0/enabled=1/}' -e '/\[pgdg15\]/,/\[.*\]/{s/enabled=0/enabled=1/}' -e '/\[pgdg14\]/,/\[.*\]/{s/enabled=0/enabled=1/}' -e '/\[pgdg13\]/,/\[.*\]/{s/enabled=0/enabled=1/}' -e '/\[pgdg12\]/,/\[.*\]/{s/enabled=0/enabled=1/}' /etc/yum.repos.d/pgdg-redhat-all.repo
6.4.5 Install PostgreSQL:
sudo dnf install -y postgresql<version>-server
6.4.6 Initialize the database, enable and start :
sudo /usr/pgsql-<version>/bin/postgresql-<version>-setup initdb
sudo systemctl enable postgresql-<version>
sudo systemctl start postgresql-<version>
6.5.Create intiguadb ,intigua user and granting all the privileges to intigua user
Switch to postgres user
su - postgres
psql
create database intiguadb;
create user intigua with password '<db_password_in_intigua.properties>';
grant all privileges on database intiguadb to intigua;
exit
6.6.Restore the postgresql backup
psql -d intiguadb -f dbbackup.sql
Note: Please ensure that the database backup restoration command executes without any errors.
6.7.Grant Schema Level permissions on public schema in intiguadb for intigua user
After restoring the backup, to avoid permission error on public schema in intiguadb for intigua user grant below permissions to the intigua user
6.7.1 Connect to PostgreSQL:
psql -U postgres -d intiguadb
6.7.2 Granting Schema-Level Permissions
GRANT USAGE ON SCHEMA public TO intigua;
GRANT CREATE ON SCHEMA public TO intigua;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO intigua;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO intigua;
GRANT ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA public TO intigua;
6.7.3 Exit from intiguadb and postgres user
exit
exit
6.8.Restore The postgres Configuration Files
sudo cp -f ./config/pg_hba.conf /var/lib/pgsql/<version>/data/
sudo cp -f ./config/postgresql.conf /var/lib/pgsql/<version>/data/
6.9. Validate the Intigua RPMs
rpm -qa | grep intigua
6.10. Restart the PostgreSQL service and tomcat service
systemctl restart postgresql-<version>.service
systemctl restart tomcat
Existing users and plans are restored now . You can now log in to the jetpatch manager using the same credentials.
---------------------
Optional: Backup Files Instructions (in case snapshot is not possible)
Backup system Configuration Files
sudo tar -czvf config_backup.tar.gz /etc /var /opt /usr/local
Backup your DB
su - postgres
pg_dump intiguadb > dbbackup.sql;
Backup postgres Configuration Files:
mkdir <backup_path>/config
cp /var/lib/pgsql/<version>/data/pg_hba.conf <backup_path>/config
cp /var/lib/pgsql/<version>/data/postgresql.conf <backup_path>/config
Backup Installed Packages List:
rpm -qa > installed_packages.txt
Backup the Application configuration files
Backup the following directories:
- /usr/share/tomcat/default/conf/*
- /usr/share/intigua/*
cd /usr/share/tomcat/default/conf/
tar -czvf /root/tomcat_backup.tar.gz *
cd /usr/share/intigua/
tar -czvf /root/intigua_backup.tar.gz *
Copy all the backup files to the backup server using preferred method
Example
scp /var/lib/pgsql /dbbackup.sql root@newserver_ip:/var/lib/pgsql
scp /root/tomcat_backup.tar.gz root@newserver_ip:/root/
scp /root/intigua_backup.tar.gz root@newserver_ip:/root/
Comments
0 comments
Please sign in to leave a comment.