GNU/Linux >> Tutoriels Linux >  >> Cent OS

Comment mettre à niveau CentOS 7 vers CentOS 8

Présentation

Dans ce guide didacticiel, vous apprendrez à mettre à niveau votre serveur Linux de CentOS 7 à CentOS 8.

Suivez simplement ces étapes :

Installer le référentiel EPEL

Vous devez installer l'EPL référentiel avec la commande suivante :

[root@unixcop ~]# yum install epel-release -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.mirror.ndchost.com
 * epel: mirror.prgmr.com
 * extras: mirrors.raystedman.org
 * updates: mirror.sjc02.svwh.net
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be updated
---> Package epel-release.noarch 0:7-13 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
 Package                                  Arch                               Version                           Repository                        Size
======================================================================================================================================================
Updating:
 epel-release                             noarch                             7-13                              epel                              15 k

Transaction Summary
======================================================================================================================================================
Upgrade  1 Package

Total download size: 15 k
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
warning: /var/cache/yum/x86_64/7/epel/packages/epel-release-7-13.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Public key for epel-release-7-13.noarch.rpm is not installed
epel-release-7-13.noarch.rpm                                                                                                   |  15 kB  00:00:00     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Importing GPG key 0x352C64E5:
 Userid     : "Fedora EPEL (7) <[email protected]>"
 Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
 Package    : epel-release-7-11.noarch (@extras)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : epel-release-7-13.noarch                                                                                                           1/2 
  Cleanup    : epel-release-7-11.noarch                                                                                                           2/2 
  Verifying  : epel-release-7-13.noarch                                                                                                           1/2 
  Verifying  : epel-release-7-11.noarch                                                                                                           2/2 

Updated:
  epel-release.noarch 0:7-13                                                                                                                          

Complete!
[root@unixcop ~]#

Installer les outils yum-utils

Installez donc yum-utils avec la commande :

[root@unixcop ~]# yum install yum-utils -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.san.fastserv.com
 * epel: mirror.sfo12.us.leaseweb.net
 * extras: mirrors.raystedman.org
 * updates: mirror.sjc02.svwh.net
Resolving Dependencies
--> Running transaction check
---> Package yum-utils.noarch 0:1.1.31-54.el7_8 will be installed
--> Processing Dependency: python-kitchen for package: yum-utils-1.1.31-54.el7_8.noarch
--> Processing Dependency: libxml2-python for package: yum-utils-1.1.31-54.el7_8.noarch
--> Running transaction check
---> Package libxml2-python.x86_64 0:2.9.1-6.el7.5 will be installed
---> Package python-kitchen.noarch 0:1.1.1-5.el7 will be installed
--> Processing Dependency: python-chardet for package: python-kitchen-1.1.1-5.el7.noarch
--> Running transaction check
---> Package python-chardet.noarch 0:2.2.1-3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
 Package                                 Arch                            Version                                  Repository                     Size
======================================================================================================================================================
Installing:
 yum-utils                               noarch                          1.1.31-54.el7_8                          base                          122 k
Installing for dependencies:
 libxml2-python                          x86_64                          2.9.1-6.el7.5                            base                          247 k
 python-chardet                          noarch                          2.2.1-3.el7                              base                          227 k
 python-kitchen                          noarch                          1.1.1-5.el7                              base                          267 k

Transaction Summary
======================================================================================================================================================
Install  1 Package (+3 Dependent packages)

Total download size: 863 k
Installed size: 4.3 M
Downloading packages:
(1/4): python-chardet-2.2.1-3.el7.noarch.rpm                                                                                   | 227 kB  00:00:00     
(2/4): libxml2-python-2.9.1-6.el7.5.x86_64.rpm                                                                                 | 247 kB  00:00:00     
(3/4): yum-utils-1.1.31-54.el7_8.noarch.rpm                                                                                    | 122 kB  00:00:00     
(4/4): python-kitchen-1.1.1-5.el7.noarch.rpm                                                                                   | 267 kB  00:00:00     
------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                 1.1 MB/s | 863 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python-chardet-2.2.1-3.el7.noarch                                                                                                  1/4 
  Installing : python-kitchen-1.1.1-5.el7.noarch                                                                                                  2/4 
  Installing : libxml2-python-2.9.1-6.el7.5.x86_64                                                                                                3/4 
  Installing : yum-utils-1.1.31-54.el7_8.noarch                                                                                                   4/4 
  Verifying  : libxml2-python-2.9.1-6.el7.5.x86_64                                                                                                1/4 
  Verifying  : python-kitchen-1.1.1-5.el7.noarch                                                                                                  2/4 
  Verifying  : yum-utils-1.1.31-54.el7_8.noarch                                                                                                   3/4 
  Verifying  : python-chardet-2.2.1-3.el7.noarch                                                                                                  4/4 

