Fedora 是一个 Linux 发行版,Fedora基于Red Hat Linux,在Red Hat Linux终止发行后,红帽公司计划以Fedora来取代Red Hat Linux在个人领域的应用;而另外发行的Red Hat Enterprise Linux(Red Hat企业版Linux,RHEL)则取代Red Hat Linux在商业应用的领域。Fedora 被红帽公司定位为新技术的实验场
EPEL 安装源
EPEL 是 Extra Packages for Enterprise Linux 的缩写(EPEL),是用于 Fedora-based Red Hat Enterprise Linux (RHEL) 的一个高质量软件源,所以同时也适用于 CentOS 或者 Scientific Linux 等发行版。
1.下载并安装最新的 EPEL Repository
中国科学院开源软件协会镜像为:yum install http://mirrors.opencas.org/epel/epel-release-latest-7.noarch.rpm
[root@localhost ~]# yum install http://mirrors.opencas.org/epel/6/x86_64/epel-release-6-8.noarch.rpm Loaded plugins: product-id, refresh-packagekit, security, subscription-manager Updating certificate-based repositories. Setting up Install Process Examining /var/tmp/yum-root-HzOFYf/epel-release-6-8.noarch.rpm: epel-release-6-8.noarch Marking /var/tmp/yum-root-HzOFYf/epel-release-6-8.noarch.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package epel-release.noarch 0:6-8 will be installed --> Finished Dependency Resolution Dependencies Resolved ======================================================================================================================================================================= Package Arch Version Repository Size ======================================================================================================================================================================= Installing: epel-release noarch 6-8 /epel-release-6-8.noarch 22 k Transaction Summary ======================================================================================================================================================================= Install 1 Package(s) Total size: 22 k Installed size: 22 k Is this ok [y/N]: y Downloading Packages: Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : epel-release-6-8.noarch 1/1 Installed products updated. Installed: epel-release.noarch 0:6-8 Complete! [root@localhost ~]#
导入Key
[root@localhost ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
此时,可以在/etc/yum.repos.d下面释放了两个yum源的repo文件:
[root@localhost yum.repos.d]# ls -ltr total 16 -rw-r--r--. 1 root root 529 Nov 8 2011 rhel-source.repo -rw-r--r--. 1 root root 1056 Nov 4 2012 epel-testing.repo #新增EPEL yum源 -rw-r--r--. 1 root root 957 Nov 4 2012 epel.repo #新增EPEL yum源 -rw-r--r--. 1 root root 78 Mar 8 07:23 redhat.repo [root@localhost yum.repos.d]#
在Linux界面执行命令yum repolist,会报如下错误:
[root@localhost yum.repos.d]# yum repolist Loaded plugins: product-id, refresh-packagekit, security, subscription-manager Updating certificate-based repositories. Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again [root@localhost yum.repos.d]#
此时需要修改epel.repo文件,如下
[root@localhost yum.repos.d]# vi epel.repo [epel] name=Extra Packages for Enterprise Linux 6 - $basearch #baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch baseurl=http://mirrors.opencas.org/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
此时再次使用yum repolist测试,发现配置成功
[root@localhost yum.repos.d]# yum repolist Loaded plugins: product-id, refresh-packagekit, security, subscription-manager Updating certificate-based repositories. epel | 4.3 kB 00:00 epel/primary_db | 5.9 MB 02:30 repo id repo name status epel Extra Packages for Enterprise Linux 6 - x86_64 12,251 repolist: 12,251 [root@localhost yum.repos.d]#
最后,在把本地系统包配置为yum源:
[root@localhost yum.repos.d]# vi rhel-source.repo [rhel-source] name=Red Hat Enterprise Linux $releasever - $basearch - Source baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/SRPMS/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release [rhel-source-beta] name=Red Hat Enterprise Linux $releasever Beta - $basearch - Source baseurl=ftp://ftp.redhat.com/pub/redhat/linux/beta/$releasever/en/os/SRPMS/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release [rhel_6_iso] #新添加这几行到rhel-source.repo文件中 name=local iso baseurl=file:///media/RHEL_6.2 x86_64 Disc 1 gpgcheck=1 gpgkey=file:///media/RHEL_6.2 x86_64 Disc 1/RPM-GPG-KEY-redhat-release ~
然后,更新yum配置
[root@localhost yum.repos.d]# yum clean all Loaded plugins: product-id, refresh-packagekit, security, subscription-manager Updating certificate-based repositories. Cleaning repos: epel rhel_6_iso Cleaning up Everything [root@localhost yum.repos.d]# yum update Loaded plugins: product-id, refresh-packagekit, security, subscription-manager Updating certificate-based repositories. epel | 4.3 kB 00:00 epel/primary_db | 5.9 MB 00:51 rhel_6_iso | 4.0 kB 00:00 ... rhel_6_iso/primary_db | 3.1 MB 00:00 ... Setting up Update Process No Packages marked for Update [root@localhost yum.repos.d]#