Centos7环境yum源文件

avatar 2020年12月17日18:03:27 评论 1,082 次浏览

远程机器yum源出现问题了,不能安装,也没有安装wget下载文件,curl命令也没有,只能远程也不能上传,没办法就把yum源文件内容复制上去,但是找了很多都不对,这里还是在163共享对yum源根据不同系统的yum文件下载,然后贴上去。http://mirrors.163.com/.help/

根据不同的系统下载yum源文件即可,下载后需要把系统上的文件做备份

[root@wulaoer ~]# cd /etc/yum.repos.d
[root@wulaoer yum.repos.d]#mv ./CentOS-Base.repo ./CentOS-Base.repo.bak

下载打开文件,就是下面的内容

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

把上面的内容贴到CentOS-Base.repo文件中,然后在更新一下yum源,先把旧的缓存清理,在生成新的缓存

[root@wulaoer ~]# yum clean all
[root@wulaoer ~]# yum makecache

yum源更新完成,就可以继续玩yum源了

avatar

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: