Linux 安装 YUM《2017最新链接》 以及远程仓

系统:readhat   6.2  linux


1、确认RedHat的版本


cat /etc/redhat-release

uname -m


我的是  x86_64


2、在这里手工找rpm包:http://mirrors.163.com/centos/


系统6.2,按里面的readme,使用6.0,进入6.0目录,是x86_64,因此依次进入以下目录:os/x86_64/Packages/


找以下几份文件下载:


这里版本必须一致 我尝试过修改一个版本的包,然后全部报错

3、卸载原自带的yum:
rpm -aq|grep yum|xargs rpm -e --nodeps

4、安装yum软件,按以下顺序:

rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-16.el6.i686.rpm
rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

注意: 最后两个安装包要放在一起同时安装 ,否则会提示相互依赖,安装失败。

5、添加最新的yum源《网上163的 早不能用了  现在这才是Centos官网最新的地址   http://vault.centos.org/6.4/os



# cd /etc/yum.repos.d/
# vim MY.repo

[base]
name=CentOS-6.4 - Base - 163.com
baseurl=http://vault.centos.org/6.4/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://vault.centos.org/6.4/os/x86_64/RPM-GPG-KEY-CentOS-6


#released updates 
[updates]
name=CentOS-6.5 - Updates - 163.com
baseurl=http://vault.centos.org/6.4/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://vault.centos.org/6.4/os/x86_64/RPM-GPG-KEY-CentOS-6


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


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


#contrib - packages by Centos Users
[contrib]
name=CentOS-6.4 - Contrib - 163.com
baseurl=http://vault.centos.org/6.4/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://vault.centos.org/6.4/os/x86_64/RPM-GPG-KEY-CentOS-6
# vi CentOS6-Base-163.repo
  编辑文件, 把文件里面的$releasever全部替换为版本号,即6 最后保存!

网页上下载地址:http://mirrors.163.com/centos/6/os/x86_64/Packages/  和文件内写的字段一样 看清楚!

6、导入key
# rpm --import http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
7、清理yum缓存
# yum clean all
# yum makecache     #将服务器上的软件包信息缓存到本地,以提高搜索安装软件的速度
# yum install vim*    #测试yum是否可用
  至此,Redhat6可以使用CentOS的yum源在线安装软件了!

你可能感兴趣的:(linux)