如何将CentOS Linux 6.4/6.3/6.2/6.1/6.0升级到v6.5

时间:2020-01-09 10:44:01  来源:igfitidea点击:

CentOS Linux v6.5已经发布,可以通过Repo获得,可以立即进行更新。
新版本包括针对Linux内核的数百个错误修复和增强功能。
如何从CentOS Linux版本6.0/6.1/6.2/6.3或者6.4升级到最新版本6.5?

您只能从次要版本升级,因为CentOS不支持在任何主要版本的CentOS Linux之间进行就地升级。
但是,可以轻松进行次要升级,并建议所有用户使用。

备份服务器/工作站上的所有重要数据

进行备份在执行备份之前,对系统进行备份有多么重要。
您需要备份配置文件,存储在$HOME,pgsql/msyql/oracle和co数据库中的用户数据以及Web应用程序文件。
简而言之,备份所有数据。
这篇文章中列出的大多数动作是在假设它们将由运行bash或者任何其他现代shell的root用户执行的前提下编写的。

查看您当前的CentOS发行信息

执行以下命令以查看当前版本:

$ uname -mrs
$ cat /etc/redhat-release

输出示例:

CentOS release 6.4 (Final)

显示可用更新列表

要列出具有新版本可用更新的所有软件包,请执行:

# yum clean all
# yum check-update

或者

# yum clean all
# yum list updates

输出示例:

Loaded plugins: downloadonly, fastestmirror, security
Loading mirror speeds from cached hostfile
* base: centos.mirrors.tds.net
* extras: lug.mtu.edu
* updates: yum.singlehop.com
Updated Packages
abrt.x86_64                            2.0.8-21.el6.centos               base   
abrt-addon-ccpp.x86_64                 2.0.8-21.el6.centos               base   
abrt-addon-kerneloops.x86_64           2.0.8-21.el6.centos               base   
abrt-addon-python.x86_64               2.0.8-21.el6.centos               base   
abrt-cli.x86_64                        2.0.8-21.el6.centos               base  
....
..
...
sysvinit-tools.x86_64                  2.87-5.dsf.el6                    base   
udev.x86_64                            147-2.51.el6                      base   
util-linux-ng.x86_64                   2.17.2-12.14.el6                  base   
xmlrpc-c.x86_64                        1.16.24-1210.1840.el6             base   
xmlrpc-c-client.x86_64                 1.16.24-1210.1840.el6             base   
xorg-x11-drv-ati-firmware.noarch       7.1.0-3.el6                       base

注意:升级速度取决于各种因素,例如当前系统负载,上游rpm获取服务器带宽和Internet连接速度。

CentOS Linux:升级当前系统

执行以下yum命令进行升级:

# yum clean all

输出示例:

Loaded plugins: downloadonly, fastestmirror, security
Cleaning repos: base extras updates
Cleaning up Everything
Cleaning up list of fastest mirrors

要更新,请执行:

# yum update

输出示例:

Loaded plugins: downloadonly, fastestmirror, security
Determining fastest mirrors
* base: mirrors.einstein.yu.edu
* extras: mirrors.loosefoot.com
* updates: yum.singlehop.com
base                                                     | 3.7 kB     00:00     
base/primary_db                                          | 4.4 MB     00:01     
extras                                                   | 3.4 kB     00:00     
extras/primary_db                                        |  18 kB     00:00     
updates                                                  | 3.4 kB     00:00     
updates/primary_db                                       |  26 kB     00:00     
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package abrt.x86_64 0:2.0.8-16.el6.centos.1 will be updated
---> Package abrt.x86_64 0:2.0.8-21.el6.centos will be an update
---> Package abrt-addon-ccpp.x86_64 0:2.0.8-16.el6.centos.1 will be updated
---> Package abrt-addon-ccpp.x86_64 0:2.0.8-21.el6.centos will be an updateInstalling for dependencies:
....
..
...
lzo                             x86_64 2.03-3.1.el6              base     55 k
make                            x86_64 1:3.81-20.el6             base    389 k
p11-kit                         x86_64 0.18.5-2.el6              base     94 k
p11-kit-trust                   x86_64 0.18.5-2.el6              base     71 k
shared-mime-info                x86_64 0.70-4.el6                base    209 k
snappy                          x86_64 1.1.0-1.el6               base     39 k
 
