使用场景:
在未注册的linux上学习相关操作时,有时基于yum来安装软件依赖环境等非常便捷,因此特提供此处理方式。仅限于个人学习使用,特此声明!
1.卸载redhat自带的yum组件
rpm -qa|grep yum|xargs rpm -e --nodeps
2.安装centos的yum包
wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm
[root@localhost opt]# rpm -ivh yum-3.2.22-40.el5.centos.noarch.rpm
warning: yum-3.2.22-40.el5.centos.noarch.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
error: Failed dependencies:
yum-fastestmirror is needed by yum-3.2.22-40.el5.centos.noarch
yum-metadata-parser >= 1.1.0 is needed by yum-3.2.22-40.el5.centos.noarch
需要安装依赖包,因此分别下载并安装依赖包
[root@localhost opt]# wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-4.el5.x86_64.rpm
[root@localhost opt]# rpm -ivh yum-metadata-parser-1.1.2-4.el5.x86_64.rpm
warning: yum-metadata-parser-1.1.2-4.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:yum-metadata-parser ########################################### [100%]
[root@localhost opt]# wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
两个包相互依赖,一并安装解决
[root@localhost opt]# rpm -ivh yum-3.2.22-40.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
warning: yum-3.2.22-40.el5.centos.noarch.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:yum-fastestmirror ########################################### [ 50%]
2:yum ########################################### [100%]
wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo
mv CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo
4. 更新yum 资源库
yum makecache
[root@localhost opt]# 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
addons | 1.9 kB 00:00
addons/filelists_db | 570 B 00:00
addons/other_db | 554 B 00:00
addons/primary_db | 1.1 kB 00:00
base | 1.1 kB 00:00
base/filelists | 3.7 MB 00:20
base/other | 14 MB 01:14
base/group | 1.1 MB 00:06
base/primary | 1.3 MB 00:07
extras | 2.1 kB 00:00
extras/filelists_db | 224 kB 00:01
extras/other_db | 442 kB 00:02
extras/group | 9.7 kB 00:00
extras/primary_db | 173 kB 00:00
update | 1.9 kB 00:00
update/filelists_db | 1.1 MB 00:06
update/other_db | 6.3 MB 00:34
update/primary_db | 282 kB 00:01
base 3667/3667
base 3667/3667
base 3667/3667
Metadata Cache Created
5.有需要可以yum -y update