Redhat6.4环境下yum的安装与配置

来源:互联网 发布:java过滤器的原理 编辑:程序博客网 时间:2024/04/27 17:08

Redhat6.4环境下yum的安装与配置

本人参加工作不久,对于linux系统完全是毫无了解。前一段时间因为工作需要不得不接触linux系统。linux系统操作风格上与windows相去颇远,让初接触linux的人不甚习惯。使用linux系统的安装软件是颇为麻烦,因为linux系统的软件安装包经常存在依赖关系,想安装一些包的时候必须先解决它的依赖关系。而yum管理器会自动帮你处理包的依赖关系。因而在linux系统上使用yum安装包是一个极为便捷高效的方式。我之前为了在我的Redhat6.4上安装、配置yum百度了很长一段时间,看了很多人的blog。但是基本上网上能找到的资料都是14年以前的了,对于我当时的情况并不适用,费尽功夫,总算解决这个问题,在此和新手们分享一下。(我只在Redhat6.4和Ubuntu16.04上安装过,其他情况没有考虑)

· 第一步

首先,为保证安装顺利,请卸载自带或者之前安装不成功的yum
rpm -qa |grep yum | xargs rpm -e –nodeps
再次使用确认卸载完成
rpm -qa |grep yum

· 第二步

下载安装包
刚刚已经说过,linux系统上安装软件包经常要解决依赖关系,安装yum也不例外。安装yum就是为了自动处理包与包之间的依赖关系,但是安装yum时你还是得去自己下载包并解决依赖关系。在Redhat6.4下安装yum要用到以下5个包

python-iniparse-0.3.1-2.1.el6.noarch.rpm
python-urlgrabber-3.9.1-11.el6.noarch.rpm
yum-3.2.29-73.el6.centos.noarch.rpm
yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm

下载这五个包可以去网易的开源镜像点下载,镜像地址是:http://mirrors.163.com/ 当然了,国内还有其他的开源镜像如清华大学、阿里、搜狐等,至于镜像地址,就不一一提供了。
下载命令
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

其他四个包的下载命令一样,就不一一列举。这里需要注意的是你系统的版本号和位数。32位系统 i386,64位系统是x86_64,此外下载的时候要下载适合你的版本的包。

· 第三步

安装包
先安装python-iniparse-0.3.1-2.1.el6.noarch.rpm和python-urlgrabber-3.9.1-11.el6.noarch.rpm包,这两个包之间不存在依赖关系,顺序无所谓。
再次安装剩下的3个yum包,这3个包之间存在依赖关系,记得3个一起安装。
安装命令如下:
rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm
rpm -ivh yum-3.2.29-73.el6.centos.noarch.rpm yum-metadata-parser-1.1.2-16.el6.x86_64.rpm yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm

· 第四步

配置yum源
yum从你给他配置的yum源上下载包,所以请务必确认yum源配置正确,配置的地址都是有效地址。
编辑文件 /etc/yum.repos.d/rhel-source.repo,文件中之前的内容可以注释掉。
vi /etc/yum.repos.d/rhel-source.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-6 - Base - 163.combaseurl=http://mirrors.163.com/centos/6/os/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=osgpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#released updates[updates]name=CentOS-6 - Updates - 163.combaseurl=http://mirrors.163.com/centos/6/updates/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updatesgpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#additional packages that may be useful[extras]name=CentOS-6 - Extras - 163.combaseurl=http://mirrors.163.com/centos/6/extras/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extrasgpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#additional packages that extend functionality of existing packages[centosplus]name=CentOS-6 - Plus - 163.combaseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=centosplusgpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Users[contrib]name=CentOS-6 - Contrib - 163.combaseurl=http://mirrors.163.com/centos/6/contrib/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=contribgpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

注意你的地址,也可以填其他的有效地址。gpgkey的版本要填对。

· 第五步

清除yum缓存
yum clean all

· 第六步

加载yum缓存
yum makecache

· 第七步

如此一来yum就安装并配置完成了,测试一下吧。给自己安装一个ftp工具,便于在windows和linux之间传输文件。

yum install vsftp


1 0
原创粉丝点击