Installed:
  yum-utils.noarch 0:1.1.31-54.el7_8                                                                                                                  

Dependency Installed:
  libxml2-python.x86_64 0:2.9.1-6.el7.5              python-chardet.noarch 0:2.2.1-3.el7              python-kitchen.noarch 0:1.1.1-5.el7             

Complete!
[root@unixcop ~]#

Vous devez maintenant résoudre les packages RPM avec les commandes ci-dessous :

Installez d'abord rpmconf

# yum install rpmconf

Résolvez ensuite les packs RPM avec :

[root@unixcop ~]# rpmconf -a
Configuration file 'https://1118798822.rsc.cdn77.org/etc/nsswitch.conf'
-rw-r--r--. 1 root root 1938 Apr 28 09:31 /etc/nsswitch.conf.rpmnew
-rw-r--r--. 1 root root 1746 Aug 20 07:14 /etc/nsswitch.conf

 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      M     : merge configuration files
      Z     : background this process to examine the situation
      S     : skip this file
 The default action is to keep your current version.
*** aliases (Y/I/N/O/D/M/Z/S) [default=N] ? 
Your choice: N
[root@unixcop ~]#

Donc L'action par défaut qui N est de conserver la version du responsable du paquet.

Ensuite, effectuez un nettoyage de tous les packages dont vous n'avez pas besoin avec les commandes suivantes :

[root@unixcop ~]# package-cleanup --leaves
Loaded plugins: fastestmirror
bind-libs-lite-9.11.4-26.P2.el7_9.5.x86_64
libsysfs-2.1.0-16.el7.x86_64
[root@unixcop ~]# 
[root@unixcop ~]# package-cleanup --orphans
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.mirror.ndchost.com
 * epel: mirror.sfo12.us.leaseweb.net
 * extras: mirrors.raystedman.org
 * updates: mirror.sjc02.svwh.net
kernel-3.10.0-957.el7.x86_64
[root@unixcop ~]#

Installer le dnf dans CentOS 7

DNF est le gestionnaire de packages par défaut dans CentOS 8. Installez-le avec la commande :

# yum install dnf

Supprimez maintenant le gestionnaire de packages yum avec les commandes ci-dessous :

[root@unixcop ~]# dnf remove yum yum-metadata-parser -y
Dependencies resolved.
======================================================================================================================================================
 Package                                      Arch                       Version                                    Repository                   Size
======================================================================================================================================================
Removing:
 yum                                          noarch                     3.4.3-168.el7.centos                       @System                     5.6 M
 yum-metadata-parser                          x86_64                     1.1.4-10.el7                               @System                      57 k
Removing dependent packages:
 yum-plugin-fastestmirror                     noarch                     1.1.31-54.el7_8                            @System                      53 k
 yum-utils                                    noarch                     1.1.31-54.el7_8                            @System                     337 k

Transaction Summary
======================================================================================================================================================
Remove  4 Packages

Freed space: 6.0 M
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                              1/1 
  Erasing          : yum-utils-1.1.31-54.el7_8.noarch                                                                                             1/4 
  Erasing          : yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch                                                                              2/4 
  Erasing          : yum-3.4.3-168.el7.centos.noarch                                                                                              3/4 
  Erasing          : yum-metadata-parser-1.1.4-10.el7.x86_64                                                                                      4/4 
  Verifying        : yum-3.4.3-168.el7.centos.noarch                                                                                              1/4 
  Verifying        : yum-metadata-parser-1.1.4-10.el7.x86_64                                                                                      2/4 
  Verifying        : yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch                                                                              3/4 
  Verifying        : yum-utils-1.1.31-54.el7_8.noarch                                                                                             4/4 

