欢迎光临
我们一直在努力

CentOS6.x升级到7

1、查看当前CentOS版本

[root@yingguo ~]# cat /etc/redhat-release
CentOS release 6.10 (Final)
[root@yingguo ~]#

2、更新源

[root@yingguo ~]# cat /etc/redhat-release
CentOS release 6.10 (Final)
[root@yingguo ~]# cat /etc/yum.repos.d/upgrade.repo
[upgrade]
name=upgrade
baseurl=https://buildlogs.centos.org/centos/6/upg/x86_64/
enable=1
gpgcheck=0

3、卸载6.x自带的较新的助手,并安装老版[否则会报错]

yum erase openscap -y

[root@yingguo ~]# yum erase openscap
Loaded plugins: aliases, changelog, fastestmirror, kabi, presto, refresh-packagekit, security, tmprepo, verify, versionlock
Loading support for CentOS kernel ABI
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package openscap.x86_64 0:1.2.13-2.el6 will be erased
--> Processing Dependency: libopenscap.so.8()(64bit) for package: openscap-scanner-1.2.13-2.el6.x86_64
--> Processing Dependency: openscap = 1.2.13-2.el6 for package: openscap-utils-1.2.13-2.el6.x86_64
--> Processing Dependency: openscap(x86-64) = 1.2.13-2.el6 for package: openscap-scanner-1.2.13-2.el6.x86_64
--> Running transaction check
---> Package openscap-scanner.x86_64 0:1.2.13-2.el6 will be erased
--> Processing Dependency: openscap-scanner >= 1.0.10-2 for package: scap-security-guide-0.1.28-4.el6.noarch
---> Package openscap-utils.x86_64 0:1.2.13-2.el6 will be erased
--> Running transaction check
---> Package scap-security-guide.noarch 0:0.1.28-4.el6 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================================================================================
 Package                                         Arch                               Version                                    Repository                         Size
=======================================================================================================================================================================
Removing:
 openscap                                        x86_64                             1.2.13-2.el6                               @base                              56 M
Removing for dependencies:
 openscap-scanner                                x86_64                             1.2.13-2.el6                               @base                             114 k
 openscap-utils                                  x86_64                             1.2.13-2.el6                               @base                              37 k
 scap-security-guide                             noarch                             0.1.28-4.el6                               @base                              13 M

Transaction Summary
=======================================================================================================================================================================
Remove        4 Package(s)

Installed size: 69 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing    : openscap-utils-1.2.13-2.el6.x86_64                                                                                                                  1/4
  Erasing    : scap-security-guide-0.1.28-4.el6.noarch                                                                                                             2/4
  Erasing    : openscap-scanner-1.2.13-2.el6.x86_64                                                                                                                3/4
  Erasing    : openscap-1.2.13-2.el6.x86_64                                                                                                                        4/4
Unable to connect to dbus
  Verifying  : openscap-scanner-1.2.13-2.el6.x86_64                                                                                                                1/4
  Verifying  : openscap-1.2.13-2.el6.x86_64                                                                                                                        2/4
  Verifying  : scap-security-guide-0.1.28-4.el6.noarch                                                                                                             3/4
  Verifying  : openscap-utils-1.2.13-2.el6.x86_64                                                                                                                  4/4
Removed:
  openscap.x86_64 0:1.2.13-2.el6

Dependency Removed:
  openscap-scanner.x86_64 0:1.2.13-2.el6                 openscap-utils.x86_64 0:1.2.13-2.el6                 scap-security-guide.noarch 0:0.1.28-4.el6

Complete!
[root@yingguo ~]#

yum install http://dev.centos.org/centos/6/upg/x86_64/Packages/openscap-1.0.8-1.0.1.el6.centos.x86_64.rpm -y

[root@yingguo ~]# yum install https://buildlogs.centos.org/centos/6/upg/x86_64/Packages/openscap-1.0.8-1.0.1.el6.centos.x86_64.rpm
Loaded plugins: aliases, changelog, fastestmirror, kabi, presto, refresh-packagekit, security, tmprepo, verify, versionlock
Loading support for CentOS kernel ABI
Setting up Install Process
openscap-1.0.8-1.0.1.el6.centos.x86_64.rpm                                                                                                      | 2.9 MB     00:09
Examining /var/tmp/yum-root-Jy5Iqv/openscap-1.0.8-1.0.1.el6.centos.x86_64.rpm: openscap-1.0.8-1.0.1.el6.centos.x86_64
Marking /var/tmp/yum-root-Jy5Iqv/openscap-1.0.8-1.0.1.el6.centos.x86_64.rpm to be installed
Loading mirror speeds from cached hostfile
upgrade                                                                                                                                         | 1.9 kB     00:00
upgrade/primary_db                                                                                                                              |  14 kB     00:00
Resolving Dependencies
--> Running transaction check
---> Package openscap.x86_64 0:1.0.8-1.0.1.el6.centos will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================================================================================
 Package                      Arch                       Version                                     Repository                                                   Size
