linux配置yum源报错,linux配置yum源

在做linux配置yum源的时候,笔者从网上找的教程, 然后发现各种报错,最后总结了一下,比较好用的一种方法是,复制一台yum源是正常的linux虚拟机对应的

/etc/yum.repos.d

目录下的文件,以下为笔者/etc/yum.repos.d目录下的文件

6f8602f5ccdaa3800e380c45250d320d.png

把该目录的文件全部清空,然后创建以上四个文件,把下方文件的内容拷入

CentOS-Base.repo文件的内容如下:

# 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 usethis forCentOS updates

# unless you are manually picking other mirrors.

#

# If the mirrorlist= does not work for you, as a fall back you can trythe

# remarkedout baseurl=line instead.

#

#

[base]

name=CentOS-$releasever -Base

mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os

#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/

gpgcheck=1gpgkey=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

#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/

gpgcheck=1gpgkey=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

#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/

gpgcheck=1gpgkey=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

#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/

gpgcheck=1enabled=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

CentOS-Debuginfo.repo内容如下:

# CentOS-Debug.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 usethis forCentOS updates

# unless you are manually picking other mirrors.

#

# All debug packagesfrom all the various CentOS-7releases

# are merged into a single repo, split by BaseArch

#

# Note: packagesinthe debuginfo repo are currently not signed

#

[debug]

name=CentOS-7 -Debuginfo

baseurl=http://debuginfo.centos.org/7/$basearch/

gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-7

enabled=0#

CentOS-Sources.repo文件内容如下:

# CentOS-Sources.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 usethis forCentOS updates

# unless you are manually picking other mirrors.

#

# If the mirrorlist= does not work for you, as a fall back you can trythe

# remarkedout baseurl=line instead.

#

#

[base-source]

name=CentOS-$releasever -Base Sources

baseurl=http://vault.centos.org/centos/$releasever/os/Source/

gpgcheck=1enabled=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates

[updates-source]

name=CentOS-$releasever -Updates Sources

baseurl=http://vault.centos.org/centos/$releasever/updates/Source/

gpgcheck=1enabled=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful

[extras-source]

name=CentOS-$releasever -Extras Sources

baseurl=http://vault.centos.org/centos/$releasever/extras/Source/

gpgcheck=1enabled=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages

[centosplus-source]

name=CentOS-$releasever -Plus Sources

baseurl=http://vault.centos.org/centos/$releasever/centosplus/Source/

gpgcheck=1enabled=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

CentOS-Vault.repo文件内容如下:

# placeholder fornow

# #

# CentOS Vault contains rpmsfrom older releases in the CentOS-7# tree.

#

# Atthis point in 7.0.1406, we have no older release

根据里边的代码内容来看,CentOS-Vault.repo文件似乎没有什么作用,应该可以不需要该文件,笔者也未对其进行验证,如有兴趣的可以自己不加该文件进行验证是否能正确配置yum源。

最后通过以下命令进行验证是否成功设置yum源

yum clean all

yum makecache

yum update

yum repolist

228ffba9a55dbe7f4bea30dbb488d78b.png

yum update对应的命令截图过长,截图部分

1b3d57897e4099f91af68bda70c78aeb.png

3b943d6494cad4c7b7da912ef8b07a50.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值