网易centos的yum源添加

实验环境:内核版本及Rhel的发行版本

[root@localhost yum.repos.d]# uname -r  
2.6.32-279.el6.i686  
[root@localhost yum.repos.d]# cat /etc/redhat-release   
Red Hat Enterprise Linux Server release 6.3 (Santiago)

正文


进入网易开源镜像站

点击进入centos使用帮助,下载centos6的repo文件,将其放入/etc/yum.repos.d文件夹

[root@localhost yum.repos.d]# pwd  
/etc/yum.repos.d  
[root@localhost yum.repos.d]# ls  
CentOS6-Base-163.repo  


此时你会发现该yum源并未搭建成功

[root@localhost yum.repos.d]# yum clean all
省略。。。。。。
Cleaning up Everything
[root@localhost yum.repos.d]# yum repolist
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
http://mirrors.163.com/centos/6Server/os/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404"
Trying other mirror.
repo id                repo name                                          status
base                   CentOS-6Server - Base - 163.com                    0
extras                 CentOS-6Server - Extras - 163.com                  0
updates                CentOS-6Server - Updates - 163.com                 0
repolist: 0

查看repo文件如下

[root@localhost yum.repos.d]# cat 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/$releasever/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/$releasever/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/$releasever/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/$releasever/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/$releasever/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  

问题出现在$releasever这个变量上,用vim编辑器利用末行模式把它全文替换成6就行了, (:%s/$releasever/6/g)


替换后的repo文件

[root@localhost yum.repos.d]# cat 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-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


为何不是6.3呢,查看 网易开源镜像站centos6.3可见一个readme文件,内容如下

This directory (and version of CentOS) is depreciated.  For normal users,
you should use /6/ and not /6.3/ in your path. Please see this FAQ
concerning the CentOS release scheme:

http://www.centos.org/modules/smartfaq/faq.php?faqid=34

If you know what you are doing, and absolutely want to remain at the 6.3
level, go to http://vault.centos.org/ for packages. 

Please keep in mind that 6.0, 6.1, 6.2 and 6.3 no longer gets any updates, nor
any security fix's.

大概意思就是无论6.1,6.2,6.3你都用6就行了

替换后,保存退出vim,网易centos的yum源就搭建好了。

测试装lftp软件,成功。

[root@localhost yum.repos.d]# lftp
bash: lftp: command not found
[root@localhost yum.repos.d]# yum install lftp 
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package lftp.i686 0:4.0.9-1.el6_5.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package       Arch          Version                     Repository        Size
================================================================================
Installing:
 lftp          i686          4.0.9-1.el6_5.1             updates          735 k

Transaction Summary
================================================================================
Install       1 Package(s)

Total download size: 735 k
Installed size: 2.3 M
Is this ok [y/N]: y
Downloading Packages:
lftp-4.0.9-1.el6_5.1.i686.rpm                            | 735 kB     00:13     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : lftp-4.0.9-1.el6_5.1.i686                                    1/1 
Installed products updated.
  Verifying  : lftp-4.0.9-1.el6_5.1.i686                                    1/1 

Installed:
  lftp.i686 0:4.0.9-1.el6_5.1                                                   

Complete!

总结要点:

1.从网易上下载repo文件

2.把repo文件中的$releasever替换成6(:%s/$releasever/6/g)


-----------------------------------------------我是机智的分隔符---------------------------------------------------------------

2014-6-30 17:33:56
不容易啊,在这六月份的尾巴,准确来说应该是六月份的尾巴尖尖,人生中第一篇博客终于写出来了,法克拖延症啊啊啊啊,从4月月底就准备写了,然后一直拖延到现在,写这篇时原本还打算写点个人对yum软件安装的一些理解的以及推荐两个找RPM安装包的神奇的网站,但是一不小心就发现这篇加上命令及命令输出结果
之后竟然有点小长了,所以我想了想,明天再写吧~~

写这个第一次的博客时,脑子里也不断的想起已经看完的《疯狂的程序员》,还有未看完的《一个程序员的奋斗史》,初次知道csdn就是由于绝影的《疯狂的程序员》,记得那时看完电子版后,花了好几天时间在图书馆找这本书,不过还是没找到,次奥,图书馆的二楼小说区实在杂乱的不行~~然后前段时间考6级在图书馆复习的时候,发现了莫雨的《一个程序员的奋斗史》,哈哈,写的真心搞笑,不过看了几十页之后,就考完六级了,然后就木有去过图书馆了,把她借了在寝室,最终几乎没翻过,因为六级憋了好久木有和小伙伴们愉快的开黑鸟~~尴尬啊,然后哥还带着这本厚厚的书搬到了操蛋的新寝~~回校后,每天抽点时间把她看完哒~~

来csdn也是为了近距离摸摸这两个大牛~~想想有点好激动啊好激动~~

2014-6-30 21:50:36

-----------------------------------------------我是机智的分隔符---------------------------------------------------------------


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值