1. 程式人生 > >Centos6.5跨越大版本升級到Centos7.4

Centos6.5跨越大版本升級到Centos7.4

升級原因

隨著技術升級,新科技的更新換代,作業系統的版本到現在也從Centos5.X過度到了最新的Centos7.5。
近期計劃要使用Kubernetes服務,最新版本更好的相容Centos7.X系列系統,由於遠端Server都是通過私有云提供的,這樣我們重新安裝Centos7.X系統需要各種申請操作,沒辦法,個人怕麻煩還對這個技術需求有強烈的好奇心,所以準備探討技術如何遠端升級。

預置條件:

  • 安裝Centos6.5系統的伺服器
  • Centos7.2系統的DVD檔案
  • Centos7.4的YUM源
  • Centos6.5-upg的YUM源

升級過程

安裝升級工具

. 新增一個Centos6.5-upg的源

[upg]
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 install redhat-upgrade-tool preupgrade-assistant-contents

注:openscap-1.0.8-1.0.1.el6.centos.x86_64.rpm

執行升級前檢查

preupg

出現如下結果代表正常

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 02:15s)
Result table with checks and their results for main contents:
....

|Content for enabling and disabling services based on
CentOS 6 system |needs_action |
--------------------------------------------------------------------------------------------------------------- Tarball with results is stored here /root/preupgrade-results/preupg_results-170510111635.tar.gz . The latest assessment is stored in directory /root/preupgrade . Summary information: We found some potential in-place upgrade risks. 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 .

匯入RPM簽名證書

rpm --import https://mirrors.ustc.edu.cn/epel/RPM-GPG-KEY-EPEL-7

上傳Centos7.2-DVD.iso檔案

執行升級操作

centos-upgrade-tool-cli  --iso=/path/centos7.2-dvd.iso  --force

結束後進行重啟

setting up repos...
.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.
...
...

(276/277): zlib-1.2.7-17.el7.x86_64.rpm | 90 kB 00:00
(277/277): zlib-devel-1.2.7-17.el7.x86_64.rpm | 50 kB 00:00
testing upgrade transaction
rpm transaction 100% [======================================================================================================================================================]
rpm install 100% [==========================================================================================================================================================]
setting up system for upgrade
Finished. Reboot to start upgrade.

檢視升級後的系統版本

cat /etc/redhat-release
#CentOS Linux release 7.2.1511 (Core)

配置Centos7.4的yum源地址

執行升級命令即可

yum upgrade

完活,期待自己的系統升級到Centos7.4吧。
注:如升級在升級Centos7.2進行reboot後無法連線系統,請通過直連或者是虛擬化的view介面的方式訪問系統,登入後修改網絡卡名為Centos7.2系統的網絡卡名,這裡是ens32,修改完後重啟網路服務即可。