在没有光盘的情况,需要安装软件包,就要用到共网的yum源来安装了。
Redhat linux 默认是安装了yum软件的,但是由于激活认证的原因让redhat无法直接进行yum安装一些软件,如果我们需要在redhat下直接yum安装软件,我们只用把yum的源修改成centos的就好了,然后把源里面的变量全部修改成实际的值,这样就能使用yum直接安装我们需要的软件了。(文章还有一部分,未写完的。)
使用说明
1、到http://mirrors.163.com的 centos帮助文档 中下载CentOS6-Base-163.repo文件,存放到/etc/yum.repo.d中
Centos 5 wget http://mirrors.163.com/.help/CentOS5-Base-163.repo
Centos 6 wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
操作如下:
2、首先备份/etc/yum.repos.d/CentOS-Base.repo
3、编辑CentOS6-Base-163.repo文件,将其中的$releasever更改为centos的版本号,如果是RedHat 6.2 X86_64为例“baseurl=http://mirrors.163.com/centos/6.2/os/x86_64/”,本文档是以RedHat 6.2 32位为例所写!
[base]
name=CentOS-$releasever - Base - 163.com
baseurl=http://mirrors.163.com/centos/6/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/6/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/6/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/6/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/6/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
编辑完后保存,运行:
yum clean all 清除原有缓存
yum makecache 获取yum列表
本文转自ling118 51CTO博客,原文链接:http://blog.51cto.com/meiling/1248839,如需转载请自行联系原作者