=======================================================================================================================================================================
Installing:
 openscap                     x86_64                     1.0.8-1.0.1.el6.centos                      /openscap-1.0.8-1.0.1.el6.centos.x86_64                      42 M

Transaction Summary
=======================================================================================================================================================================
Install       1 Package(s)

Total size: 42 M
Installed size: 42 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : openscap-1.0.8-1.0.1.el6.centos.x86_64                                                                                                              1/1
Unable to connect to dbus
  Verifying  : openscap-1.0.8-1.0.1.el6.centos.x86_64                                                                                                              1/1

Installed:
  openscap.x86_64 0:1.0.8-1.0.1.el6.centos

Complete!
[root@yingguo ~]#

4、安装助手

yum install redhat-upgrade-tool preupgrade-assistant-contents -y

[root@yingguo ~]# yum install redhat-upgrade-tool preupgrade-assistant-contents
Loaded plugins: aliases, changelog, fastestmirror, kabi, presto, refresh-packagekit, security, tmprepo, verify, versionlock
Loading support for CentOS kernel ABI
Setting up Install Process
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package preupgrade-assistant-contents.noarch 0:0.5.14-1.el6.centos will be installed
--> Processing Dependency: preupgrade-assistant(x86-64) >= 1.0.2-14 for package: preupgrade-assistant-contents-0.5.14-1.el6.centos.noarch
---> Package redhat-upgrade-tool.noarch 1:0.7.22-3.el6.centos will be installed
--> Running transaction check
---> Package preupgrade-assistant.x86_64 0:1.0.2-36.0.1.el6.centos will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================================================================================
 Package                                             Arch                         Version                                          Repository                     Size
=======================================================================================================================================================================
Installing:
 preupgrade-assistant-contents                       noarch                       0.5.14-1.el6.centos                              upgrade                       917 k
 redhat-upgrade-tool                                 noarch                       1:0.7.22-3.el6.centos                            upgrade                        85 k
Installing for dependencies:
 preupgrade-assistant                                x86_64                       1.0.2-36.0.1.el6.centos                          upgrade                       439 k

Transaction Summary
=======================================================================================================================================================================
Install       3 Package(s)

Total download size: 1.4 M
Installed size: 6.5 M
Is this ok [y/N]: y
Downloading Packages:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 1.4 M
(1/3): preupgrade-assistant-1.0.2-36.0.1.el6.centos.x86_64.rpm                                                                                  | 439 kB     00:01
(2/3): preupgrade-assistant-contents-0.5.14-1.el6.centos.noarch.rpm                                                                             | 917 kB     00:00
(3/3): redhat-upgrade-tool-0.7.22-3.el6.centos.noarch.rpm                                                                                       |  85 kB     00:00
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                  256 kB/s | 1.4 MB     00:05
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : preupgrade-assistant-1.0.2-36.0.1.el6.centos.x86_64                                                                                                 1/3
  Installing : 1:redhat-upgrade-tool-0.7.22-3.el6.centos.noarch                                                                                                    2/3
  Installing : preupgrade-assistant-contents-0.5.14-1.el6.centos.noarch                                                                                            3/3
Unable to connect to dbus
  Verifying  : preupgrade-assistant-1.0.2-36.0.1.el6.centos.x86_64                                                                                                 1/3
  Verifying  : 1:redhat-upgrade-tool-0.7.22-3.el6.centos.noarch                                                                                                    2/3
  Verifying  : preupgrade-assistant-contents-0.5.14-1.el6.centos.noarch                                                                                            3/3

Installed:
  preupgrade-assistant-contents.noarch 0:0.5.14-1.el6.centos                              redhat-upgrade-tool.noarch 1:0.7.22-3.el6.centos

Dependency Installed:
  preupgrade-assistant.x86_64 0:1.0.2-36.0.1.el6.centos

Complete!
[root@yingguo ~]# preupg -s CentOS6_7

5、检测版本升级的风险,如果控制台输出了错误信息,则需要查询下解决方案并解决

preupg -s CentOS6_7

