redhat yum不能使用

1.yum install xxx 提示 -bash: yum: command not found

解决办法: rpm -qa | grep yum

查看有无yum,有的话卸载  rpm -aq|grep yum|xargs rpm -e --nodeps

2.下载需要的4个yum安装文件 (http://mirrors.163.com/centos/6/os/x86_64/Packages/

yum-3.2.29-81.el6.centos.noarch.rpm
yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm
python-iniparse-0.3.1-2.1.el6.noarch.rpm

3.下载(如果下载不了,可以自己下载后再上传)

1.wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm

2.wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

3.wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm

4.wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

4.安装

rpm -ivh --force --nodeps python-iniparse-0.3.1-2.1.el6.noarch.rpm

rpm -ivh --force --nodeps yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

rpm -ivh --force --nodeps yum-3.2.29-81.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm

注意:最后两个包必须痛还是安装,否则报依赖出错

5.配置yum 源

yum install -y wget 先安装wget为下载网络yum源做准备,有的话就不必装了

替换 yum源

1. cd /etc/yum.repos.d 

2. 将原来的备份 mv yum.repo yum.repo.bak

3.下载阿里云的yum源   wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

4.下载后生成缓存     yum makecache

6.报错:This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register

[Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"

解决办法:sed -i 's/\$releasever/6/' CentOS-Base.repo   后面的6代表的是rehat的 版本

重新生成缓存

yum clean all  

yum makecache

7.查看yum源是否配置完成

yum repolist

数字不为0,就成功了

猜你喜欢

转载自blog.csdn.net/qq_36260963/article/details/87913243
今日推荐