RedHat下主要有两个distribution,一曰 RHEL(Red Hat Enterprise Linux) 一曰 Fedora.前者主要是供服务器使用,优点是稳定,缺点是老的掉牙,后者是供桌面使用的,优点是特别新,repo的速度几乎可以和archlinux媲美,缺点是发布两年 EOL 就到了,我见过某服务器从不关机,也不更新Kernel,一直缝缝补补开了数年的,用fedora简直是作死.

但若不是财大气粗(比如某有数千台曙光各种RHEL的xx中心,让人羡慕的流口水),很多服务器选择CentOS作为服务器的OS,因为基于GPL License的RHEL是提供binary file 和 source code 的,有社区将source code 再编译为 binary file ,取名为CentOS,所谓社区操作系统.对此RHEL是持认可--至少是理解的态度.因此,CentOS基本可以认为是RHEL的免费版本,据传性能还是有点差距并且不提供官方技术支持.若在服务器使用,它十年的EOL也足以让服务器免去很多维护了.

今年的7月份,CentOS发布CentOS 7,对应于Red Hat在6月发布的RHEL 7,Life Cycle从今年一直持续到2024年.更重要的是,这位同志终于愿意从2.6.x的kernel升到3.x了,要知道,截止目前,kernel早已升级到3.15.8了,这得落后多少年了啊,对应的gcc也从4.4.7升级到了4.8.x,终于可以在服务器上编译带--std=c++11参数的代码而不必自己编译个编译器先了泪目.

总之,很高兴的直接装了个新的CentOS 7,然后习惯的去找RPM fusion的源,然后悲剧的发现居然目前还没有提供...额,没有只有基础仓库的CentOS 7那得多不方便啊囧,只能找一些其它的源来应付下先.

找了下,这里这里我找到一些相关内容,照着做了下,我最需要的几个东西都可以找到.

RHEL 官方扩展源

首先我们可以使用下RHEL的官方源.命令很简单

# yum localinstall https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm -y

若发现它报个404之类的,去 http://dl.fedoraproject.org/pub/epel/7/x86_64/e/ 找找看 epel-release 开头的rpm package,或许有更新,总之装个epel-release*.rpm后,看/etc/yum.repos.d/文件夹下就多了两个文件如下:

-rw-r--r-- 1 root root  957 Jun 19 07:20 epel.repo
-rw-r--r-- 1 root root 1056 Jun 19 07:20 epel-testing.repo

你若没有特别的需求,你应该只要有epel.repo就可以.

[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

你也可以直接把上面那些内容写到/etc/yum.repos.d/epel.repo文件中. 然后

# yum makecache

这样就可以用了. 尝试是否成功也很容易

# yum repolist
......
repo id      repo name                                       status
epel/x86_64  Extra Packages for Enterprise Linux 7 - x86_64  5,425
......

发现有高亮一栏就算过了.

remi源

安装和RHEL差不多,这个源主要是提供了一些php相关的扩展库,若不使用php,意义感觉不算大.

# yum localinstall http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

同样可以在/etc/yum.repos.d/中看到多了个remi.repo 编辑可以看到内容如下:

[remi]
name=Les RPM de remi pour Enterprise Linux 7 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/7/remi/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/7/remi/mirror
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-php55]
name=Les RPM de remi de PHP 5.5 pour Enterprise Linux 7 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/7/php55/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/7/php55/mirror
# WARNING: If you enable this repository, you must also enable "remi"
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-php56]
name=Les RPM de remi de PHP 5.6 pour Enterprise Linux 7 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/7/php56/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/7/php56/mirror
# WARNING: If you enable this repository, you must also enable "remi"
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-test]
name=Les RPM de remi en test pour Enterprise Linux 7 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/7/test/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/7/test/mirror
# WARNING: If you enable this repository, you must also enable "remi"
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-debuginfo]
name=Les RPM de remi pour Enterprise Linux 7 - $basearch - debuginfo
baseurl=http://rpms.famillecollet.com/enterprise/7/debug-remi/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-php55-debuginfo]
name=Les RPM de remi de PHP 5.5 pour Enterprise Linux 7 - $basearch - debuginfo
baseurl=http://rpms.famillecollet.com/enterprise/7/debug-php55/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-php56-debuginfo]
name=Les RPM de remi de PHP 5.6 pour Enterprise Linux 7 - $basearch - debuginfo
baseurl=http://rpms.famillecollet.com/enterprise/7/debug-php56/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-test-debuginfo]
name=Les RPM de remi en test pour Enterprise Linux 7 - $basearch - debuginfo
baseurl=http://rpms.famillecollet.com/enterprise/7/debug-test/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

默认enable全是0,根据需要自行将enable改为1,注意高亮的第五行enable必须改为1 remi才能用.

当然,更可靠的方法是使用命令去 enable。比如

yum-config-manager --enable remi-php73
yum update php\*

其中 yum-config-manager 命令来自包 yum-utils.

yum install yum-utils -y

然后makecache 测试什么的就和RHEL一样不细说了.

puias源

puias 是基于RH的一个扩展distribution和mirror。无论是CentOS 5,6还是7都可以得到它的一些扩展的程序。尤其是科学计算领域的一些模块,果断是要入手的。目前它由普林斯顿高能所维护。 你去它的官网可以得到很多说明。比如这个页面 我们可以只选择计算的部分如下:

