CentOS 升级至指定版本
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.centos.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.centos.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.centos.org/7.2.1511/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 enabled=1 [C7.2.1511-centosplus] name=CentOS-7.2.1511 - CentOSPlus baseurl=http://vault.centos.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
[THE END]