CentOS 7添加yum源

來源:互聯網
上載者:User

標籤:

RedHat下主要有兩個distribution,一曰 RHEL(Red Hat Enterprise Linux) 一曰 Fedora.前者主要是供伺服器使用,優點是穩定,缺點是老的掉牙,後者是供案頭使用的,優點是特別新,repo的速度幾乎可以和archlinux媲美,缺點是發布兩年EOL(End-of-life_(product))就到了,我見過某伺服器從不關機,也不更新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 http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.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.repo

[epel]name=Extra Packages for Enterprise Linux 7 - $basearch#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearchmirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearchfailovermethod=priorityenabled=1gpgcheck=0gpgkey=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/debugmirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearchfailovermethod=priorityenabled=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7gpgcheck=1 [epel-source]name=Extra Packages for Enterprise Linux 7 - $basearch - Source#baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMSmirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearchfailovermethod=priorityenabled=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7gpgcheck=1

 

  你也可以直接把上面那些內容寫到/etc/yum.repos.d/epel.repo檔案中.
  然後:# yum makecache  這樣就可以用了。

  嘗試是否成功也很容易

# yum repolist......repo id      repo name                                       statusepel/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/mirrorenabled=0gpgcheck=1gpgkey=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=0gpgcheck=1gpgkey=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=0gpgcheck=1gpgkey=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=0gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi [remi-debuginfo]name=Les RPM de remi pour Enterprise Linux 7 - $basearch - debuginfobaseurl=http://rpms.famillecollet.com/enterprise/7/debug-remi/$basearch/enabled=0gpgcheck=1gpgkey=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 - debuginfobaseurl=http://rpms.famillecollet.com/enterprise/7/debug-php55/$basearch/enabled=0gpgcheck=1gpgkey=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 - debuginfobaseurl=http://rpms.famillecollet.com/enterprise/7/debug-php56/$basearch/enabled=0gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi [remi-test-debuginfo]name=Les RPM de remi en test pour Enterprise Linux 7 - $basearch - debuginfobaseurl=http://rpms.famillecollet.com/enterprise/7/debug-test/$basearch/enabled=0gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

 

  預設enable全是0,根據需要自行將enable改為1,注意高亮的第五行enable必須改為1 remi才能用.

  然後makecache 測試什麼的就和RHEL一樣不細說了.

puias源

      puias 是基於RH的一個擴充distribution和mirror。無論是CentOS 5,6還是7都可以得到它的一些擴充的程式。尤其是科學計算領域的一些模組,果斷是要入手的。目前它由普林斯頓高能所維護。
  你去它的官網可以得到很多說明。比如這個頁面
  我們可以只選擇計算的部分如下:

  puias-computational.repo

[PUIAS_computational]name=PUIAS computational Base $releasever - $basearchmirrorlist=http://puias.math.ias.edu/data/puias/computational/$releasever/$basearch/mirrorlist#baseurl=http://puias.math.ias.edu/data/puias/computational/$releasever/$basearchgpgcheck=1gpgkey=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

 

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 -yyum makecache

CentOS 7添加yum源

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.