CentOS 6 在 2020/11/30 時代已結束支援了 (EOL),最後一版是 6.10

大部份的 mirror 也沒有它的身影了

幸好找到一個 ↓ yum repos 可以用

cat << EOF >> /etc/yum.repos.d/vault.repo
[vault-os]
name=vault-os
failovermethod=priority
baseurl=https://vault.centos.org/6.10/os/x86_64/
gpgcheck=1
gpgkey=https://vault.centos.org/6.10/os/x86_64/RPM-GPG-KEY-CentOS-6

[vault-updates]
name=vault-updates
failovermethod=priority
baseurl=https://vault.centos.org/6.10/updates/x86_64/
gpgcheck=1
EOF

因為 CentOS 7 的系統架構是與 CentOS 6 大不相同的,所以想要 upgrade 是不太可能的,這次的測試也驗證了這事

我拿純 CentOS 6.10 來弄,結果失敗

過程是這樣子的 ↓

升級需要特殊的套件,所以用這個 yum repos ↓

cat << EOF > /etc/yum.repos.d/upgrade.repo
[centos-upgrade]
name=centos-upgrade
baseurl=https://buildlogs.centos.org/centos/6/upg/x86_64/
enabled=1
gpgcheck=0
EOF

安裝需要的套件

因版本問題,雖然在 yum 會帶入 openscap ,但這版在執行 preupg 才可以正常

yum -y install https://buildlogs.centos.org/centos/6/upg/x86_64/Packages/openscap-1.0.8-1.0.1.el6.centos.x86_64.rpm
yum -y install redhat-upgrade-tool preupgrade-assistant-contentsyum install redhat-upgrade-tool preupgrade-assistant-contents

再來預先檢查環境,它的結果將影響能不能升級

執行預覽

preupg
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:00s)
All changed files : 02/11 ...running
(省略)
---------------------------------------------------------------------------------------------------------------
Tarball with results is stored here /root/preupgrade-results/preupg_results-210712183751.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 .

最後報告會在 /root/preupgrade/result.html ,可以稍為看一下

再來匯入 CentOS 7 的 KEY

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

升級時會重用到 /root/preupgrade 及 /root/preupgrade-result 目錄

接著開始升級

可透過網路升級

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

或者光碟升級

mount /dev/cdrom /media
centos-upgrade-tool-cli --device=/dev/cdrom

這就遇到問題了,它說有 EXTREME 狀態不能升

preupgrade-assistant risk check found EXTREME risks for this upgrade.
Run preupg --riskcheck --verbose to view these risks.
Continuing with this upgrade is not recommended.

所以跑 ↓ 看是那些

preupg --riskcheck --verbose
INPLACERISK: EXTREME: The kernel driver 'tulip' required to service hardware present in your system is not available in CentOS 7. This suggests that your system contains hardware that is not supported in CentOS 7 release.
INPLACERISK: EXTREME: This machine seems to run on a Microsoft hypervisor.
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: 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 postfix on CentOS 7 is disabled by default. Enable them via commands: systemctl enable postfix && systemctl start postfix.service .
INPLACERISK: HIGH: The service rdma on CentOS 7 is disabled by default. Enable them via commands: systemctl enable rdma && systemctl start rdma.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.

我覺得這兩點 EXTREME 這兩點對我來說沒什麼問題

所以就強制升級了

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

如果出現 ↓ 是因為版本不支援,要換別的版本

Downloading failed: invalid data in .treeinfo: No section: 'checksums'

但版本對了,還是出現問題 ↓

Downloading failed: failure: repodata/6d0c3a488c282fe537794b5946b01e28c7f44db79097bb06826e1c0c88bad5ef-primary.sqlite.bz2 from cmdline-instrepo: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"

所以我拿 CentOS-7-x86_64-DVD-1511.iso 來掛載

mount /dev/cdrom /media
centos-upgrade-tool-cli --device=/dev/cdrom --force

跟上面的一樣問題

結論

不升了

參考

http://skynetanklav.blogspot.com/2019/12/upgrading-cent-os-6-to-7.html

最後修改日期: 2021 年 07 月 12 日

作者

留言

撰寫回覆或留言

發佈留言必須填寫的電子郵件地址不會公開。