YUM配置修改


一、背景

     linux服务器需要下载一些依赖包,如果服务器能上外网,除了DNS配置,还需要YUM(/etc/yum.repos.d)有能下载的地方,有些操作系统版本自带的YUM配置不能去公网拉取依赖包(本地YUM源除外,可参考我的博客https://www.cnblogs.com/zgt-edu-cn/p/15525305.html)

二、YUM源文件配置/etc/yum.repos.d,做此操作之前,可以新建一个文件夹

/etc/yum.repos.d/bak,把原有YUM源移动到新文件夹中,详细操作如下 

 

YUM配置修改

#graphically 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 

YUM配置修改

 

三、清理本地YUM残留

 

 

1、清除YUM缓存

yum clean all

 

 

YUM配置修改

 2、 就是把服务器的包信息下载到本地电脑缓存起来

yum makecache

  YUM配置修改

3、更新软件仓库  

YUM配置修改

 

四、下载测试,成功 

 

YUM配置修改

 

 

 YUM配置修改 

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/281706.html

(0)
上一篇 2022年8月22日
下一篇 2022年8月22日

相关推荐

发表回复

登录后才能评论