CentOS 升级至指定版本

linux itxz 5年前 (2020-10-26) 263次浏览 已收录 0个评论

CentOS系统下用yum upgrade命令只能升级到最新版本,CentOS仓库并不维护历史版本,所以我们只能使用 vault.centos.org 历史版本快照进行更新。
本文以将7.0.1406升级到7.2.1511为例。

1、备份旧的版本仓库文件:

mkdir -p /etc/yum.repos.d/backup
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/backup/

2、创建要升级到版本(7.2.1511)的Vault版本仓库文件:

vim /etc/yum.repos.d/CentOS-Vault.repo

# CentOS Vault contains rpms from older releases in the CentOS-7
# tree.
# C7.2.1511
[C7.2.1511-base]
name=CentOS-7.2.1511 - Base
baseurl=http://vault.<a href="http://www.itxz.com/?tag=centos" title="查看更多关于centos的文章" target="_blank">centos</a>.org/7.2.1511/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1

[C7.2.1511-updates]
name=CentOS-7.2.1511 - Updates
baseurl=http://vault.<a href="http://www.itxz.com/?tag=centos" title="查看更多关于centos的文章" target="_blank">centos</a>.org/7.2.1511/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1

[C7.2.1511-extras]
name=CentOS-7.2.1511 - Extras
baseurl=http://vault.<a href="http://www.itxz.com/?tag=centos" title="查看更多关于centos的文章" target="_blank">centos</a>.org/7.2.1511/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1

[C7.2.1511-<a href="http://www.itxz.com/?tag=centos" title="查看更多关于centos的文章" target="_blank">centos</a>plus]
name=CentOS-7.2.1511 - CentOSPlus
baseurl=http://vault.<a href="http://www.itxz.com/?tag=centos" title="查看更多关于centos的文章" target="_blank">centos</a>.org/7.2.1511/centosplus/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1

[C7.2.1511-fasttrack]
name=CentOS-7.2.1511 - Fasttrack
baseurl=http://vault.centos.org/7.2.1511/fasttrack/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1

3、查看现在可用仓库列表:

# yum repolist

4、查看现在可用仓库版本:

# yum list updates | grep "centos-release"

5、清空本地缓存:

# yum clean all
# rm -rf /var/cache/yum

6、版本升级:

# yum -y update

7、备份过渡的Vault仓库文件,启用新版的仓库文件:

# mv /etc/yum.repos.d/CentOS-Vault.repo /etc/yum.repos.d/backup/
# mv /etc/yum.repos.d/CentOS-Vault.repo.rpmnew /etc/yum.repos.d/CentOS-Vault.repo

8、清空本地缓存,更新版本库文件:

# yum clean all
# yum makecache

IT学者 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:CentOS 升级至指定版本
喜欢 (0)

您必须 登录 才能发表评论!