redhat 中 yum的安装以及软件源的更新

来源:互联网 发布:淘宝店描述 编辑:程序博客网 时间:2024/06/10 10:45

我们使用网址

ftp://ftp.twaren.net/Linux/CentOS/6/os/x86_64/

首先使用命令

lsb_release -a

来查看系统版本,得到

LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarchDistributor ID: RedHatEnterpriseClientDescription:    Red Hat Enterprise Linux Client release 6.4 (Santiago)Release:    6.4Codename:   Santiago

依据版本为6.4安装版本为6的源

1、删除redhat原有的yum源

# rpm -aq | grep yum|xargs rpm -e --nodeps

2、下载新的yum安装包
  这里我们使用CentOS的yum源

# wget ftp://ftp.twaren.net/Linux/CentOS/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm# wget ftp://ftp.twaren.net/Linux/CentOS/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm# wget ftp://ftp.twaren.net/Linux/CentOS/6/os/x86_64/Packages/yum-3.2.29-69.el6.centos.noarch.rpm# wget ftp://ftp.twaren.net/Linux/CentOS/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm

3、安装yum软件包

# rpm -ivh  python-iniparse-0.3.1-2.1.el6.noarch.rpm# rpm -ivh  yum-metadata-parser-1.1.2-16.el6.x86_64.rpm# rpm -ivh  yum-3.2.29-69.el6.centos.noarch.rpm  yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm

注意:最后两个安装包要放在一起同时安装,否则会提示相互依赖,安装失败。
4、更改yum源 #我们使用ftp://ftp.twaren.net/Linux/CentOS/6/os/x86_64/镜像源
将/etc/yum.repos.d/rhel-source.repo中的baseurl修改

# 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.combaseurl=ftp://ftp.twaren.net/Linux/CentOS/6/os/x86_64/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=osgpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#released updates [updates]name=CentOS-$releasever - Updates - 163.combaseurl=ftp://ftp.twaren.net/Linux/CentOS/6/updates/x86_64/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updatesgpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#additional packages that may be useful[extras]name=CentOS-$releasever - Extras - 163.combaseurl=ftp://ftp.twaren.net/Linux/CentOS/6/extras/x86_64/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&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-$releasever - Plus - 163.combaseurl=ftp://ftp.twaren.net/Linux/CentOS/6/centosplus/x86_64/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplusgpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Users[contrib]name=CentOS-$releasever - Contrib - 163.combaseurl=ftp://ftp.twaren.net/Linux/CentOS/6/contrib/x86_64/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contribgpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

5、清理yum缓存

# yum clean all
0 0