[root@yingguo ~]# preupg -s CentOS6_7
Preupg tool doesn't do the actual upgrade.
Please ensure you have backed up your system and/or data in the event of a failed upgrade
 that would require a full re-install of the system from installation media.
Do you want to continue? y/n
y
Gathering logs used by preupgrade assistant:
All installed packages : 01/11 ...finished (time 00:02s)
All changed files      : 02/11 ...finished (time 19:23s)
Changed config files   : 03/11 ...finished (time 00:00s)
All users              : 04/11 ...finished (time 00:00s)
All groups             : 05/11 ...finished (time 00:00s)
Service statuses       : 06/11 ...finished (time 00:00s)
All installed files    : 07/11 ...finished (time 00:09s)
All local files        : 08/11 ...finished (time 00:24s)
All executable files   : 09/11 ...finished (time 00:04s)
RedHat signed packages : 10/11 ...finished (time 00:00s)
CentOS signed packages : 11/11 ...finished (time 00:00s)
Assessment of the system, running checks / SCE scripts:
001/096 ...done    (Configuration Files to Review)
002/096 ...done    (File Lists for Manual Migration)
003/096 ...done    (Bacula Backup Software)
004/096 ...done    (MySQL configuration)
005/096 ...done    (Migration of the MySQL data stack)
006/096 ...done    (Changes related to moving from MySQL to MariaDB)
007/096 ...done    (PostgreSQL upgrade content)
008/096 ...done    (GNOME Desktop Environment underwent several design modifications in CentOS 7 release)
009/096 ...done    (KDE Desktop Environment underwent several design modifications in CentOS 7 release)
010/096 ...done    (several graphic drivers not supported in CentOS 7)
011/096 ...done    (several input drivers not supported in CentOS 7)
012/096 ...done    (several kernel networking drivers not available in CentOS 7)
013/096 ...done    (several kernel storage drivers not available in CentOS 7)
014/096 ...done    (Names, Options and Output Format Changes in arptables)
015/096 ...done    (BIND9 running in a chroot environment check.)
016/096 ...done    (BIND9 configuration compatibility check)
017/096 ...done    (Move dhcpd/dhcprelay arguments from /etc/sysconfig/* to *.service files)
018/096 ...done    (DNSMASQ configuration compatibility check)
019/096 ...done    (Dovecot configuration compatibility check)
020/096 ...done    (Compatibility Between iptables and ip6tables)
021/096 ...done    (Net-SNMP check)
022/096 ...done    (Squid configuration compatibility check)
023/096 ...done    (Reusable Configuration Files)
024/096 ...done    (VCS repositories)
025/096 ...done    (Added and extended options for BIND9 configuration)
026/096 ...done    (Added options in DNSMASQ configuration)
027/096 ...done    (Packages not signed by CentOS)
028/096 ...done    (Obsoleted rpms)
029/096 ...done    (w3m not available in CentOS 7)
030/096 ...done    (report incompatibilities between CentOS 6 and 7 in qemu-guest-agent package)
031/096 ...done    (Removed options in coreutils binaries)
032/096 ...done    (Removed options in gawk binaries)
033/096 ...done    (Removed options in netstat binary)
034/096 ...done    (Removed options in quota tools)
035/096 ...done    (Removed rpms)
036/096 ...done    (Replaced rpms)
037/096 ...done    (GMP library incompatibilities)
038/096 ...done    (package downgrades)
039/096 ...done    (restore custom selinux configuration)
040/096 ...done    (General)
041/096 ...done    (samba shared directories selinux)
042/096 ...done    (CUPS Browsing/BrowsePoll configuration)
043/096 ...done    (CVS Package Split)
044/096 ...done    (FreeRADIUS Upgrade Verification)
045/096 ...done    (httpd configuration compatibility check)
046/096 ...done    (bind-dyndb-ldap)
047/096 ...done    (Identity Management Server compatibility check)
048/096 ...done    (IPA Server CA Verification)
049/096 ...done    (NTP configuration)
050/096 ...done    (Information on time-sync.target)
051/096 ...done    (OpenLDAP /etc/sysconfig and data compatibility)
052/096 ...done    (OpenSSH sshd_config migration content)
053/096 ...done    (OpenSSH sysconfig migration content)
054/096 ...done    (Configuration for quota_nld service)
055/096 ...done    (Disk quota netlink message daemon moved into quota-nld package)
056/096 ...done    (SSSD compatibility check)
057/096 ...done    (Luks encrypted partition)
058/096 ...done    (Clvmd and cmirrord daemon management.)
059/096 ...done    (State of LVM2 services.)
060/096 ...done    (device-mapper-multipath configuration compatibility check)
061/096 ...done    (Removal of scsi-target-utils)
062/096 ...done    (Configuration for warnquota tool)
063/096 ...done    (Disk quota tool warnquota moved into quota-warnquota package)
064/096 ...done    (Architecture Support)
065/096 ...done    (Binary rebuilds)
066/096 ...done    (Debuginfo packages)
067/096 ...done    (Cluster and High Availability)
068/096 ...done    (Quorum implementation)
069/096 ...done    (fix krb5kdc config file)
070/096 ...done    (File Systems, Partitions and Mounts Configuration Review)
071/096 ...done    (Read Only FHS directories)
072/096 ...done    (Sonamebumped libs)
073/096 ...done    (SonameKept Reusable Dynamic Libraries)
074/096 ...done    (Removed .so libs)
075/096 ...done    (In-place Upgrade Requirements for the /usr/ Directory)
076/096 ...done    (CA certificate bundles modified)
077/096 ...done    (Developer Tool Set packages)
078/096 ...done    (Hyper-V)
079/096 ...done    (Content for enabling and disabling services based on CentOS 6 system)
080/096 ...done    (Check for ethernet interface naming)
081/096 ...done    (User modification in /etc/rc.local and /etc/rc.d/rc.local)
082/096 ...done    (cgroups configuration compatibility check)
083/096 ...done    (Plugable authentication modules (PAM))
084/096 ...done    (Foreign Perl modules)
085/096 ...done    (Python 2.7.5)
086/096 ...done    (Ruby 2.0.0)
087/096 ...done    (SCL collections)
088/096 ...done    (System kickstart)
089/096 ...done    (YUM)
090/096 ...done    (Check for usage of dangerous range of UID/GIDs)
091/096 ...done    (Incorrect usage of reserved UID/GIDs)
092/096 ...done    (NIS ypbind config files back-up)
093/096 ...done    (NIS Makefile back-up)
094/096 ...done    (NIS server maps check)
095/096 ...done    (NIS server MAXUID and MAXGID limits check)
096/096 ...done    (NIS server config file back-up)
Assessment finished (time 15:25s)
Result table with checks and their results for main contents:
---------------------------------------------------------------------------------------------------------------
|several graphic drivers not supported in CentOS 7                                         |notapplicable     |
|several input drivers not supported in CentOS 7                                           |notapplicable     |
|w3m not available in CentOS 7                                                             |notapplicable     |
|report incompatibilities between CentOS 6 and 7 in qemu-guest-agent package               |notapplicable     |
|Identity Management Server compatibility check                                            |notapplicable     |
|System kickstart                                                                          |notapplicable     |
|NIS ypbind config files back-up                                                           |notapplicable     |
|NIS Makefile back-up                                                                      |notapplicable     |
|NIS server maps check                                                                     |notapplicable     |
|NIS server MAXUID and MAXGID limits check                                                 |notapplicable     |
|NIS server config file back-up                                                            |notapplicable     |
|Bacula Backup Software                                                                    |pass              |
|Migration of the MySQL data stack                                                         |pass              |
|several kernel networking drivers not available in CentOS 7                               |pass              |
|several kernel storage drivers not available in CentOS 7                                  |pass              |
|BIND9 configuration compatibility check                                                   |pass              |
|Move dhcpd/dhcprelay arguments from /etc/sysconfig/* to *.service files                   |pass              |
|DNSMASQ configuration compatibility check                                                 |pass              |
|Net-SNMP check                                                                            |pass              |
|samba shared directories selinux                                                          |pass              |
|bind-dyndb-ldap                                                                           |pass              |
|IPA Server CA Verification                                                                |pass              |
|Information on time-sync.target                                                           |pass              |
|OpenSSH sshd_config migration content                                                     |pass              |
|Configuration for quota_nld service                                                       |pass              |
|Disk quota netlink message daemon moved into quota-nld package                            |pass              |
|SSSD compatibility check                                                                  |pass              |
|Luks encrypted partition                                                                  |pass              |
|Clvmd and cmirrord daemon management.                                                     |pass              |
|Configuration for warnquota tool                                                          |pass              |
|Architecture Support                                                                      |pass              |
|Debuginfo packages                                                                        |pass              |
|Read Only FHS directories                                                                 |pass              |
|In-place Upgrade Requirements for the /usr/ Directory                                     |pass              |
|CA certificate bundles modified                                                           |pass              |
|Developer Tool Set packages                                                               |pass              |
|Hyper-V                                                                                   |pass              |
|Check for ethernet interface naming                                                       |pass              |
|Plugable authentication modules (PAM)                                                     |pass              |
|Ruby 2.0.0                                                                                |pass              |
|SCL collections                                                                           |pass              |
|MySQL configuration                                                                       |informational     |
|Changes related to moving from MySQL to MariaDB                                           |informational     |
|Names, Options and Output Format Changes in arptables                                     |informational     |
|Compatibility Between iptables and ip6tables                                              |informational     |
|Squid configuration compatibility check                                                   |informational     |
|VCS repositories                                                                          |informational     |
|Added and extended options for BIND9 configuration                                        |informational     |
|Added options in DNSMASQ configuration                                                    |informational     |
|Removed options in coreutils binaries                                                     |informational     |
|Removed options in gawk binaries                                                          |informational     |
|Removed options in netstat binary                                                         |informational     |
|Removed options in quota tools                                                            |informational     |
|GMP library incompatibilities                                                             |informational     |
|CVS Package Split                                                                         |informational     |
|NTP configuration                                                                         |informational     |
|Disk quota tool warnquota moved into quota-warnquota package                              |informational     |
|File Systems, Partitions and Mounts Configuration Review                                  |informational     |
|Sonamebumped libs                                                                         |informational     |
|SonameKept Reusable Dynamic Libraries                                                     |informational     |
|Removed .so libs                                                                          |informational     |
|Foreign Perl modules                                                                      |informational     |
|YUM                                                                                       |informational     |
|Dovecot configuration compatibility check                                                 |fixed             |
|Reusable Configuration Files                                                              |fixed             |
|Replaced rpms                                                                             |fixed             |
|package downgrades                                                                        |fixed             |
|restore custom selinux configuration                                                      |fixed             |
|CUPS Browsing/BrowsePoll configuration                                                    |fixed             |
|OpenSSH sysconfig migration content                                                       |fixed             |
|State of LVM2 services.                                                                   |fixed             |
|device-mapper-multipath configuration compatibility check                                 |fixed             |
|fix krb5kdc config file                                                                   |fixed             |
|Configuration Files to Review                                                             |needs_inspection  |
|File Lists for Manual Migration                                                           |needs_inspection  |
|PostgreSQL upgrade content                                                                |needs_inspection  |
|BIND9 running in a chroot environment check.                                              |needs_inspection  |
|Obsoleted rpms                                                                            |needs_inspection  |
|FreeRADIUS Upgrade Verification                                                           |needs_inspection  |
|httpd configuration compatibility check                                                   |needs_inspection  |
|OpenLDAP /etc/sysconfig and data compatibility                                            |needs_inspection  |
|Removal of scsi-target-utils                                                              |needs_inspection  |
|Binary rebuilds                                                                           |needs_inspection  |
|Python 2.7.5                                                                              |needs_inspection  |
|Check for usage of dangerous range of UID/GIDs                                            |needs_inspection  |
|Incorrect usage of reserved UID/GIDs                                                      |needs_inspection  |
|Packages not signed by CentOS                                                             |needs_action      |
|Removed rpms                                                                              |needs_action      |
|General                                                                                   |needs_action      |
|Quorum implementation                                                                     |needs_action      |
|Content for enabling and disabling services based on CentOS 6 system                      |needs_action      |
|User modification in /etc/rc.local and /etc/rc.d/rc.local                                 |needs_action      |
|cgroups configuration compatibility check                                                 |needs_action      |
|GNOME Desktop Environment underwent several design modifications in CentOS 7 release      |fail              |
|KDE Desktop Environment underwent several design modifications in CentOS 7 release        |fail              |
|Cluster and High Availability                                                             |fail              |
---------------------------------------------------------------------------------------------------------------
Tarball with results is stored here /root/preupgrade-results/preupg_results-210330111953.tar.gz .
The latest assessment is stored in directory /root/preupgrade .
Summary information:
We found some critical issues. In-place upgrade is not advised.
Read the file /root/preupgrade/result.html for more details.
Upload results to UI by command:
e.g. preupg -u http://127.0.0.1:8099/submit/ -r /root/preupgrade-results/preupg_results-*.tar.gz .

 

6、导入CentOS7的key

rpm –import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

7、开始升级

centos-upgrade-tool-cli –network 7 –instrepo=http://vault.centos.org/centos/7.2.1511/os/x86_64/

8、更新完后,重启服务器

reboot

 

赞(4) 打赏
转载请注明来源:IT技术资讯 » CentOS6.x升级到7

评论 抢沙发

评论前必须登录!

 

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