记录一次离线下centos7.1升级到指定的centos7.4系统
Posted yu344109534
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了记录一次离线下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服务器上操作
拷贝到客户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
以上是关于记录一次离线下centos7.1升级到指定的centos7.4系统的主要内容,如果未能解决你的问题,请参考以下文章