June 20th, 2024, marked the end of life for CentOS 7, meaning it will no longer receive bug fixes, critical security updates, or new features. This is why it is crucial to migrate to another supported operating system.
If you are still on CentOS 7, here is your sign. AlmaLinux is an excellent alternative to CentOS 7. It is a community-driven enterprise distribution compatible with RHEL. The environment is similar to what CentOS provided.
This walk-through will help you with migrating from CentOS 7 to AlmaLinux without any hiccups.
Preparing for the Migration
To prepare for a smooth migration, you must fulfill several prerequisites. Here is a detailed walkthrough.
1. Check for supported
The migration from CentOS to AlmaLinux is only supported by CentOS 7 and CentOS 8 systems. Ensure you have the correct versions and update your system to the latest version to avoid issues during the migration.
Use this command to update your OS:
Get exclusive access to all things tech-savvy, and be the first to receive
the latest updates directly in your inbox.
sudo yum update -y
2. Backup your data
Keep a backup of your data, such as critical files, databases, and configurations, to avoid data loss. Backup using an external storage, separate disk, or a remote desktop server. Here is an exact list of all that you need to backup:
- System Configuration Files (/etc)
- User Data (/home)
- Application Data (databases, web server data)
- Custom Scripts and Cron Jobs
- Service Configuration
- Installed Package List
- Necessary Logs (/var/log)
- SSH Keys and Configuration
- Custom Network Configuration
- Virtual Hosts and Containers
- Email Server Configuration
- Firewall and Security Configurations
3. Check for disk space
Ensure you have enough disk space for the migration and new packages.
4. Disable third-party repositories and SELinux
Disable any third party repositories to avoid issues in migration. You can re-enable them if they are compatible after the process. Set SELinux to permissive mode so that it does not interfere with installation.
Use command:
sudo setenforce 0
5. Install a migration tool
Install the office AlmaLinux migration tool, almalinux-deploy, which would help migrate to the new operating system. Use command:
sudo curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh
Other small things include:
- Ensure you have administration rights to perform migration.
- Check for a stable internet connection to download AlmaLinux.
- Review already installed packages to ensure that they are AlmaLinux 8 compatible.
Step-by-Step Guide to Migrate CentOS 7 to AlmaLinux 8
Follow the following steps to migrate from CentOS 7 to AlmaLinux 8:
1. Prepare your system
Follow the prerequisites above to ensure that you are fully ready to migrate. Mainly focus on backing up your data to avoid any data loss and updating to the latest version of CentOS to ensure a smooth transition.
Also, ensure your hardware and software are compatible with AlmaLinux 8. Use uname -r to check your kernel version.
2. Download the ELevate Tool
The ELevate tool is your weapon to migrate between versions. You can start enabling the EPEL using the command:
sudo yum install epel-release -y
Download and install the ELevate package using the code:
sudo yum install -y https://repo.almalinux.org/elevate/elevate-release-latest.el7.noarch.rpm
sudo yum install -y leapp-upgrade leapp-data-almalinux
3. Pre-migration Assessment
Run a pre-migration checkup to pick out any compatibility conflicts, using the command:
sudo leapp preupgrade
Review the report for any errors, using the command:
less /var/log/leapp/leapp-report.txt
4. Migration
Start the migration process using the command:
sudo leapp upgrade
Reboot the system when prompted:
sudo reboot
5. Cleanup
Verify the process by checking the OS version, using the command:
cat /etc/os-release
Remove any unwanted or old CentOS packages:
sudo yum autoremove
6. Enable configurations
Re-enable third-party repositories and SELinux that we disabled in the pre-setup. Restore custom configurations and backup if required.
7. Test the new system
Cross-check all applications, services, and dependencies to see if they are working correctly. Use the command:
sudo journalctl -xe
Troubleshooting Common Issues
If you are stuck somewhere during the migration, here is a guide for trouble-shooting:
1. Migrating errors
If the migration tool fails, check logs for error messages:
less /var/log/leapp/leapp-report.txt
2. Missing tools or packages
Some CentOS packages might not be compatible with AlmaLinux. Reinstall such packages using the AlmaLinux repositories.
3. Service failures
Use this command to debug:
sudo journalctl -xe
4. SELinux Issues
Review and adjust the rules in the logs:
sudo ausearch -m AVC -ts recent
5. Kernel issues
Ensure you are using the correct version and all the drivers are installed.
Benefits of AlmaLinux 8
- AlmaLinux offers stable support for large enterprise-level environments.
- AlmaLinux is compatible with CentOS, which provides a seamless migration.
- It has a supportive community, which offers guides, updates, and more.
- Robust features, such as performance optimization, security, and compatibility with enterprise environments.
- Fully open-source, free to use without any subscription fees.
Conclusion
Migrating from CentOS to AlmaLinux is a tedious task, however, you can get lots of help online. This guide demonstrates how to do it in detail and also provides troubleshooting queries.
Frequently Asked Questions
1. Is the migration process to AlmaLinux disruptive?
The migration process is not that hard if planned well. However, it is crucial to test migration in a staging environment before applying it to the development systems.
2. What command shall I use to back up data before migration?
You can back up your system using rsync or tar, or an external disk, use command:
rsync -avz /important/data /backup/location
3. What tools can I use for migrating Centos 7 to AlmaLinux?
Use the ELevate Project from AlmaLinux, which provides the leapp tool for smooth migrations between RHEL-based distributions.