Transaction Summary
================================================================================
Install       7 Package(s)
Upgrade     128 Package(s)
 
Total download size: 122 M
Is this ok [y/N]:  y
Downloading Packages:
(1/135): abrt-2.0.8-21.el6.centos.x86_64.rpm             | 208 kB     00:00     
(2/135): abrt-addon-ccpp-2.0.8-21.el6.centos.x86_64.rpm  | 116 kB     00:00     
(3/135): abrt-addon-kerneloops-2.0.8-21.el6.centos.x86_6 |  65 kB     00:00     
(4/135): abrt-addon-python-2.0.8-21.el6.centos.x86_64.rp |  65 kB     00:00     
(5/135): abrt-cli-2.0.8-21.el6.centos.x86_64.rpm         |  54 kB     00:00
....
..
...
  Updating   : openssh-clients-5.3p1-94.el6.x86_64                      107/263 
  Updating   : openssh-server-5.3p1-94.el6.x86_64                       108/263 
warning: /etc/ssh/sshd_config created as /etc/ssh/sshd_config.rpmnew
  Updating   : parted-2.1-21.el6.x86_64                                 109/263 
  Updating   : biosdevname-0.5.0-2.el6.x86_64                           110/263 
  Updating   : libdrm-2.4.45-2.el6.x86_64                               111/263 
...
..
...
  Verifying  : lvm2-2.02.98-9.el6_4.3.x86_64                            262/263 
  Verifying  : efibootmgr-0.5.4-10.el6.x86_64                           263/263 
 
Installed:
  kernel.x86_64 0:2.6.32-431.el6                                                
 
Dependency Installed:
  lzo.x86_64 0:2.03-3.1.el6               make.x86_64 1:3.81-20.el6             
  p11-kit.x86_64 0:0.18.5-2.el6           p11-kit-trust.x86_64 0:0.18.5-2.el6   
  shared-mime-info.x86_64 0:0.70-4.el6    snappy.x86_64 0:1.1.0-1.el6           
 
Updated:
  abrt.x86_64 0:2.0.8-21.el6.centos                                             
  abrt-addon-ccpp.x86_64 0:2.0.8-21.el6.centos                          
....
..
  systemtap-runtime.x86_64 0:2.3-3.el6                                          
  sysvinit-tools.x86_64 0:2.87-5.dsf.el6                                        
  udev.x86_64 0:147-2.51.el6                                                    
  util-linux-ng.x86_64 0:2.17.2-12.14.el6                                       
  xmlrpc-c.x86_64 0:1.16.24-1210.1840.el6                                       
  xmlrpc-c-client.x86_64 0:1.16.24-1210.1840.el6                                
  xorg-x11-drv-ati-firmware.noarch 0:7.1.0-3.el6                                
 
Complete!

(命令输出被截断以适合此页面)

使用以下任何一种方法重新引导Linux服务器:

# reboot

或者

# shutdown -r now

输出示例:

 
Broadcast message from Hyman@db1
	(/dev/pts/0) at 2:20 ...
 
The system is going down for reboot NOW!
[root@db1 Hyman]# Connection to 173.xxx.yyy.zzz closed by remote host.
Connection to 173.xxx.yyy.zz closed.

验证:重新启动服务器后

验证一切正常,并使用以下命令将您升级到最新的CentOS Linux v6.5版本:

# uname -a
# cat /etc/redhat-release

输出示例:
CentOS Linux 6.5 Final

验证打开的端口,并确保您的应用正在运行,并且以下命令没有任何问题:

# netstat -tulpn
# tail -f /var/log/messages
# tail -f /path/to/log/files
# ps aux | less
# ps aux | egrep 'httpd|mysql'
# pgrep 'my_app'

有关更多信息,请参见yum(8)命令手册页。