Migrer facilement de CentOS à Rocky
Le script que nous allons utiliser se trouve sur le repos GitHub suivant: Rocky Tools.
Avant de l’utiliser on se place à la racine du compte root et on le télécharge :
cd /root
wget https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/centos2rocky.sh
chmod +x centos2rocky.sh
Migration vers Rocky Linux
Le processus de migration est très simple, il suffit de lancer le script :
./centos2rocky.sh
Voici un petit aperçu de la sortie du script dans le cas de notre serveur :
Ensuring rpm and yum are here.
Ensuring your version of CentOS is supported
Finding our modules that are enabled
There are some modules that are unsure of how to handle. This normally shouldn t happen. Do you want to resolve this yourself (Yes) or continue (No)?
1) Yes
2) No
#? 2
~/release ~
warning: rocky-gpg-keys-8.3-13.el8.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID 6d745a60: NOKEY
Verifying... ########################################
Preparing... ########################################
Updating / installing...
rocky-gpg-keys-8.3-13.el8 ########################################
rocky-release-8.3-13.el8 ########################################
rocky-repos-8.3-13.el8 ########################################
Removing dnf cache
Ensuring repos are enabled before the package swap
Rocky Linux 8 - AppStream 8.0 MB/s | 6.7 MB 00:00
Rocky Linux 8 - BaseOS 2.6 MB/s | 2.5 MB 00:00
Rocky Linux 8 - Extras 1.5 kB/s | 1.6 kB 00:01
...
Reinstalling : libXpm-3.5.12-8.el8.x86_64 273/1315
Reinstalling : libXt-1.1.5-12.el8.x86_64 274/1315
Reinstalling : libXmu-1.1.3-1.el8.x86_64 275/1315
Reinstalling : libXrandr-1.5.2-1.el8.x86_64 276/1315
Reinstalling : libXinerama-1.1.4-1.el8.x86_64 277/1315
Reinstalling : libXcursor-1.1.15-3.el8.x86_64 278/1315
Reinstalling : libXdamage-1.1.4-14.el8.x86_64 279/1315
Reinstalling : libXxf86misc-1.0.4-1.el8.x86_64 280/1315
Reinstalling : xorg-x11-server-utils-7.7-27.el8.x86_64 281/1315
Reinstalling : libXcomposite-0.4.4-14.el8.x86_64 282/1315
Reinstalling : libglvnd-glx-1:1.2.0-6.el8.x86_64 283/1315
Reinstalling : mesa-libGL-20.1.4-1.el8.x86_64 284/1315
Reinstalling : libXaw-1.0.13-10.el8.x86_64 285/1315
Reinstalling : libXtst-1.2.3-7.el8.x86_64 286/1315
Reinstalling : libXv-1.0.11-7.el8.x86_64 287/1315
Reinstalling : libXxf86dga-1.1.5-1.el8.x86_64 288/1315
Reinstalling : libdmx-1.1.4-3.el8.x86_64 289/1315
Reinstalling : adobe-mappings-pdf-20180407-1.el8.noarch 290/1315
Downgrading : linux-firmware-20200619-101.git3890db36.el8.no 291/1315
Downgrading : dbus-common-1:1.12.8-12.el8.noarch 292/1315
Reinstalling : cyrus-sasl-lib-2.1.27-5.el8.x86_64 293/1315
Running scriptlet: cyrus-sasl-lib-2.1.27-5.el8.x86_64 293/1315
Reinstalling : platform-python-pip-9.0.3-18.el8.noarch 294/1315
Reinstalling : platform-python-setuptools-39.2.0-6.el8.noarch 295/1315
...
Cleanup : libgcc-8.3.1-5.1.el8.x86_64 1315/1315
Running scriptlet: libgcc-8.3.1-5.1.el8.x86_64 1315/1315
Running scriptlet: filesystem-3.8-3.el8.x86_64 1315/1315
Running scriptlet: glibc-all-langpacks-2.28-127.el8.2.x86_64 1315/1315
Running scriptlet: crypto-policies-scripts-20210209-1.gitbfb6bed. 1315/1315
Running scriptlet: ca-certificates-2020.2.41-80.0.el8_2.noarch 1315/1315
Running scriptlet: kernel-core-4.18.0-240.22.1.el8.x86_64 1315/1315
Failed to add dependency on unit, unit systemd-ask-password-plymouth.service does not exist.
Running scriptlet: libwbclient-4.12.3-14.el8.x86_64 1315/1315
Running scriptlet: kmod-kvdo-6.2.3.114-74.el8.x86_64 1315/1315
Failed to add dependency on unit, unit systemd-ask-password-plymouth.service does not exist.
Failed to add dependency on unit, unit systemd-ask-password-plymouth.service does not exist.
Failed to add dependency on unit, unit systemd-ask-password-plymouth.service does not exist.
Running scriptlet: urw-base35-bookman-fonts-20170801-10.el8.noarc 1315/1315
Running scriptlet: urw-base35-c059-fonts-20170801-10.el8.noarch 1315/1315
Running scriptlet: urw-base35-d050000l-fonts-20170801-10.el8.noar 1315/1315
Running scriptlet: urw-base35-gothic-fonts-20170801-10.el8.noarch 1315/1315
Running scriptlet: urw-base35-nimbus-mono-ps-fonts-20170801-10.el 1315/1315
Running scriptlet: urw-base35-nimbus-roman-fonts-20170801-10.el8. 1315/1315
Running scriptlet: urw-base35-nimbus-sans-fonts-20170801-10.el8.n 1315/1315
Running scriptlet: urw-base35-p052-fonts-20170801-10.el8.noarch 1315/1315
Running scriptlet: urw-base35-standard-symbols-ps-fonts-20170801- 1315/1315
Running scriptlet: urw-base35-z003-fonts-20170801-10.el8.noarch 1315/1315
Running scriptlet: authselect-libs-1.2.1-2.el8.x86_64 1315/1315
Running scriptlet: httpd-2.4.37-30.module+el8.3.0+124+cde66633.x8 1315/1315
Running scriptlet: rocky-logos-83.0-3.el8.x86_64 1315/1315
Running scriptlet: sssd-common-2.3.0-9.el8.x86_64 1315/1315
Running scriptlet: tuned-2.14.0-3.el8.2.noarch 1315/1315
Running scriptlet: microcode_ctl-4:20200609-2.20210216.1.el8.x86_ 1315/1315
...
xfsprogs-5.0.0-4.el8.x86_64
xkeyboard-config-2.28-1.el8.noarch
xmlsec1-1.2.25-4.el8.x86_64
xmlsec1-openssl-1.2.25-4.el8.x86_64
xorg-x11-font-utils-1:7.5-40.el8.x86_64
xorg-x11-fonts-ISO8859-1-100dpi-7.5-19.el8.noarch
xorg-x11-server-utils-7.7-27.el8.x86_64
xorg-x11-utils-7.5-28.el8.x86_64
xz-5.2.4-3.el8.x86_64
xz-libs-5.2.4-3.el8.x86_64
yum-4.2.23-4.el8.noarch
zip-3.0-23.el8.x86_64
Complete!
~
Generating grub configuration file ...
Adding boot menu entry for EFI firmware configuration
done
Last metadata expiration check: 0:02:28 ago on Wed 26 May 2021 05:02:34 PM CEST.
Unable to resolve argument
Error: Problems in request:
missing groups or modules:
On constate que le script se termine sur une erreur. Voyons ce qu’on trouve après le redémarrage de notre serveur:
au démarrage on constate une entrée supplémentaire dans notre grub (on choisira bien sur l'entrée Rocky Linux)
Vérifications post migration
Quand nous étions sous CentOS nous avions déployé un site web WordPress vérifions donc si les services sont toujours fonctionnels, si la configuration du pare-feu est toujours bonne, et surtout si notre site est toujours accessible/fonctionnel.
- Vérification de nos services:
On commence par regarder si nos services sont bien démarrés
# Apache
systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/httpd.service.d
└─php-fpm.conf
Active: active (running) since Wed 2021-05-26 17:06:17 CEST; 24min ago
Docs: man:httpd.service(8)
Main PID: 1071 (httpd)
Status: "Running, listening on: port 80"
Tasks: 213 (limit: 12107)
Memory: 29.8M
CGroup: /system.slice/httpd.service
├─1071 /usr/sbin/httpd -DFOREGROUND
├─1147 /usr/sbin/httpd -DFOREGROUND
├─1148 /usr/sbin/httpd -DFOREGROUND
├─1157 /usr/sbin/httpd -DFOREGROUND
└─1159 /usr/sbin/httpd -DFOREGROUND
mai 26 17:06:16 centos8.local systemd[1]: Starting The Apache HTTP Server...
mai 26 17:06:17 centos8.local httpd[1071]: AH00558: httpd: Could not reliably determine the server s fully qualified domain name,>
mai 26 17:06:17 centos8.local systemd[1]: Started The Apache HTTP Server.
mai 26 17:06:17 centos8.local httpd[1071]: Server configured, listening on: port 80
# Mariadb
systemctl status mariadb
● mariadb.service - MariaDB 10.3 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2021-05-26 17:06:18 CEST; 24min ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 1467 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)
Process: 1118 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mariadb.service (code=exited, status=0/SUCCESS)
Process: 1073 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
Main PID: 1379 (mysqld)
Status: "Taking your SQL requests now..."
Tasks: 30 (limit: 12107)
Memory: 107.0M
CGroup: /system.slice/mariadb.service
└─1379 /usr/libexec/mysqld --basedir=/usr
mai 26 17:06:16 centos8.local systemd[1]: Starting MariaDB 10.3 database server...
mai 26 17:06:17 centos8.local mysql-prepare-db-dir[1118]: Database MariaDB is probably initialized in /var/lib/mysql already, not>
mai 26 17:06:17 centos8.local mysql-prepare-db-dir[1118]: If this is not the case, make sure the /var/lib/mysql is empty before r>
mai 26 17:06:17 centos8.local mysqld[1379]: 2021-05-26 17:06:17 0 [Note] /usr/libexec/mysqld (mysqld 10.3.28-MariaDB) starting as>
mai 26 17:06:18 centos8.local systemd[1]: Started MariaDB 10.3 database server.
# php-fpm
systemctl status php-fpm
● php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2021-05-26 17:06:17 CEST; 24min ago
Main PID: 1068 (php-fpm)
Status: "Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0req/sec"
Tasks: 6 (limit: 12107)
Memory: 33.8M
CGroup: /system.slice/php-fpm.service
├─1068 php-fpm: master process (/etc/php-fpm.conf)
├─1132 php-fpm: pool www
├─1133 php-fpm: pool www
├─1134 php-fpm: pool www
├─1135 php-fpm: pool www
└─1136 php-fpm: pool www
mai 26 17:06:16 centos8.local systemd[1]: Starting The PHP FastCGI Process Manager...
mai 26 17:06:17 centos8.local systemd[1]: Started The PHP FastCGI Process Manager.
On peut donc constater que nos services ont bien été migré et sont toujours démarrés correctement suite au redémarrage de notre serveur.
- Vérification de la configuration du pare-feu
firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens32
sources:
services: cockpit dhcpv6-client http ssh
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
Ici aussi on constate que notre firewall a bien conservé la configuration que nous avions réalisée sur la machine CentOS.
Conclusion
Comme nous avons pu le voir au cours de ccette page, et malgré quelques erreurs remontées par le script de migration, nous avons donc réussi à passer de CentOS 8 à Rocky Linux sans réinstaller tout le système ou installer un nouveau serveur.
Nous pouvons dire que nous avons là une solution élégante et simple pour migrer rapidement des serveurs sous centos8 vers un OS ayant un support plus étendu dans la durée.
No Comments