因爲docker-ce再也不支持centos6,因此以爲吧系統升級爲centos7,如下是踩坑的過程
一、添加源 /etc/yum.repos.d/upgrade.repophp
[upgrade]
name=CentOS-$releasever - Upgrade Tool baseurl=http://dev.centos.org/centos/6/upg/x86_64/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
二、使用 yum 安裝此工具及其預升級助手html
[root@allen05ren ~]# yum install redhat-upgrade-tool preupgrade-assistant-contents
三、執行此工具的預升級助手查看可用內容java
[root@allen05ren ~]# preupg -l CentOS6_7
四、執行預升級助手進行升級前的檢查python
[root@ibills ~]# preupg -s CentOS6_7
問題來了:mysql
I/O warning : failed to load external entity "/usr/share/openscap/xsl/security-guide.xsl" compilation error: file /usr/share/preupgrade/xsl/preup.xsl line 40 element import xsl:import : unable to load /usr/share/openscap/xsl/security-guide.xsl I/O warning : failed to load external entity "/usr/share/openscap/xsl/oval-report.xsl" compilation error: file /usr/share/preupgrade/xsl/preup.xsl line 41 element import xsl:import : unable to load /usr/share/openscap/xsl/oval-report.xsl I/O warning : failed to load external entity "/usr/share/openscap/xsl/sce-report.xsl" compilation error: file /usr/share/preupgrade/xsl/preup.xsl line 42 element import xsl:import : unable to load /usr/share/openscap/xsl/sce-report.xsl OpenSCAP Error:: Could not parse XSLT file '/usr/share/preupgrade/xsl/preup.xsl' [oscapxml.c:416] Unable to open file /root/preupgrade/result.html Usage: preupg [options] preupg: error: [Errno 2] No such file or directory: '/root/preupgrade/result.html'
遇到問題那麼就找緣由和解決方法,經過搜索引擎搜索,找到 CentOS 官方論壇的一篇帖子,帖子中有一回復以下:
Erase the existing version of openscap (I had openscap 1.2) and install openscap-1.0.8-1.0.1 from http://dev.centos.org/centos/6/upg and redo the upgrade.linux
根據他的方法,把 openscap 軟件包的版本下降以後,從新再安裝此工具及其預升級助手:nginx
[root@allen05ren ~]# yum erase openscap [root@allen05ren ~]# yum install http://dev.centos.org/centos/6/upg/x86_64/Packages/openscap-1.0.8-1.0.1.el6.centos.x86_64.rpm [root@allen05ren ~]# yum install redhat-upgrade-tool preupgrade-assistant-contents
從新執行 preupg -s CentOS6_7 命令:git
[root@allen05ren ~]# 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/10 ...finished (time 00:00s) All changed files : 02/10 ...finished (time 00:48s) Changed config files : 03/10 ...finished (time 00:00s) All users : 04/10 ...finished (time 00:00s) ... 042/100 ...done (samba shared directories selinux) 043/100 ...done (CUPS Browsing/BrowsePoll configuration) 044/100 ...done (CVS Package Split) ... |samba shared directories selinux |notapplicable | |CUPS Browsing/BrowsePoll configuration |notapplicable | |CVS Package Split |notapplicable | ...
檢查須要一些時間,檢查的結果會被保存到 /root/preupgrade/result.html,預升級助手的目的能夠查看上面給出的此工具的用途說明。/root/preupgrade 目錄下還存儲了其餘一些文件,在升級完成後,能夠查看一下。github
五、開始執行升級web
首先導入 CentOS 7 的CentOS-7 RPM GPG KEY:
[root@allen05ren ~]# rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7
執行升級命令:
[root@allen05ren ~]# centos-upgrade-tool-cli --network 7 --instrepo=http://mirror.centos.org/centos/7/os/x86_64/
以上的包倉庫也可更換爲其餘的源地址。
問題又來了:
…
Continue with the upgrade [Y/N]? y
getting boot images…
Downloading failed: invalid data in .treeinfo: No option ‘upgrade’ in section: ‘images-x86_64’
根據提示,.treeinfo 文件中的 ‘images-x86_64’ 部分沒有 ‘upgrade’ 選項,查看該文件:
[general]
name = CentOS Linux-7 family = CentOS Linux timestamp = 1480944027.47 variant = version = 7 packagedir = arch = x86_64 [stage2] mainimage = LiveOS/squashfs.img [images-x86_64] kernel = images/pxeboot/vmlinuz initrd = images/pxeboot/initrd.img boot.iso = images/boot.iso [images-xen] kernel = images/pxeboot/vmlinuz initrd = images/pxeboot/initrd.img [checksums] LiveOS/squashfs.img = sha256:bb4bc180bce57d78e5ea0df91410a006b08966663ef21ff746b4b102852d08bb repodata/repomd.xml = sha256:27dc6846e9cb739a79b28acdad499c7cc1894781bd92e0adedc646b05cf95d77 images/pxeboot/vmlinuz = sha256:0e9b8a60576744d54c2468fbc84051e09a6090d1b1cfecf9adbdd95b3614a8a2 images/pxeboot/initrd.img = sha256:d012bf47580c63586f02e8247819ea28bd6edc5e3870f13b1efd0130d4593cae images/efiboot.img = sha256:c43aa456d5de63ffafe9792584aecc167f6de723fdc5ac78b0309f88788c5915 images/boot.iso = sha256:f2f7367deb90a25822947660c71638333ca0eceeabecc2d631be6cd508c24494
確實無此選項,可是根據官方的升級步驟也徹底沒有錯誤,通過一頓折騰,找其餘的源,發現都是沒有此選項(其實後面發送找其餘源也是徒勞,由於都是同步的官方源的)。
心想不太可能升級不了,靈機一動 CentOS 不是有舊系統的備份源嗎:http://vault.centos.org/,上去就是幾個現存的 CentOS 版本目錄查看 .treeinfo 文件,皇天不負有心人,7.0.140六、7.1.150三、7.2.1511幾個版本都有 ‘upgrade’ 選項,那就選個最新的 7.2.1511 版本,升級完再升級吧:
[general]
name = CentOS-7 family = CentOS timestamp = 1449700442.21 variant = version = 7 packagedir = arch = x86_64 [stage2] mainimage = LiveOS/squashfs.img [images-x86_64] kernel = images/pxeboot/vmlinuz initrd = images/pxeboot/initrd.img upgrade = images/pxeboot/upgrade.img boot.iso = images/boot.iso [images-xen] kernel = images/pxeboot/vmlinuz initrd = images/pxeboot/initrd.img upgrade = images/pxeboot/upgrade.img [checksums] LiveOS/squashfs.img = sha256:1778a13e6a0bd98c0db94c4c068e08f84f6f91cdca7b2a5111aad1b5a181c0c4 repodata/repomd.xml = sha256:13d1072eeb97c6e5a0ab8bcbf5f8b0b82c87c43bf6e4be26983772609b237cb1 images/pxeboot/vmlinuz = sha256:ee2df000e29c79ae96db95f61766a8c5adc527d8c92c4114badedf251f73b20e images/pxeboot/upgrade.img = sha256:fa54ce9a3aedad9d7de59507410af3eec51ac7e65b45b7ac9a14c971f33e45cf images/pxeboot/initrd.img = sha256:ad1f8fc2bebe9ec1eb5c36d4c38177e39fe8423602098d60c29804081f81b8bd images/efiboot.img = sha256:08743dd12b338a6c726dd0d66e2109e18e19db8b6f0191f9882929035e7875a6 images/boot.iso = sha256:9ed9ffb5d89ab8cca834afce354daa70a21dcb410f58287d6316259ff89758f5
把源倉庫地址一換,終於順利下載升級文件開始升級。
[root@allen05ren ~]# centos-upgrade-tool-cli --network 7 --instrepo=http://vault.centos.org/centos/7.2.1511/os/x86_64/ setting up repos... Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Repository contrib is listed more than once in the configuration cmdline-instrepo | 3.6 kB 00:00 cmdline-instrepo/primary_db | 5.3 MB 02:17 epel | 4.3 kB 00:00 epel/primary_db | 5.9 MB 00:05 upg | 1.9 kB 00:00 upg/primary_db | 14 kB 00:00 No upgrade available for the following repos: base extras updates .treeinfo | 1.1 kB 00:00 Preupgrade assistant risk check found risks for this upgrade. You can run preupg --riskcheck --verbose to view these risks. Addressing high risk issues is required before the in-place upgrade and ignoring these risks may result in a broken upgrade and unsupported upgrade. Please backup your data. List of issues: INPLACERISK: HIGH: We detected some non-CentOS signed packages, you can find the list in /root/preupgrade/./kickstart/noncentospkgs. You need to handle them yourself! INPLACERISK: HIGH: After upgrading to CentOS 7 there are still some el6 packages left. Add --cleanup-post option to redhat-upgrade-tool if you want to remove them automatically. INPLACERISK: HIGH: Library pcre (required by NonCentOS signed package(s):nginx ) changed soname between CentOS 6 and CentOS 7 INPLACERISK: HIGH: The service network on CentOS 7 is disabled by default. Enable them via commands: systemctl enable network && systemctl start network.service . INPLACERISK: HIGH: The service nscd on CentOS 7 is disabled by default. Enable them via commands: systemctl enable nscd && systemctl start nscd.service . INPLACERISK: HIGH: The service ntpd on CentOS 7 is disabled by default. Enable them via commands: systemctl enable ntpd && systemctl start ntpd.service . INPLACERISK: HIGH: The service udev-post on CentOS 7 is disabled by default. Enable them via commands: systemctl enable udev-post && systemctl start udev-post.service . INPLACERISK: HIGH: File /etc/rc.d/rc.local was changed INPLACERISK: MEDIUM: We detected some packages installed on the system were removed (obsoleted) between CentOS 6 and CentOS 7. This may break the functionality of the packages depending on them. INPLACERISK: MEDIUM: We detected some packages installed on the system were removed between CentOS 6 and CentOS 7. This may break the functionality of the packages depending on them. INPLACERISK: MEDIUM: Package ql2500-firmware not provided by its replacement linux-firmware. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: Package ql23xx-firmware not provided by its replacement linux-firmware. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: Package bfa-firmware not provided by its replacement linux-firmware. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: Package ql2100-firmware not provided by its replacement linux-firmware. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: Package rt61pci-firmware not provided by its replacement linux-firmware. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: Package coreutils-libs not provided by its replacement coreutils. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: Package ql2400-firmware not provided by its replacement linux-firmware. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: Package rt73usb-firmware not provided by its replacement linux-firmware. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: Package ql2200-firmware not provided by its replacement linux-firmware. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: having one of [nss libxcb libdrm libibverbs systemtap libpciaccess nss-sysinit ca-certificates systemtap-devel libX11 tzdata nspr nss-util elfutils-libelf systemtap-runtime openldap systemtap-client audit libX11-common audit-libs elfutils-libs nss-tools librdmacm openscap] package installed breaks upgrade INPLACERISK: MEDIUM: We detected some soname bumps in the libraries installed on the system. This may break the functionality of some of your 3rd party applications. They may need rebuild. Please check their requirements. INPLACERISK: MEDIUM: We detected some .so libraries installed on the system were removed between CentOS 6 and CentOS 7. This may break the functionality of some of your 3rd party applications. INPLACERISK: MEDIUM: The service supervisord is not installed by CentOS signed packages and will not be automatically enabled after in-place upgrade. INPLACERISK: SLIGHT: We detected some files where modifications are not tracked in the rpms. You may need to check their functionality after successful upgrade. INPLACERISK: SLIGHT: We detected some files untracked by rpms. Some of these may need manual check/migration after redhat-upgrade-tool and/or can cause conflicts or troubles during the installation. Try to reduce unnecessary untracked files before running redhat-upgrade-tool. INPLACERISK: SLIGHT: Package procps (required by NonCentOS signed package(s):mysql-community-server ) replaced between CentOS 6 and CentOS 7 INPLACERISK: SLIGHT: We detected some packages installed on the system changed their name between CentOS 6 and CentOS 7. Although they should be compatible, monitoring after the update is recommended. INPLACERISK: SLIGHT: export shell commands will be deleted from /etc/sysconfig/sshd INPLACERISK: SLIGHT: Some binaries untracked by RPM were discovered on the system and may need rebuild after upgrade. INPLACERISK: SLIGHT: Some scripts untracked by RPM were discovered on the system and may not work properly after upgrade. INPLACERISK: SLIGHT: The perl module /usr/lib64/perl5/vendor_perl/nginx.pm was not installed