RedHat 6配置yum源为网易镜像(转)

时间:2021-10-17 19:47:59

概述

  由于版权的问题,RedHat6不能直接使用yum一些指令,需要配置yum源为网易镜像,但是网上谈到很多;整理一下,将有用的信息整理如下,以便于能够为其他的配置服务配置使用;需要卸载掉原理系统自带的yum指令,下载安装新的yum;

操作步骤:

1.删除redhat原有的yum

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

2.下载yum安装文件
注意,如果下载时找不到文件,就登录到:http://mirrors.163.com/centos/6/os/x86_64/ 上查找相应的文件。然后再下载,部分rpm包版本可能有所不同,如果报404可到http://mirrors.163.com/centos/6/os/x86_64/Packages/搜索包名即可。

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm  

如果网易地址下载失败,可以通过这链接下载

3.进行安装yum

rpm -ivh python-iniparse-0.3.-2.1.el6.noarch.rpm

rpm -ivh yum-metadata-parser-1.1.-.el6.x86_64.rpm

rpm -ivh --force python-urlgrabber-3.9.-.el6.noarch.rpm 

rpm -ivh yum-3.2.-.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.-.el6.noarch.rpm

注意最后两个包必需同时安装,否则会相互依赖

4.更新repo文件

mv /etc/yum.repos.d/rhel-source.repo /etc/yum.repos.d/rhel-source.repo.bak

vi /etc/yum.repos.d/rhel-debuginfo.repo

[base]

name=CentOS-$releasever - Base

baseurl=http://mirrors.163.com/centos/6/os/$basearch/

gpgcheck=

gpgkey=http://mirrors.163.com/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6

#released updates

[updates]

name=CentOS-$releasever - Updates

baseurl=http://mirrors.163.com/centos/6/updates/$basearch/

gpgcheck=

gpgkey=http://mirrors.163.com/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6

#packages used/produced in the build but not released

#[addons]

#name=CentOS-$releasever - Addons

#baseurl=http://mirrors.163.com/centos/6/addons/$basearch/

#gpgcheck=

#gpgkey=http://mirrors.163.com/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful

[extras]

name=CentOS-$releasever - Extras

baseurl=http://mirrors.163.com/centos/6/extras/$basearch/

gpgcheck=

gpgkey=http://mirrors.163.com/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-$releasever - Plus

baseurl=http://mirrors.163.com/centos/6./centosplus/$basearch/

gpgcheck=

enabled=

5、yum clean all
6、yum install vim #测试一下可不可以用,以下为部署成功后的运行界面;

7、安装gcc

yum -y install gcc

参考网站

http://blog.csdn.net/liuhuoxingkong/article/details/75949704(很好的网址)

https://www.jianshu.com/p/446e3fe7d710(不错哇,但是内容不全,可以查看上一个网址一起看)

http://blog.csdn.net/echocourage/article/details/76425210

http://blog.csdn.net/studyforir/article/details/48244645