记录一次离线下centos7.1升级到指定的centos7.4系统

一年好景君须记,最是橙黄橘绿时。这篇文章主要讲述记录一次离线下centos7.1升级到指定的centos7.4系统相关的知识,希望能为你提供帮助。
在本地电脑上虚拟机centos7.1里操作下载centos7.4 rpm包
vim /etc/yum.conf
keepcache=1#修改为1表示开启缓存
yum install -y createrepo
cd /etc/yum.repos.d/
cp CentOS-Base.repo CentOS-Base.repo-bak
vim CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever& arch=$basearch& repo=os& infra=$infra
baseurl=http://olcentchan.chinacloudapp.cn/centos/7.4.1708/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever& arch=$basearch& repo=updates& infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
#baseurl=http://olcentchan.chinacloudapp.cn/centos/7.4.1708/os/$basearch/
baseurl=http://olcentchan.chinacloudapp.cn/centos/7.4.1708/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever& arch=$basearch& repo=extras& infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
baseurl=http://olcentchan.chinacloudapp.cn/centos/7.4.1708/extras/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever& arch=$basearch& repo=centosplus& infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
baseurl=http://olcentchan.chinacloudapp.cn/centos/7.4.1708/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
执行 yum clean all 清除 Yum 在本机的缓存
执行 yum repolist 查看,会发现仓库信息已经更新过。可以不执行
yum update -y升级
制作离线包
mkdir /opt/centos7_4
cd/var/cache/yum/x86_64/7/
find ./ -name "*.rpm" -exec cp -r/opt/centos7_4  \\;
cd /opt/centos7_4
createrepo ./
cd ..
tar -zcvf centos7_4.tar.gz  centos7_4
在客户cento7.1服务器上操作
【记录一次离线下centos7.1升级到指定的centos7.4系统】拷贝到客户cento7.1上进行升级到centos7.4
tar -zxvf centos7_4.tar.gz -C /opt/ 解压包
vim /etc/yum.repos.d/centos7_4.repo
[root@localhost yum.repos.d]# catcentos7_4.repo
[centos7_4]
name=centos7_4
baseurl=file:///opt/centos7_4
enable=1
gpgcheck=0
mv/etc/yum.repos.d/CentOS-* /opt/
yum clean all
yum update -y

    推荐阅读