redhat安装yum 提示404 Not Found
-
删除自带的yum
rpm -aq | grep yum | xargs rpm -e --nodeps
-
下载yum及其以来的插件
其他网络源地址
1.阿里云网络源地址:https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/ 2.centos网络源地址:http://centos.ustc.edu.cn/centos/7/os/x86_64/Packages/ 3.163网络源地址:http://mirrors.163.com/centos/7/os/x86_64/Packages/
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
需要下载的文件 - 用
ctrl + f
搜索对应的安装包 使用wget
命令下载- yum - yum-metadata-parser - yum-utils - yum-updateonboot - yum-plugin-fastestmirror
-
安装
rpm -ivh yum-*
遇到报错,依赖问题
[root@localhost /]# rpm -ivh yum-* 警告:yum-2.0.8-1.src.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID : NOKEY 警告:yum-3.4.3-168.el7.centos.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID : NOKEY 错误:依赖检测失败: python-urlgrabber >= 3.10-8 被 yum-3.4.3-168.el7.centos.noarch 需要 rpm >= 0:4.11.3-22 被 yum-3.4.3-168.el7.centos.noarch 需要
去网络源站下载需要的安装包
- python-urlgrabber - rpm
更新
rpm -Uvh python-urlgrabber-3.10-10.el7.noarch.rpm --nodeps rpm -Uvh rpm-4.11.3-45.el7.x86_64.rpm --nodeps
再次运行安装命令
rpm -ivh yum-*
-
打开repo文件:
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-7 - Base - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/7/os/$basearch/ http://mirrors.aliyuncs.com/centos/7/os/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/7/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-7 - Updates - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/7/updates/$basearch/ http://mirrors.aliyuncs.com/centos/7/updates/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/7/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-7 - Extras - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/7/extras/$basearch/ http://mirrors.aliyuncs.com/centos/7/extras/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/7/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-7 - Plus - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/7/centosplus/$basearch/ http://mirrors.aliyuncs.com/centos/7/centosplus/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/7/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #contrib - packages by Centos Users [contrib] name=CentOS-7 - Contrib - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/7/contrib/$basearch/ http://mirrors.aliyuncs.com/centos/7/contrib/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/7/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
-
清理-建立缓存
yum -y clean all yum -y makecache
-
遇到的坑:安装后自动创建了一个repo文件使用这个文件创建缓存时提示404
http://mirrors.aliyun.com/centos/%24releasever/extras/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
需要将文件中的所有==$releaseve== 改为版本号,例如7
http://mirrors.aliyun.com/centos/7/os/$basearch/