Removed:
  yum-3.4.3-168.el7.centos.noarch           yum-metadata-parser-1.1.4-10.el7.x86_64          yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch         
  yum-utils-1.1.31-54.el7_8.noarch         

Complete!
[root@unixcop ~]#
# rm -Rf /etc/yum

Mettre à niveau CentOS 7 vers CentOS 8

Tout d'abord, mettez à niveau le gestionnaire de packages dnf avec la commande :

# dnf upgrade

Ensuite, installez le package de version CentOS 8 en utilisant dnf avec la commande ci-dessous :

[root@unixcop ~]# dnf install http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/{centos-linux-repos-8-2.el8.noarch.rpm,centos-gpg-keys-8-2.el8.noarch.rpm,centos-linux-release-8.4-1.2105.el8.noarch.rpm} -y
Last metadata expiration check: 0:03:39 ago on Tue 24 Aug 2021 07:24:11 AM EDT.
centos-linux-repos-8-2.el8.noarch.rpm                                                                                  72 kB/s |  20 kB     00:00    
centos-gpg-keys-8-2.el8.noarch.rpm                                                                                     68 kB/s |  12 kB     00:00    
centos-linux-release-8.4-1.2105.el8.noarch.rpm                                                                        266 kB/s |  22 kB     00:00    
Dependencies resolved.
======================================================================================================================================================
 Package                                   Arch                        Version                                Repository                         Size
======================================================================================================================================================
Installing:
 centos-linux-repos                        noarch                      8-2.el8                                @commandline                       20 k
 centos-gpg-keys                           noarch                      1:8-2.el8                              @commandline                       12 k
 centos-linux-release                      noarch                      8.4-1.2105.el8                         @commandline                       22 k
     replacing  centos-release.x86_64 7-9.2009.1.el7.centos

Transaction Summary
======================================================================================================================================================
Install  3 Packages

Total size: 53 k
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                              1/1 
  Installing       : centos-gpg-keys-1:8-2.el8.noarch                                                                                             1/4 
  Installing       : centos-linux-release-8.4-1.2105.el8.noarch                                                                                   2/4 
  Installing       : centos-linux-repos-8-2.el8.noarch                                                                                            3/4 
  Obsoleting       : centos-release-7-9.2009.1.el7.centos.x86_64                                                                                  4/4 
warning: file /etc/yum/vars/infra: remove failed: No such file or directory
warning: file /etc/yum/vars/contentdir: remove failed: No such file or directory

  Verifying        : centos-linux-repos-8-2.el8.noarch                                                                                            1/4 
  Verifying        : centos-gpg-keys-1:8-2.el8.noarch                                                                                             2/4 
  Verifying        : centos-linux-release-8.4-1.2105.el8.noarch                                                                                   3/4 
  Verifying        : centos-release-7-9.2009.1.el7.centos.x86_64                                                                                  4/4 

Installed:
  centos-linux-repos-8-2.el8.noarch              centos-gpg-keys-1:8-2.el8.noarch              centos-linux-release-8.4-1.2105.el8.noarch             

Complete!
[root@unixcop ~]#

Ensuite, mettez à niveau le référentiel EPEL comme suit :

[root@unixcop ~]# dnf upgrade https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y
Extra Packages for Enterprise Linux 7 - x86_64                                                                         14 MB/s |  17 MB     00:01    
CentOS Linux 8 - BaseOS                                                                                               7.2 MB/s | 5.6 MB     00:00    
CentOS Linux 8 - AppStream                                                                                             39 MB/s | 8.8 MB     00:00    
CentOS Linux 8 - Extras                                                                                               141 kB/s |  10 kB     00:00    
epel-release-latest-8.noarch.rpm                                                                                       60 kB/s |  23 kB     00:00    
Dependencies resolved.
======================================================================================================================================================
 Package                               Arch                            Version                            Repository                             Size
