赵走x博客
网站访问量:151524
首页
书籍
软件
工具
古诗词
搜索
登录
Centos挂载硬盘完整图文教程(查看、分区、格式化、挂载)磁盘
Centos7 合上电脑不关机
Centos换源
centos 7-aarch64如何替换yum源
Centos7安装python10
centos 7-amd64如何替换yum源
centos 7-aarch64如何替换yum源
资源编号:570029
热度:379
### 一、进入yum.repo.d ``` cd /etc/yum.repos.d/ ls CentOS-Base.repo CentOS-Sources.repo ``` ### 二、备份原yum源 ``` mkdir yum-back mv CentOS-* yum-back/ ``` ### 三、替换yum源为阿里源 vim 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 baseurl=https://mirrors.aliyun.com/centos-altarch/$releasever/os/$basearch/ gpgcheck=1 gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$releasever - Updates baseurl=https://mirrors.aliyun.com/centos-altarch/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras baseurl=https://mirrors.aliyun.com/centos-altarch/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 enabled=1 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus baseurl=https://mirrors.aliyun.com/centos-altarch/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 [root@node-01 yum.repos.d]# cat epel.repo [epel] name=Extra Packages for Enterprise Linux 7 - $basearch #baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/$basearch #metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch failovermethod=priority enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 [epel-debuginfo] name=Extra Packages for Enterprise Linux 7 - $basearch - Debug #baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/$basearch/debug #metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 gpgcheck=1 [epel-source] name=Extra Packages for Enterprise Linux 7 - $basearch - Source #baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/SRPMS #metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 gpgcheck=1 ``` ### 四、替换认证秘钥 ``` curl -o /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 curl -o /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 https://archive.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 ``` ### 五、运行yum生成缓存 ``` yum makecache rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 ``` ### 六、验证 ``` 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 ```