redhat更改自带的yum

#redhat使用minimal的方式安装

#查看原来的yum源
[root@redhat home]# rpm -qa|grep yum
yum-3.2.29-40.el6.noarch
yum-rhn-plugin-0.9.1-48.el6.noarch
yum-metadata-parser-1.1.2-16.el6.x86_64

#卸载
[root@redhat home]# rpm -qa|grep yum |xargs rpm -e
error: Failed dependencies:
	yum is needed by (installed) rhn-client-tools-1.0.0.1-16.el6.noarch
	yum >= 3.2.19-15 is needed by (installed) subscription-manager-1.9.11-1.el6.x86_64
	yum-rhn-plugin >= 0.9.1-35 is needed by (installed) rhn-check-1.0.0.1-16.el6.noarch

#强制卸载
[root@redhat home]# rpm -qa|grep yum |xargs rpm -e --nodeps

#查看已经卸载完成
[root@redhat home]# rpm -qa|grep yum

接下来上传centos的yum包

#直接在centos镜像提取的包

1. python-urlgrabber-3.9.1-11.el6.noarch.rpm 
2. yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
3. yum-3.2.29-81.el6.centos.noarch.rpm
4. yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm
#3与4一起安装
#如果无法上传就安装一个lrzsz,用完不需要可以卸载了
#下载包的目录
http://rpm.pbone.net/index.php3/stat/4/idpl/40679993/dir/centos_6/com/lrzsz-0.12.20-27.1.el6.x86_64.rpm.html
#直接下载
wget ftp://mirror.switch.ch/pool/4/mirror/centos/6.9/os/x86_64/Packages/lrzsz-0.12.20-27.1.el6.x86_64.rpm

#wget也没有,那就用curl下载
[root@redhat software]# curl -O  ftp://mirror.switch.ch/pool/4/mirror/centos/6.9/os/x86_64/Packages/lrzsz-0.12.20-27.1.el6.x86_64.rpm
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 72436  100 72436    0     0   3486      0  0:00:20  0:00:20 --:--:-- 69052
[root@redhat software]# ls
lrzsz-0.12.20-27.1.el6.x86_64.rpm
[root@redhat software]# rpm -ivh lrzsz-0.12.20-27.1.el6.x86_64.rpm 
warning: lrzsz-0.12.20-27.1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
   1:lrzsz                  ########################################### [100%]

yum安装

#安装yum包,有依赖关系,那么从头开始安装
[root@redhat yum]# rpm -ivh yum-3.2.29-81.el6.centos.noarch.rpm 
warning: yum-3.2.29-81.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
error: Failed dependencies:
	python-urlgrabber >= 3.9.1-10 is needed by yum-3.2.29-81.el6.centos.noarch
	yum-metadata-parser >= 1.1.0 is needed by yum-3.2.29-81.el6.centos.noarch
	yum-plugin-fastestmirror is needed by yum-3.2.29-81.el6.centos.noarch
[root@redhat yum]# rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm 

-------------------------------------------------------------------------------------------------------
#python-urlgrabber,已经存在,版本较低,那就升级了
[root@redhat yum]# rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm 
warning: python-urlgrabber-3.9.1-11.el6.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
	file /usr/lib/python2.6/site-packages/urlgrabber/grabber.py from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-9.el6.noarch
	file /usr/lib/python2.6/site-packages/urlgrabber/grabber.pyc from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-9.el6.noarch
	file /usr/lib/python2.6/site-packages/urlgrabber/grabber.pyo from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-9.el6.noarch
	file /usr/lib/python2.6/site-packages/urlgrabber/progress.pyc from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-9.el6.noarch
	file /usr/lib/python2.6/site-packages/urlgrabber/progress.pyo from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-9.el6.noarch

[root@redhat yum]# rpm -qa |grep python-urlgrabber 
python-urlgrabber-3.9.1-9.el6.noarch
#升级
[root@redhat yum]# rpm -Uvh python-urlgrabber-3.9.1-11.el6.noarch.rpm 
warning: python-urlgrabber-3.9.1-11.el6.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
   1:python-urlgrabber      ########################################### [100%]
[root@redhat yum]# rpm -qa |grep python-urlgrabber 
python-urlgrabber-3.9.1-11.el6.noarch
-------------------------------------------------------------------------------------------------------
#2.yum-metadata-parse
[root@redhat yum]# rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm 
warning: yum-metadata-parser-1.1.2-16.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
   1:yum-metadata-parser    ########################################### [100%]

#3.yum-plugin-fastestmirror,与yum想互依赖
[root@redhat yum]# rpm -ivh yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm 
warning: yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
error: Failed dependencies:
	yum >= 3.0 is needed by yum-plugin-fastestmirror-1.1.30-40.el6.noarch

[root@redhat yum]# rpm -ivh yum-3.2.29-81.el6.centos.noarch.rpm 
warning: yum-3.2.29-81.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
error: Failed dependencies:
	yum-plugin-fastestmirror is needed by yum-3.2.29-81.el6.centos.noarch
#唯有一起安装了
[root@redhat yum]# rpm -ivh yum-3.2.29-81.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm 
warning: yum-3.2.29-81.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
   1:yum-plugin-fastestmirro########################################### [ 50%]
   2:yum                    ########################################### [100%]

配置yum源

#下载阿里云的yum源,版本是Centos6
[root@redhat ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
102  2572  102  2572    0     0  39592      0 --:--:-- --:--:-- --:--:-- 91857

#建立缓存的时候出现这个错误
[root@redhat yum.repos.d]# yum makecache
Loaded plugins: fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
http://mirrors.aliyun.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.

http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: (28, 'connect() timed out!')
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again

#http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml,发现这链接不对,版本号没有显示,那么就手动改吧。

-------------------------------------------------------------------------------------------------------

#清空所有的缓存
[root@redhat yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: base extras updates
Cleaning up Everything
Cleaning up list of fastest mirrors
\#虽然提示没有注册,但是并不影响使用,

#重新建立缓存
[root@redhat yum.repos.d]# yum makecache
Loaded plugins: fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                            | 3.7 kB     00:00     
base/group_gz                                                   | 226 kB     00:00     
base/filelists_db                                               | 6.4 MB     00:01     
base/primary_db                                                 | 4.7 MB     00:01     
base/other_db                                                   | 2.8 MB     00:00     
extras                                                          | 3.4 kB     00:00     
extras/filelists_db                                             |  26 kB     00:00     
extras/prestodelta                                              | 1.7 kB     00:00     
extras/primary_db                                               |  30 kB     00:00     
extras/other_db                                                 |  32 kB     00:00     
updates                                                         | 3.4 kB     00:00     
updates/filelists_db                                            | 4.7 MB     00:00     
updates/prestodelta                                             | 270 kB     00:00     
updates/primary_db                                              | 7.5 MB     00:00     
updates/other_db                                                | 108 MB     00:14     
Metadata Cache Created

#安装一个vim试试
[root@redhat yum.repos.d]# yum -y install vim
Loaded plugins: fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
.........省略............  
Complete!


猜你喜欢

转载自blog.51cto.com/hongdouzi555/2119856