redHat安装yum

安装过Linux软件的用户就知道,有时我们安装一个软件,需要依赖其他软件,所以必需找全所有的软件,这是一个极其麻烦的事情,有没什么方式可以让它自己去找依赖呢?
答案当然是肯定,这就需要我们配置一个神器——yum,通过它,我们可以直接安装软件的,我们只需知道软件的名称就可以的,让它把所有的依赖都直接关联起来安装。不过本人最近一段时间使用yum的时候,发现一个很恶心的事情,就是redhat自带的yum非常令人讨厌。

由于 redhat的yum在线更新是收费的,如果没有注册的话不能使用,如果要使用,需将redhat的yum卸载后,重启安装,再配置其他源,以下为详细过程:

一、更改yum软件
1.删除RHEL的yum--这个yum很让人郁闷,总是显示那几行disable的字,很烦人,直接卸载系统自带的yum
[plain]
rpm -aq | grep yum | xargs rpm -e --nodeps  
 
2.下载CentOS的yum及其依赖的插件
[plain]
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-118.el7.centos.noarch.rpm  
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm  
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-24.el7.noarch.rpm  
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm  
如果以上的镜像找不到,请查找其他的镜像即可,如:http://mirrors.sohu.com/centos/7/os/x86_64/Packages/

3.安装新的yum
[plain]
rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm  
rpm -ivh yum-plugin-fastestmirror-1.1.31-24.el7.noarch.rpm yum-3.4.3-118.el7.centos.noarch yum-metadata-parser-1.1.4-10.el7.x86_64.rpm  

5. 修改配置文件
mv /etc/yum.repos.d/rhel-debuginfo.repo  /etc/yum.repos.d/rhel-debuginfo.repo.bak
vi /etc/yum.repos.d/rhel-debuginfo.repo
如果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 - 163.com
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

#released updates 
[updates]
name=CentOS-7 - Updates - 163.com
baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-7 - Extras - 163.com
baseurl=http://mirrors.163.com/centos/7/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-7 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7


6、清理yum源
yum clean all  

7、yum install vim #测试一下可不可以用

8、yum提示another app is currently holding the yum lock;waiting for it to exit
可能是系统自动升级正在运行,yum在锁定状态中。
可以通过强制关掉yum进程:
#rm -f /var/run/yum.pid
然后就可以使用yum了。

附参考url:
http://www.th7.cn/system/lin/201309/44616.shtml
http://www.th7.cn/system/lin/201306/41082.shtml

posted @ 2015-03-10 21:40  Mitu  阅读(131)  评论(0)    收藏  举报