给centos 6.2安装yum源

CentOS自带的yum源不够丰富,为了使用方便,我经常借用第三方的yum源。每次都要重新找,嫌麻烦,这次总结下,也方便以后使用。

1、安装rpmforge
rpm包的url:
http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
安装命令:
rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
2、安装epel
rpm包的url:
http://mirrors.ustc.edu.cn/fedora/epel/6/i386/epel-release-6-7.noarch.rpm
安装命令:
32位系统选择:
rpm -ivh http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm
64位系统选择:
rpm -ivh http://download.fedora.redhat.com/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm

如果无法访问http://download.fedora.redhat.com/pub/epel/可以使用下面的源
http://mirrors.ustc.edu.cn/epel/5/x86_64/epel-release-5-4.noarch.rpm
CentOS6
http://mirrors.ustc.edu.cn/epel/6/x86_64/epel-release-6-8.noarch.rpm

默认会在/etc/yum.repos.d/下创建epel.repo和epel-testing.repo两个配置文件,epel.repo的内容如下:
[epel]
name=Extra Packages for Enterprise Linux 6 – $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
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
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 6 – $basearch – Debug
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch/debug
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
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
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1
如果想使用比较新的软件,可以启用[epel-testing]源,把里面的enabled=0改成enabled=1就可以。

为了方便,以后直接用这个脚本了(64位的CentOS6.2安装脚本):

#! /bin/bash

echo "Install rpmforge ..."
rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

echo "Install epel ..."
rpm -ivh http://mirrors.sohu.com/fedora-epel/6/i386/epel-release-6-7.noarch.rpm

echo "Done"

你可能感兴趣的:(centos)