centos/

Upgrade CentOS Stream 8 to CentOS Stream 9

  1. Update OS
dnf update -y
  1. Reboot system if there were any updates
reboot
  1. Disable CentOS 8-specific modules (they are blocking kernel updates)
dnf module disable python36 virt
  1. Install CentOS 9 repositories. All CentOS 9 packages are listed here
dnf install https://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/Packages/centos-stream-release-9.0-22.el9.noarch.rpm https://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/Packages/centos-gpg-keys-9.0-22.el9.noarch.rpm https://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/Packages/centos-stream-repos-9.0-22.el9.noarch.rpm
  1. Run command to switch packages:
dnf --releasever=9 --allowerasing --setopt=deltarpm=false distro-sync -y
  1. Rebuild RPM database (this will chnage the backend to sqlite):
rpm --rebuilddb
  1. Disable subscription manager. Open file /etc/yum/pluginconf.d/subscription-manager.conf and set enabled to 0

  2. Reboot and verify

cat /etc/redhat-release
  1. Verify that the latest kernel is used (5.14+)
uname -a
  1. If not, use grubby to set the latest kernel as the default one, reboot the system and remove old kernels from CentOS 8:
# List all boot options
grubby --info=ALL

# Reflect the desired kernel in configuration
grubby --set-default vmlinuz-<version>.<arch>

# Make sure the index is also set in `/etc/default/grub` file

# Regenerate boot configuration
grub2-mkconfig -o /boot/grub2/grub.cfg

reboot

# Remove old kernels...

The instructions are inspired by CentOS 8 to CentOS Stream 8 migration guide and Fedora upgrade procedure

| 28 Aug 2023

Migrate from Rocky Linux to CentOS Stream

There is no official guide to migrate from Rocky Linux to CentOS Stream, however, it can be achieved by using official CentOS to CentOS Stream migration guide

  1. Install centos-release-stream package
dnf install https://vault.centos.org/centos/8/extras/x86_64/os/Packages/centos-release-stream-8.1-1.1911.0.7.el8.x86_64.rpm
  1. The next step is to swap Rocky Linux repositories to CentOS Stream ones. This is done with dnf swap centos-{linux,stream}-repos -y command. However, this command will cause multiple conflicts in Rocky Linux. To solve them:
  • copy /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial file from any Centos Stream system into Rocky Linux
  • remove conflicting packages:
    rpm -e --nodeps rocky-repos
    rpm -e --nodeps rocky-release
    
  • complete installing CentOS Stream repositories
    dnf swap centos-{linux,stream}-repos -y
    
  1. Switch to CentOS Stream
dnf distro-sync -y
  1. Verify installation and reboot the server:
cat /etc/centos-release
reboot
| 13 Jul 2022

Kernel panic after update

Traceback example: After update, kernel panic at boot with error: Unable to mount root fs on unknown-block(0,0)

Solution:
  1. Restart your server and on the boot screen select any other boot option with older kernel
  2. (optional, Leaseweb servers) Install missing dependency
sudo dnf install dracut-network
  1. Navigate to /boot and verify that initramfs-file doesn’t exist for the latest kernel version
  2. Generate it
# 4.18.0-338.el8.x86_64 is kernel version
dracut -f /boot/initramfs-4.18.0-338.el8.x86_64.img 4.18.0-338.el8.x86_64
  1. Regenerate grub files
grub2-mkconfig -o /boot/grub2/grub.cfg
  1. Restart
Sources:
| 1 Sep 2021

Connect dedicated servers with cloud servers in hetzner via vSwitch

Main article is provided by Hetzner team here. This article contains instructions for creating vlan interface in Centos 8 using nmcli.

Assumptions (same us in the main article + listed below):

  • VLAN ID is 4001
  • parent network interface is enp195s0

Steps:

  1. Create new connection:
nmcli connection add type vlan con-name vlan4001 ifname vlan4001 vlan.parent enp195s0 vlan.id 4001
  1. Configure the connection:
nmcli connection modify vlan4001 802-3-ethernet.mtu 1400
nmcli connection modify vlan4001 ipv4.addresses '10.0.1.2/24'
nmcli connection modify vlan4001 ipv4.gateway '10.0.1.1'
nmcli connection modify vlan4001 ipv4.dns '10.0.0.4'  # (optional)
nmcli connection modify vlan4001 ipv4.method manual
nmcli connection modify vlan4001 +ipv4.routes "10.0.0.0/16 10.0.1.1"
  1. Restart the connection
nmcli connection down vlan4001
nmcli connection up vlan4001
  1. Verify configuration
# Prints what gateway is used to reach the ip
ip route get 10.0.0.5

# Print all connection information
nmcli connection show vlan4001

# Print routing table
ip r

# Use tui interface for NetworkManager
dnf install NetworkManager-tui
nmtui

Restarting NetworkManager wasn’t enough to apply custom routes. Bring interface up and down

And the link to the great RedHat documentation

| 15 May 2021