======================================================================================================================================================
Upgrading:
 epel-release                          noarch                          8-11.el8                           @commandline                           23 k

Transaction Summary
======================================================================================================================================================
Upgrade  1 Package

Total size: 23 k
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                              1/1 
  Upgrading        : epel-release-8-11.el8.noarch                                                                                                 1/2 
  Cleanup          : epel-release-7-13.noarch                                                                                                     2/2 
  Verifying        : epel-release-8-11.el8.noarch                                                                                                 1/2 
  Verifying        : epel-release-7-13.noarch                                                                                                     2/2 

Upgraded:
  epel-release-8-11.el8.noarch                                                                                                                        

Complete!
[root@unixcop ~]#

Maintenant, supprimez tous les fichiers temporaires avec la commande suivante :

[root@unixcop ~]# dnf clean all
55 files removed
[root@unixcop ~]#

Supprimez l'ancien noyau du noyau CentOS 7 avec la commande :

# rpm -e `rpm -q kernel`

Vous devez également supprimer tous les packages en conflit avec la commande ci-dessous :

# rpm -e --nodeps sysvinit-tools

Lancez la mise à niveau du système CentOS 8 comme indiqué ci-dessous :

[root@unixcop ~]# dnf --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync -y
Extra Packages for Enterprise Linux 8 - x86_64                                                                        8.2 MB/s |  10 MB     00:01    
CentOS Linux 8 - BaseOS                                                                                               7.2 MB/s | 5.6 MB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64                                                                5.1 MB/s | 931 kB     00:00    
CentOS Linux 8 - AppStream                                                                                             38 MB/s | 8.8 MB     00:00    
CentOS Linux 8 - Extras                                                                                               166 kB/s |  10 kB     00:00    
Dependencies resolved.
.......
...

Installer le nouveau noyau du noyau pour CentOS 8

Pour installer un nouveau noyau pour CentOS 8 , utilisez cette commande ci-dessous :

# dnf install kernel-core -y

REMARQUE :

Vous pouvez avoir des problèmes avec la commande ci-dessus, c'est un problème :requêtes conflictuelles aux packages

Vous pouvez donc ajouter ces options à la commande pour résoudre ce problème :

# dnf install kernel-core -y --allowerasing --skip-broken
  • Le – permettre d'effacer option pour remplacer les packages en conflit.
  • Le –casse-saut option pour ignorer les packages désinstallables.

Installer les packages minimaux CentOS 8

Vous êtes maintenant prêt à installer le package minimal CentOS 8, vous pouvez le faire en exécutant la commande ci-dessous :

# dnf groupupdate "Core" "Minimal Install" -y

REMARQUE :

De plus, si vous rencontrez le même problème ci-dessus, vous pouvez utiliser cette commande pour résoudre le problème :

# dnf groupupdate "Core" "Minimal Install" -y --allowerasing --skip-broken

La tâche de mise à niveau de CentOS 7 vers CentOS 8 est donc terminée !

Vous pouvez maintenant vérifier la version de CentOS avec :

[root@unixcop ~]# cat /etc/redhat-release
CentOS Linux release 8.4.2105
[root@unixcop ~]#

Conclusion

Donc, cet article vous montre comment vous pouvez mettre à niveau depuis CentOS 7 vers CentOS 8 .


Cent OS
  1. Comment mettre à jour la version de Git>=1.7.10 sur CentOS 6

  2. Comment mettre à niveau CentOS 6.10 à partir de CentOS 6.9-6.0

  3. Comment mettre à niveau CentOS 7.8 à partir de CentOS 7.7-7.0

  4. Comment mettre à niveau OpenSSL v1.0.1e vers v1.0.2 sur CentOS/RHEL

  5. Comment installer tar.gz dans CentOS

Comment mettre à niveau des packages individuels dans CentOS

Comment mettre à jour Docker sur CentOS

Comment mettre à niveau CentOS 7 vers Rocky Linux 8

Comment installer les packages RPM sur CentOS 8

Comment mettre à niveau le noyau sur CentOS 8.0

Comment mettre à niveau CentOS 7 vers CentOS 8 Linux