How to Perform an In-Place Upgrade from CentOS 7 to CentOS 8 Without Reinstallation


2 views

Many sysadmins face the dilemma of upgrading CentOS 7 systems to CentOS 8 while maintaining existing configurations and data. The standard yum update approach fails spectacularly due to fundamental changes in package management and system architecture between these major versions.

The attempt to install centos-release-8.0 RPM directly leads to dependency hell because:

# This approach is fundamentally flawed
yum install http://mirror.bytemark.co.uk/centos/8/BaseOS/x86_64/os/Packages/centos-release-8.0-0.1905.0.9.el8.x86_64.rpm

CentOS 8 introduced:

  • DNF replacing YUM as package manager
  • New modular repository structure
  • Python 3 as default instead of Python 2

The safest approach involves using the centos-upgrade tool:

# Install the upgrade tool
yum install -y centos-upgrade

# Prepare the system
centos-upgrade prepare

# Download upgrade packages
centos-upgrade download

# Execute the upgrade (takes 30+ minutes)
centos-upgrade upgrade

Before attempting the upgrade:

  1. Backup all critical data
  2. Disable third-party repositories (EPEL, etc.)
  3. Update all existing packages: yum update -y
  4. Check for obsolete packages: package-cleanup --orphans

After successful upgrade:

# Verify OS version
cat /etc/redhat-release

# Check package manager
dnf --version

# Review failed services
systemctl --failed

Common issues include:

  • Missing dependencies for custom applications
  • Python 2 vs Python 3 compatibility problems
  • SELinux policy mismatches

For more complex environments, consider Red Hat's upgrade tool:

# Install leapp and data files
yum install -y leapp-upgrade leapp-data-centos

# Perform pre-upgrade checks
leapp preupgrade

# Review findings
cat /var/log/leapp/leapp-report.txt

# Execute upgrade
leapp upgrade

In-place upgrades may not be suitable when:

  • Critical applications lack CentOS 8 support
  • Custom kernel modules are required
  • The system has extensive third-party packages

Attempting to upgrade CentOS 7 to 8 using standard package installation methods often leads to dependency hell. The command:

yum install http://mirror.bytemark.co.uk/centos/8/BaseOS/x86_64/os/Packages/centos-release-8.0-0.1905.0.9.el8.x86_64.rpm

followed by yum update creates infinite dependency resolution loops because the RPM database isn't properly migrated between major versions.

Before starting:

  • Backup all critical data and configurations
  • Verify adequate disk space (minimum 10GB free)
  • Check for third-party repositories (disable them)
  • Update current CentOS 7 to latest packages:
sudo yum clean all
sudo yum update -y
sudo reboot

Red Hat provides the leapp utility for in-place upgrades. For CentOS:

sudo yum install -y leapp-upgrade leapp-data-centos

Run pre-upgrade check:

sudo leapp preupgrade

Review the report at /var/log/leapp/leapp-report.txt and address any inhibitors.

After resolving all pre-upgrade issues:

sudo leapp upgrade

The system will reboot into upgrade environment. Monitor progress:

journalctl -fu leapp

After successful upgrade:

  1. Migrate to DNF (CentOS 8's new package manager):
sudo dnf install -y dnf-conf
  1. Clean obsolete packages:
sudo dnf autoremove
  1. Verify system integrity:
sudo dnf distro-sync

If encountering boot problems:

sudo grub2-mkconfig -o /boot/grub2/grub.cfg

For missing repositories:

sudo dnf config-manager --set-enabled PowerTools