技术文档

帮助中心 > 技术文档 >

CentOS6配置yum源,yum不能用怎么办?

2023-11-16 作者:简米科技 阅读量:0 所属分类:技术文档

CentOS6配置yum源,yum不能用怎么办?Centos6的yum不能用怎么办?Command line error: no such option: -l

项目开发需要使用到centos6.10和devtoolset-6。但是CentOS6官方于2020年11月30日已经停止维护,而Centos6系统自带Yum想要连接旧版本的仓库,因此想要解决yum安装出现YumRepo Error: All mirror URLs are not using ftp, http[s] or file.报错,我们需要更新陈旧版本的仓库让它指向可用的vault。

第一步、备份原来的文件

执行以下命令

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

第二步、在/etc/yum.repos.d/ 目录下新建一个文件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 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-6.10 - Base - mirrors.aliyun.com

failovermethod=priority

baseurl=http://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/

gpgcheck=1

gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

#released updates

[updates]

name=CentOS-6.10 - Updates - mirrors.aliyun.com

failovermethod=priority

baseurl=http://mirrors.aliyun.com/centos-vault/6.10/updates/$basearch/

gpgcheck=1

gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful

[extras]

name=CentOS-6.10 - Extras - mirrors.aliyun.com

failovermethod=priority

baseurl=http://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/

gpgcheck=1

gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-6.10 - Plus - mirrors.aliyun.com

failovermethod=priority

baseurl=http://mirrors.aliyun.com/centos-vault/6.10/centosplus/$basearch/

gpgcheck=1

enabled=0

gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users

[contrib]

name=CentOS-6.10 - Contrib - mirrors.aliyun.com

failovermethod=priority

baseurl=http://mirrors.aliyun.com/centos-vault/6.10/contrib/$basearch/

gpgcheck=1

enabled=0

gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

第三步、执行以下命令, 使yum源生效

yum clean all

yum makecache

至此,Centos 6 的yum就配置好了,您可以执行yum来安装软件或更新系统

标签:

本文地址:https://www.iisidc.cn/help/10.html

简米科技服务器支持24小时免费测试


成为简米科技会员,享受出众的上云实践机会和周到的尊贵服务!