出现这个问题的情况是:
在使用yum源的时候提示
提示网络无法访问,因此需要重新的配置yum源;
First:先在/etc/yum.repo.d下的所有文件进行备份操作,我这里的操作是新建tmp的文件夹然后把目录中的数据全部移动到到这个tmp目录下;
Second:卸载之前安装的rpm包的,并重新安装对应的rpm包:
卸载这个rpm的包,执行命令:
rpm -e yum-3.4.3-132.el7.centos.0.1.noarch --nodeps
rpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 --nodeps
rpm -e yum-plugin-fastestmirror-1.1.31-34.el7.noarch --nodeps
然后重现安装这些软件:这里面有个情况是因为yum此时已经不可以使用,如果这个时候wget功能还是可以使用的化,直接执行wget的命令是可以的:
但是如果此时wget不能使用的化,也不要慌,此时可以找一个可以连接上网的机器,在特定目录下wget下,获得rpm的文件,直接上传到你要的机器就行:
Third:执行rpm -ivh yum-*安装相应的rpm的包:
Forth:现在配置repo文件,因此在/etc/yum.repo.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
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Fifth:执行yum的相关操作:
yum clean all
yum makecache
最后,执行yum install telnet试试安装的成功不!
参考