赵走x博客
网站访问量:151427
首页
书籍
软件
工具
古诗词
搜索
登录
Centos挂载硬盘完整图文教程(查看、分区、格式化、挂载)磁盘
Centos7 合上电脑不关机
Centos换源
centos 7-aarch64如何替换yum源
Centos7安装python10
centos 7-amd64如何替换yum源
centos 7-amd64如何替换yum源
资源编号:570035
热度:214
centos 7-amd64如何替换yum源
### 一、进入yum.repo.d ``` cd /etc/yum.repos.d/ ls CentOS-Base.repo CentOS-Sources.repo ``` ### 二、备份原yum源 ``` mkdir yum-back mv CentOS-* yum-back/ ``` ### 三、替换yum源为163 vim /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-$releasever - Base - 163.com #mirrorlist=https://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os baseurl=https://mirrors.163.com/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=https://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$releasever - Updates - 163.com #mirrorlist=https://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates baseurl=https://mirrors.163.com/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=https://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras - 163.com #mirrorlist=https://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras baseurl=https://mirrors.163.com/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=https://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=https://mirrors.163.com/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=https://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 ``` ``` curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo ``` ### 五、运行yum生成缓存 ``` yum clean all yum makecache ``` ### 六、验证 ``` yum -y install gcc-c++ ``` 今天在使用yum安装的时候每个安装包都报了Failing package is: kernel-headers-3.10.0-1127.13.1.el7.x86_64 GPG Keys are configured as: http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6错误 记录一下解决办法 在每一个yum命令安装的背后加上--nogpgcheck 例如安装gcc ``` yum install gcc --nogpgcheck ```