Howto migrate centos7 to 8x: Difference between revisions

From Vidalinux Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(16 intermediate revisions by the same user not shown)
Line 1: Line 1:
update centos7 repos to use vault.centos.org:
= centos7 to 8 =
sed -i -e '/^mirrorlist/d;/^#baseurl=/{s,^#,,;s,/mirror,/vault,;}' /etc/yum.repos.d/CentOS*.repo
update to latest packages:
yum update -y
rhel alternatives or derivatives:
rhel alternatives or derivatives:
* [https://rockylinux.org rockylinux]
* [https://rockylinux.org rockylinux]
Line 15: Line 12:
* CentOS 7 to Oracle Linux 8
* CentOS 7 to Oracle Linux 8
* CentOS 7 to CentOS Stream 8
* CentOS 7 to CentOS Stream 8
upgrade current system to latest:
update centos7 repos to use vault.centos.org:
  yum update -y
sed -i -e '/^mirrorlist/d;/^#baseurl=/{s,^#,,;s,/mirror,/vault,;}' /etc/yum.repos.d/CentOS*.repo
update to latest packages:
  yum update -y  
verify your current version:
verify your current version:
  cat /etc/centos-release
  cat /etc/centos-release
Line 30: Line 29:
* leapp-data-rocky
* leapp-data-rocky
  yum install leapp-upgrade leapp-data-almalinux -y
  yum install leapp-upgrade leapp-data-almalinux -y
install networkmanager is not installed:
yum install NetworkManager -y
enable and start networkmanager:
systemctl enable NetworkManager && systemctl start NetworkManager
disable selinux on /etc/default/grub add the following:
GRUB_CMDLINE_LINUX="console=tty0 crashkernel=auto net.ifnames=0 biosdevname=0 console=ttyS0 selinux=0"
update grub config:
grub2-mkconfig -o /boot/grub2/grub.cfg
start a preupgrade check:
start a preupgrade check:
  leapp preupgrade
  leapp preupgrade
normally the check will fail, it’s normal because we need to do some tweaks:
normally the check will fail, it’s normal because we need to do some tweaks:
  sudo rmmod pata_acpi
modprobe -r btrfs
  echo PermitRootLogin yes | sudo tee -a /etc/ssh/sshd_config
rmmod pata_acpi
  sudo leapp answer --section remove_pam_pkcs11_module_check.confirm=True
echo PermitRootLogin yes | sudo tee -a /etc/ssh/sshd_config
leapp answer --section remove_pam_pkcs11_module_check.confirm=True
then run check again:
then run check again:
  leapp preupgrade
  leapp preupgrade
Line 48: Line 56:
= centos8 to almalinux8 =
= centos8 to almalinux8 =
fix mirrors:
fix mirrors:
  sed -i -e "s|mirrorlist=|#mirrorlist=|g" /etc/yum.repos.d/CentOS-*
  sed -i -e '/^mirrorlist/d;/^#baseurl=/{s,^#,,;s,/mirror,/vault,;}' /etc/yum.repos.d/CentOS*.repo
sed -i -e "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-*
update your system to latest:
update your system to latest:
  yum update -y
  yum update -y
Line 60: Line 67:
if an error ocurrs with signatures do the following:
if an error ocurrs with signatures do the following:
  rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux
  rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux
= almalinux8 to almalinux9 =
= almalinux8 to almalinux9 =
* https://wiki.almalinux.org/elevate/ELevate-testing-guide.html
* https://wiki.almalinux.org/elevate/ELevate-testing-guide.html
= rocky8 to rocky9 =
install rocky-release, rocky-repos, and rocky-gpg-keys:
VERSION=9.5-1.3
REPO_URL="https://download.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/Packages/r"
RELEASE_PKG="rocky-release-${VERSION}.el9.noarch.rpm"
REPOS_PKG="rocky-repos-${VERSION}.el9.noarch.rpm"
GPG_KEYS_PKG="rocky-gpg-keys-${VERSION}.el9.noarch.rpm"
dnf install -y $REPO_URL/$RELEASE_PKG $REPO_URL/$REPOS_PKG $REPO_URL/$GPG_KEYS_PKG
remove unneccesary packages:
dnf -y remove rpmconf yum-utils epel-release
rm -rf /usr/share/redhat-logos
install rocky9 packages:
dnf -y --releasever=9 --allowerasing --setopt=deltarpm=false distro-sync
if upgrade got stock upgrading auditd:
ps aux | grep [a]udit
kill -9 <pid>
when package installation finish recreate rpmdb:
rpm --rebuilddb
reboot system:
reboot
remove all el8 rpms:
rpm -qa|grep el8|xargs rpm -e
remove all modules:
dnf module disable "*" -y
remove all old gpg keys:
rpm -e `rpm -qa | grep gpg-pubkey | xargs`


= references =
= references =
* https://wiki.almalinux.org/elevate/ELevate-quickstart-guide.html
* https://wiki.almalinux.org/elevate/ELevate-quickstart-guide.html

Latest revision as of 15:37, 17 May 2025

centos7 to 8

rhel alternatives or derivatives:

cloud images:

https://wiki.vidalinux.org/index.php/Linux_cloud_images

distributions to migrate supported:

  • CentOS 7 to AlmaLinux 8
  • CentOS 7 to Rocky Linux 8
  • CentOS 7 to Oracle Linux 8
  • CentOS 7 to CentOS Stream 8

update centos7 repos to use vault.centos.org:

sed -i -e '/^mirrorlist/d;/^#baseurl=/{s,^#,,;s,/mirror,/vault,;}' /etc/yum.repos.d/CentOS*.repo

update to latest packages:

yum update -y 

verify your current version:

cat /etc/centos-release

install elevate-release package:

yum install http://repo.almalinux.org/elevate/elevate-release-latest-el7.noarch.rpm -y

install leapp-upgrade and migration-data:

Possible options are:

  • leapp-data-almalinux
  • leapp-data-centos
  • leapp-data-oraclelinux
  • leapp-data-rocky
yum install leapp-upgrade leapp-data-almalinux -y

install networkmanager is not installed:

yum install NetworkManager -y

enable and start networkmanager:

systemctl enable NetworkManager && systemctl start NetworkManager

disable selinux on /etc/default/grub add the following:

GRUB_CMDLINE_LINUX="console=tty0 crashkernel=auto net.ifnames=0 biosdevname=0 console=ttyS0 selinux=0"

update grub config:

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

start a preupgrade check:

leapp preupgrade

normally the check will fail, it’s normal because we need to do some tweaks:

modprobe -r btrfs
rmmod pata_acpi
echo PermitRootLogin yes | sudo tee -a /etc/ssh/sshd_config
leapp answer --section remove_pam_pkcs11_module_check.confirm=True

then run check again:

leapp preupgrade

if everything runs well, upgrade the system:

leapp upgrade

once the migration is completed, you’ll be offered to reboot the system:

reboot

select the new entry in grub called ELevate-Upgrade-Initramfs, wait for the upgrade process to finish.

when system is migrated to el8 run the following command to remove any el7 rpm package:

rpm -qa|grep el7|xargs rpm -e

centos8 to almalinux8

fix mirrors:

sed -i -e '/^mirrorlist/d;/^#baseurl=/{s,^#,,;s,/mirror,/vault,;}' /etc/yum.repos.d/CentOS*.repo

update your system to latest:

yum update -y

download deploy script:

curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh

fix script permissions:

chmod +x almalinux-deploy.sh

run the script:

bash almalinux-deploy.sh

if an error ocurrs with signatures do the following:

rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux

almalinux8 to almalinux9

rocky8 to rocky9

install rocky-release, rocky-repos, and rocky-gpg-keys:

VERSION=9.5-1.3
REPO_URL="https://download.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/Packages/r"
RELEASE_PKG="rocky-release-${VERSION}.el9.noarch.rpm"
REPOS_PKG="rocky-repos-${VERSION}.el9.noarch.rpm"
GPG_KEYS_PKG="rocky-gpg-keys-${VERSION}.el9.noarch.rpm"
dnf install -y $REPO_URL/$RELEASE_PKG $REPO_URL/$REPOS_PKG $REPO_URL/$GPG_KEYS_PKG

remove unneccesary packages:

dnf -y remove rpmconf yum-utils epel-release
rm -rf /usr/share/redhat-logos

install rocky9 packages:

dnf -y --releasever=9 --allowerasing --setopt=deltarpm=false distro-sync

if upgrade got stock upgrading auditd:

ps aux | grep [a]udit
kill -9 <pid>

when package installation finish recreate rpmdb:

rpm --rebuilddb

reboot system:

reboot

remove all el8 rpms:

rpm -qa|grep el8|xargs rpm -e

remove all modules:

dnf module disable "*" -y

remove all old gpg keys:

rpm -e `rpm -qa | grep gpg-pubkey | xargs`

references