CentOS Repository

同事跟我詢問究竟 Red Hat Enterprise Linux(RHEL)CentOS 的差別在哪裡!!我只知道他們很類似.

依據 CentOS 的官方說法.

What is CentOS?
CentOS is an Enterprise Linux distribution based on the freely available sources from Red Hat Enterprise Linux. Each CentOS version is supported for 7 years (by means of security updates). A new CentOS version is released every 2 years and each CentOS version is periodically updated (roughly every 6 months) to support newer hardware. This results in a secure, low-maintenance, reliable, predictable and reproducible Linux environment.

第一句話是重點 CentOS is an Enterprise Linux distribution based on the freely available sources from Red Hat Enterprise Linux.

CentOS 只包含了 RHEL 所有的開放原始碼的軟體,其他則不包括.所以基本上他們的核心版本一致,Open Source 的軟體也一致.

Repository

甚至於可以安裝 RHEL 但使用 CentOS 的 Repository,一般安裝好的 RHEL 需要到 Red Hat Subscription Management (以前稱為 RHN – Red Hat Network) 註冊後才能使用 RHEL 的 Repository.

[root@localhost ~]# yum update
Loaded plugins: product-id, refresh-packagekit, search-disabled-repos, security,
              : subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Update Process
No Packages marked for Update

Repository 最簡單的格式如下:

  • Repository ID
  • Name
  • Baseurl or mirrorlist
  • gpgkey
  • Enabled
  • gpgcheck

基本上定義以下這幾種 CentOS Repository 就足夠.
[base] – Base
[updates] – Released updates
[extras] – Additional packages that may be useful
[plus] – Packages used/produced in the build but not released

先停用 RHEL Repository 須將設定檔的 enabled 修改成為 0

[root@localhost ~]# vi /etc/yum.repos.d/rhel-source.repo
enabled=0

CentOS6 Repository

[root@localhost ~]# vi /etc/yum.repos.d/centos.repo
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
enabled=1
gpgcheck=1

[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
enabled=1
gpgcheck=1

[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
gpgcheck=1
enabled=1

[plus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=centosplus
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
gpgcheck=1
enabled=1

還需要安裝 CentOS 的 GPG – GPG private signature 主要用意是檢查使用者下載的 RPM 檔是否遭到修改或已經毀壞.之後就可以使用 yum 了.

[root@localhost ~]# rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
[root@localhost ~]# yum update
Loaded plugins: fastestmirror, product-id, refresh-packagekit, search-disabled-repos, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Update Process
Loading mirror speeds from cached hostfile
 * base: ftp.tc.edu.tw
 * plus: ftp.tc.edu.tw
 * updates: ftp.tc.edu.tw
base                                                                                           | 3.7 kB     00:00     
base/primary_db                                                                                | 4.7 MB     00:12     
centos                                                                                         | 3.7 kB     00:00     
plus                                                                                           | 3.4 kB     00:00     
plus/primary_db                                                                                | 4.0 MB     00:09     
updates                                                                                        | 3.4 kB     00:00     
updates/primary_db                                                                             | 8.1 MB     00:30     
Resolving Dependencies
--> Running transaction check
...

CentOS7 Repository

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates 

[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
沒有解決問題,試試搜尋本站其他內容

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步瞭解 Akismet 如何處理網站訪客的留言資料