RHEL 6.3 as 64bit 配置yum源

幽映每白日,清辉照衣裳。这篇文章主要讲述RHEL 6.3 as 64bit 配置yum源相关的知识,希望能为你提供帮助。
1、查询redhat原有的yum
[root@localhost ~]# rpm -qa |grep yum
yum-metadata-parser-1.1.2-16.el6.x86_64
yum-rhn-plugin-0.9.1-40.el6.noarch
yum-plugin-security-1.1.30-14.el6.noarch
PackageKit-yum-0.5.8-20.el6.x86_64
yum-utils-1.1.30-14.el6.noarch
PackageKit-yum-plugin-0.5.8-20.el6.x86_64



2、删除redhat原有的yum
[root@localhost ~]# rpm -aq|grep yum|xargs rpm -e --nodeps
[root@localhost yum.repos.d]# whereis yum
yum: /etc/yum
[root@localhost yum.repos.d]# rm -rf /etc/yum



3、下载yum安装文件
在下载地址(http://mirrors.163.com/centos/6.6/os/x86_64/Packages/) 中
(以后centos升级,软件包会挪位置,一般从http://mirrors.163.com/centos 进去,找最新的系统版本即可)
rpm文件:
python-iniparse-0.3.1-2.1.el6.noarch.rpm
yum-3.2.29-60.el6.centos.noarch.rpm
yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm


4、安装yum的rpm包
rpm -ivh python*
rpm -ivh yum*

[root@localhost yum]# rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm warning: python-iniparse-0.3.1-2.1.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY Preparing...########################################### [100%] package python-iniparse-0.3.1-2.1.el6.noarch is already installed [root@localhost yum]# rpm -ivh yum-* warning: yum-3.2.29-60.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY Preparing...########################################### [100%] 1:yum-metadata-parser########################################### [ 33%] 2:yum-plugin-fastestmirro########################################### [ 67%] 3:yum########################################### [100%] [root@localhost yum]#


5、更改yum源(我们使用网易的CentOS镜像源)
[root@localhost yum]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# rm -rf *
[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
[root@localhost yum.repos.d]# vi CentOS6-Base-163.repo
将所有 $releasever 修改为具体的版本号,我这里写的是6.6,以后centos再更新,有可能是6.7、6.8等,这个自己打开(http://mirrors.163.com/centos)找一下就可以。


如下为服务器操作记录:


[root@localhost yum]# cd /etc/yum.repos.d/ [root@localhost yum.repos.d]# ll total 12 -rw-r--r--. 1 root root 4440 Nov 20 02:30 CentOS-Base.repo -rw-r--r--. 1 root root529 May 302012 rhel-source.repo.bak [root@localhost yum.repos.d]# rm -rf * [root@localhost yum.repos.d]#wget http://mirrors.163.com/.help/CentOS6-Base-163.repo --2014-11-20 18:55:19--http://mirrors.163.com/.help/CentOS6-Base-163.repo Resolving mirrors.163.com... 123.58.173.106 Connecting to mirrors.163.com|123.58.173.106|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 2006 (2.0K) [application/octet-stream] Saving to: ?.entOS6-Base-163.repo?100%[=======================================================> ] 2,006--.-K/sin 0.03s2014-11-20 18:55:19 (63.8 KB/s) - ?.entOS6-Base-163.repo?.saved [2006/2006][root@localhost yum.repos.d]# vi CentOS6-Base-163.repo


我的 CentOS6-Base-163.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-$releasever - Base - 163.com baseurl=http://mirrors.163.com/centos/6.6/os/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever& arch=$basearch& repo=os gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#released updates [updates] name=CentOS-$releasever - Updates - 163.com baseurl=http://mirrors.163.com/centos/6.6/updates/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever& arch=$basearch& repo=updates gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#additional packages that may be useful [extras] name=CentOS-$releasever - Extras - 163.com baseurl=http://mirrors.163.com/centos/6.6/extras/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever& arch=$basearch& repo=extras gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus - 163.com baseurl=http://mirrors.163.com/centos/6.6/centosplus/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever& arch=$basearch& repo=centosplus gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib - 163.com baseurl=http://mirrors.163.com/centos/6.6/contrib/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever& arch=$basearch& repo=contrib gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6


6、缓存处理
清理yum缓存

yum clean all
将服务器上的软件包信息缓存到本地,以提高搜索安装软件的速度

yum makecache

安装gcc

yum install gcc
至此,我们就可以使用yum安装和更新软件了。

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
结束










【RHEL 6.3 as 64bit 配置yum源】


    推荐阅读