RedHat 系统使用yum网络源

RedHat Linux自带的yum网络资源不如CentOS,所以需要先卸载自带yum,并下载安装centOS的yum

以下安装的是centos 5的,也可以参照,安装centos6的

1.下载centos的yum,使用centos 5

下载前最好在浏览器中打开 http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/,查看对应的软件版本是否已经升级,并修改下载地址为响应的新版本,

#wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-3.2.22-33.el5.centos.noarch.rpm
#wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm
#wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm

 

2. 查出当前的yum程序,进行卸载


#rpm -qa|grep yum 这句是列出当前的yum程序好卸载


# rpm -e yum-3.2.22-20.el5 --nodeps
# rpm -e yum-updatesd-0.9-2.el5 --nodeps
# rpm -e yum-security-1.1.16-13.el5 --nodeps
# rpm -e yum-metadata-parser-1.1.2-3.el5 --nodeps
# rpm -e yum-rhn-plugin-0.5.4-13.el5 --nodeps


3. 下载并导入KEY
# cd /etc/pki/rpm-gpg/
# wget http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEYCentOS-5


4. 安装yum安装包
rpm -ivh yum-3.2.22-33.el5.centos.noarch.rpm \
yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm \
yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm

5. 创建配置文件


Vi /etc/yum.repos.d/local.repo(或直接在此位置上用文本编辑器打开创建的local.repo,复制黏贴如下内容)


[base]
name=Red Hat Enterprise Linux $releasever -Base
baseurl=http://mirrors.sohu.com/centos/5.5/os/$basearch/
gpgcheck=1


[update]
name=Red Hat Enterprise Linux $releasever -Updates
baseurl=http://mirrors.sohu.com/centos/5.5/updates/$basearch/
gpgcheck=1


[extras]
name=Red Hat Enterprise Linux $releasever -Extras
baseurl=http://mirrors.sohu.com/centos/5.5/extras/$basearch/
gpgcheck=1


[addons]
name=Red Hat Enterprise Linux $releasever -Addons
baseurl=http://mirrors.sohu.com/centos/5.5/addons/$basearch/
gpgcheck=1


至此yum安装完成,

在 yum install 安装程序前,最好先输入下列指令

#yum clean all

#yum update

红色背景或是红色字,表示这些都是应该根据网站列出的版本更改,或是根据本地电脑路径什么的,需要更改的

推荐阅读

RedHat Linux 本地yum源的配置 http://www.linuxidc.com/Linux/2013-08/88217.htm

RedHat 6.2 Linux修改yum源免费使用CentOS源 http://www.linuxidc.com/Linux/2013-07/87383.htm

配置EPEL YUM源 http://www.linuxidc.com/Linux/2012-10/71850.htm

Redhat 本地yum源配置 http://www.linuxidc.com/Linux/2012-11/75127.htm

yum的配置文件说明 http://www.linuxidc.com/Linux/2013-04/83298.htm

RedHat 6.1下安装yum(图文) http://www.linuxidc.com/Linux/2013-06/86535.htm

YUM 安装及清理 http://www.linuxidc.com/Linux/2013-07/87163.htm

Redhat 使用CentOS的yum进行升级或软件安装 分类: linux 2012-07-19 15:54 1113人阅读 评论(0) 收藏 举报 Redhat默认的不但速度不给力,而且软件版本陈旧,今天试着将Redhat默认替换为CentOS的163,发现速度能达到2M/s左右,而且版本都比较新,非常给力,与大家分享! (目前可以使用CentOS0-6.3软件仓库的软件) 1. 删除原有的yum 1. # rpm -aq | grep yum|xargs rpm -e --nodeps 2.下载新的yum安装包,这里使用centos-6.3 1. # wget http://mirror.centos.org/centos/6.3/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm 2. # wget http://mirror.centos.org/centos/6.3/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm 3. # wget http://mirror.centos.org/centos/6.3/os/x86_64/Packages/yum-3.2.29-30.el6.centos.noarch.rpm 4. # wget http://mirror.centos.org/centos/6.3/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm 3.安装yum软件包 1. #rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm 2. # rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm 3. #rpm -ivh yum-3.2.29-30.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm 4. 更改yum 在/etc/yum.repos.d/新建文件centos.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.com baseurl=http://mirrors.163.com/centos/6/os/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 #released updates [updates] name=CentOS-6 - Updates - 163.com baseurl=http://mirrors.163.com/centos/6/updates/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=6&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-6 - Extras - 163.com baseurl=http://mirrors.163.com/centos/6/extras/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=6&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-6 - Plus - 163.com baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=6&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-6 - Contrib - 163.com baseurl=http://mirrors.163.com/centos/6/contrib/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=contrib gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 5.清理yum缓存 1. # yum clean all 2. # yum makecache #将服务器上的软件包信息缓存到本地,以提高搜索安装软件的速度 3. # yum install software_name #测试新是否可用 6.更新系统 #yum update -y # yum install nginx chkconfig --level 345 nginx on /etc/init.d/nginx start yum --enablerepo=remi install php php-fpm chkconfig --level 345 php-fpm on /etc/init.d/php-fpm restart vi /etc/nginx/nginx.conf /etc/init.d/nginx reload vi /usr/share/nginx/html/info.php 1.
redhat 7.2 可用的yum, 亲自测试可以使用使用过程: 1.卸载已经存在的yum: rpm -qa | grep yum | xargs rpm -e --nodeps 2.将yum 文件放到server中 3.执行rpm -ivh yum-* 4.创建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 #mirrorlist=http://mirrorlist.centos.org/?release=$7&arch;=$basearch&repo=os baseurl=http://mirrors.163.com/centos/7/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$7 - Updates - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$7&arch;=$basearch&repo=updates baseurl=http://mirrors.163.com/centos/7/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-$7 - Extras - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$7&arch;=$basearch&repo=extras baseurl=http://mirrors.163.com/centos/7/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/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/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 5.测试是否安装成功 yum -y install tree
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值