更换yum源
首先错误时的报错是一个url地址找不到,直接复制这个地址去看看是否没找到,如图确实出现404

更换版本为6.5时

最后改版本为7确实找到了!!!
那么我们就可以在配置文件中把版本改为能找到的试试

执行命令:
cd /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-7 - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-7 - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-7 - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/7/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-7 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
但是我使用时下载太慢我就换成离线安装了
我觉得安装其他软件思路不变都可以借鉴以下链接
地址如下:
安装gcc-c++的方式
本文介绍了解决yum源无法访问的问题,通过更改CentOS系统的yum源配置文件,将默认的源替换为网易163提供的稳定镜像站点。此外,还提供了离线安装的方法。
5068

被折叠的 条评论
为什么被折叠?



