RedHat7.4或CentOS7.4安装yum源最新详解

注意事项:安装前必须确保机器联网可输入命令:ping www.baidu.com

root用户下操作

1.删除yum

rpm -qa|grepyum|xargs rpm -e --nodeps

2.检查yum插件是否删干净

rpm -qa | grep yum

什么都不出现就表示删干净了

3.yum源安装

源文件下载:https://pan.baidu.com/s/1XrJIkRW6G03mXD49Afekdg 提取码:wl06

下载后上传到服务器任意目录如:/usr/locl/yum 然后进入目录执行以下命令进行安装

安装命令:rpm -ivh *

安装时可能会提示缺少某个包的相关依赖到http://vault.centos.org/centos/7.4.1708/os/x86_64/Packages/里面找到并下载,上传,执行安装命令。

或者提示某个包冲突,把冲突的包删除掉后重新执行安装命令。

4. 创建文件

vim /etc/yum.repos.d/CentOS-Base.repo
写入:

[base]
name=CentOS- r e l e a s e v e r − B a s e b a s e u r l = h t t p : / / v a u l t . c e n t o s . o r g / c e n t o s / 7.4.1708 / o s / releasever - Base baseurl=http://vault.centos.org/centos/7.4.1708/os/ releaseverBasebaseurl=http://vault.centos.org/centos/7.4.1708/os/basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/centos/7.4.1708/os/x86_64/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS- r e l e a s e v e r − U p d a t e s b a s e u r l = h t t p : / / v a u l t . c e n t o s . o r g / c e n t o s / 7.4.1708 / u p d a t e s / releasever - Updates baseurl=http://vault.centos.org/centos/7.4.1708/updates/ releaseverUpdatesbaseurl=http://vault.centos.org/centos/7.4.1708/updates/basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/centos/7.4.1708/os/x86_64/RPM-GPG-KEY-CentOS-7

[extras]
name=CentOS- r e l e a s e v e r − E x t r a s b a s e u r l = h t t p : / / v a u l t . c e n t o s . o r g / c e n t o s / 7.4.1708 / e x t r a s / / releasever - Extras baseurl=http://vault.centos.org/centos/7.4.1708/extras// releaseverExtrasbaseurl=http://vault.centos.org/centos/7.4.1708/extras//basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/centos/7.4.1708/os/x86_64/RPM-GPG-KEY-CentOS-7

[centosplus]
name=CentOS- r e l e a s e v e r − P l u s b a s e u r l = h t t p : / / v a u l t . c e n t o s . o r g / c e n t o s / 7.4.1708 / c e n t o s p l u s / / releasever - Plus baseurl=http://vault.centos.org/centos/7.4.1708/centosplus// releaseverPlusbaseurl=http://vault.centos.org/centos/7.4.1708/centosplus//basearch/
gpgcheck=1
enabled=0

保存:wq

5. 清除缓存:yum clean all

6. 生成本地缓存:yum makecache

到此不报错的情况下就说明安装成功了,报错找相应的解决办法。

然后你就可以安装你想安装的东西啦!

运行yum install gcc-c++,成功安装!

你可能感兴趣的:(RedHat7.4或CentOS7.4安装yum源最新详解)