[PUIAS_computational]
name=PUIAS computational Base $releasever - $basearch
mirrorlist=http://puias.math.ias.edu/data/puias/computational/$releasever/$basearch/mirrorlist
#baseurl=http://puias.math.ias.edu/data/puias/computational/$releasever/$basearch
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puias

/etc/yum.repo.d/下建立文件,保存即可。

因为我们这次没有使用rpm包,所以需要import一下GPG KEY.

rpm --import http://puias.princeton.edu/data/puias/7/x86_64/os/RPM-GPG-KEY-puias

若打算使用puias的全套repo,可以都用上,比如我做好的这个。

curl -o /etc/yum.repos.d/puias.repo https://gist.githubusercontent.com/yuikns/704cc2d672624e5c56d7/raw/c2a7d1b7c6e0845c4e9a55b041e7effc04ac7847/puias.repo

当然,GPG若没有导过,同样要导下。

RepoForge源

RepoForge原名RPMForge,是一个维护得很不错的repo站点.点击此处可以看到RHEL各版本的下载链接.拿到链接后

yum localinstall xxx.rpm -y

即可完成安装。 目前为止似乎还没有把centos 7加上,但是没关系,随便找个6的链接,把6变成7即可获得该rpm包的大致位置。当前我得到的位置是 : http://apt.sw.be/redhat/el7/en/x86_64/rpmforge/RPMS/ 进入后找到rpmforge-release-**的文件,获得下载链接,安装即可。

yum localinstall http://apt.sw.be/redhat/el7/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm -y
yum makecache

ELRepo 源

和 epel 类似, 去官网 加个 rpm 即可.


另外补充一句, AWS 的 AMI 是基于 CentOS 改的,我们也可以利用前文所示的各种 Repo 的 CentOS x86_64 版本.


Yu

Ideals are like the stars: we never reach them, but like the mariners of the sea, we chart our course by them.

13 Comments

youran · August 12, 2014 at 00:31

Google Chrome 36.0.1985.125 Google Chrome 36.0.1985.125 Windows 7 x64 Edition Windows 7 x64 Edition

能显示comment useragent貌似挺不错,我也搞了下试试。不过在我的博客主题上看起来怪怪的……

    yu · August 12, 2014 at 09:28

    Google Chrome 36.0.1985.125 Google Chrome 36.0.1985.125 Mac OS X  10.9.4 Mac OS X 10.9.4

    @youran 我看了下,貌似蛮正常啊…

youran · August 12, 2014 at 00:12

Google Chrome 36.0.1985.125 Google Chrome 36.0.1985.125 Windows 7 x64 Edition Windows 7 x64 Edition

我一般只添加epel源,需要建vpn的时候再把pptp的源加上。

    yu · August 12, 2014 at 02:12

    Google Chrome 36.0.1985.125 Google Chrome 36.0.1985.125 Mac OS X  10.9.4 Mac OS X 10.9.4

    @youran 表示不建pptp vpn,被封了就太坑了,一直只用ssh socket 代理 …

      youran · August 13, 2014 at 01:48

      Google Chrome 36.0.1985.125 Google Chrome 36.0.1985.125 Windows 7 x64 Edition Windows 7 x64 Edition

      @Yu Jing ssh代理太古老了,转发效率还低。至少得搞个shadowsocks之类的吧……

        yu · August 13, 2014 at 17:43

        Google Chrome 36.0.1985.125 Google Chrome 36.0.1985.125 Mac OS X  10.9.4 Mac OS X 10.9.4

        @youran 去google,看U管,都不卡,没动力尝试更牛掰的…

vfhky · August 6, 2014 at 00:24

Google Chrome 30.0.1599.101 Google Chrome 30.0.1599.101 Windows 7 x64 Edition Windows 7 x64 Edition

国内镜像也有啊,网易和华科的centos镜像都有做更新。

    yu · August 6, 2014 at 01:14

    Google Chrome 36.0.1985.125 Google Chrome 36.0.1985.125 Mac OS X  10.9.4 Mac OS X 10.9.4

    @vfhky 主要是需要的是扩展库,而不仅仅是官方镜像.若只是要个快点的官方镜像,装个yum-plugin-fastestmirror它会自动从mirror list 中找到最快的.

    CentOS 7目前还在磨合中,若非必要勿轻易入坑

      vfhky · August 6, 2014 at 11:03

      Maxthon 4.1.4.2000 Maxthon 4.1.4.2000 Mac OS X  10.6.3 Mac OS X 10.6.3

      @Yu Jing 正想从6升级到7呢,不过应该没关系,有base repo基本满足了。

        yu · August 6, 2014 at 14:05

        Google Chrome 36.0.1985.125 Google Chrome 36.0.1985.125 Mac OS X  10.9.4 Mac OS X 10.9.4

        @vfhky 若是自用可以试试,因为终于换3.x内核和4.8.x gcc,限制少了很多.
        但若是生产环境或者要和别人一起用的话,建议还是静候两个月比较好

          vfhky · August 6, 2014 at 15:34

          Android Webkit 4.0 Android Webkit 4.0 Android Android

          @Yu Jing 就放了一个web站点和gcc/g++的测试环境。

            yu · August 6, 2014 at 15:36

            Google Chrome 36.0.1985.125 Google Chrome 36.0.1985.125 Mac OS X  10.9.4 Mac OS X 10.9.4

            @vfhky 那随便也没啥事…

            每次回复切个机器,老犀利了

Leave a Reply to vfhky Cancel reply

Your email address will not be published. Required fields are marked *