如何设置redhat使用centos源,可以借助yum工具进行安装各种所需的包,以及进行系统升级。
这里设置的是redhat6.0 对应的centos版本也是6.0 内核版本是2.6.32-71.el6.x86_64
这里base源设置的是163的镜像站
而epel扩展源使用的则是sohu镜像站
1.首先确认yum相关的rpm包,并卸载
rpm -aq|grep yum|xargs rpm -e --nodeps
2.下载163相关rpm 包
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-69.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastetmirror-1.1.30-30.el6.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/python-iniparse-0.3.1-2.1.el6.noarch.rpm
python-iniparse-0.3.1-2.1.el6.noarch.rpm
yum-3.2.29-69.el6.centos.noarch.rpm
yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
需要注意的是,yum-3.2.29-69.el6.centos.noarch.rpm与yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm这两个包需要一起安装。
3.下载163源的配置文件
若/etc/yum.repos.d/下有别的文件,最好先进行备份操作
若没有直接
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
编辑此文件:
将mirrorlist都注释掉,添加baseurl
将所有的$releasever改为你的版本号6(注:这里这所以要改6,是redhat6.0与centos6.0的内核版本一致)保存退出
如果是64的系统要将$basearch这个改为x86_64
[base]
name=CentOS-$releasever - Base - 163.com
baseurl=http://mirrors.163.com/centos/6/os/x86_64/
#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/x86_64/
#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/x86_64/
#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/x86_64/
#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/x86_64/
#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
5测试,先清空yum缓存
yum clean all
6.再生成新的缓存
yum makecache
之后再用yum list来看看包,如果没有问题就可以使用共网centos的yum源安装了。
配置epel源
1.首先是安装epel源
yum list |grep epel
或者直接下载:
wget http://mirrors.sohu.com/fedora-epel/epel-release-latest-6.noarch.rpm
2.安装完成后,编辑epel.repo
与base源配置文件类似,也是将新的baseurl添加进去,将默认的baseurl fedoraproject.org注释掉
需要确定的是找到确切的镜像站的目录
具体的配置文件如下:
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
baseurl=http://mirrors.sohu.com/fedora-epel/6/x86_64/
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
#gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 6 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch/debug
baseurl=http://mirrors.sohu.com/fedora-epel/6/x86_64/
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch
failovermethod=priority
enabled=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
#gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1
[epel-source]
name=Extra Packages for Enterprise Linux 6 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch
baseurl=http://mirrors.sohu.com/fedora-epel/6/x86_64/
failovermethod=priority
enabled=0
#gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1
然后编辑另外一个文件epel-testing.repo
同样的我们将文件中默认的,mirrolist和baseurl都注释掉,换上我们说是用的镜像站的具体路径
[epel-testing]
name=Extra Packages for Enterprise Linux 6 - Testing - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/testing/6/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=testing-epel6&arch=$basearch
baseurl=http://mirrors.sohu.com/fedora-epel/testing/6/x86_64/
failovermethod=priority
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
[epel-testing-debuginfo]
name=Extra Packages for Enterprise Linux 6 - Testing - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/testing/6/$basearch/debug
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=testing-debug-epel6&arch=$basearch
baseurl=http://mirrors.sohu.com/fedora-epel/testing/6/x86_64/debug
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1
[epel-testing-source]
name=Extra Packages for Enterprise Linux 6 - Testing - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/testing/6/SRPMS
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=testing-source-epel6&arch=$basearch
baseurl=http://mirrors.sohu.com/fedora-epel/testing/6/x86_64/
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1
配置完成后可以先查看源是否已经添加:
yum repolist
yum clean all && yum makecache
然后可以yum zabbix20-agented