环境:RHEL6 64bit
友情链接: Linux yum命令和配置yum
本地yum源:
- 挂载光盘
- 新建yum文件
例子:
[root@localhost ~]# mount /dev/cdrom /mnt/cdrom/ #挂载光盘
mount: block device /dev/sr1 is write-protected, mounting read-only
[root@localhost ~]# cat /etc/yum.repos.d/rhel-local.repo #yum文件
[rhel_6]
name=local_iso
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=1
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
创建有两张光盘distribution的yum本地源,例如,CentOS 6.6
[root@localhost ~]# mount -o loop /xxx/CentOS-6.6-x86_64-bin-DVD1.iso /mnt/iso1
[root@localhost ~]# rsync -avzP /mnt/iso1/Packages/* /mnt/cdrom/
[root@localhost ~]# mount -o loop /xxx/CentOS-6.6-x86_64-bin-DVD2.iso /mnt/iso1
[root@localhost ~]# rsync -avzP /mnt/iso1/Packages/* /mnt/cdrom/ #上面是copy包源
[root@localhost cdrom]# rpm -ivh deltarpm* libxm12-phytho* python-deltarpm* createrepo* #安装createrepo,前面三个为其依赖
[root@localhost ~]# rm -rf /etc/yum.repos.d/*
[root@localhost ~]# cat /etc/yum.repos.d/local.repo #新建yum源文件
[local]
name=local
gpgcheck=no
baseurl=file:///mnt/cdrom
[root@localhost ~]# createrepo /mnt/cdrom/ #创建yum索引
EPEL源:
EPEL,即Extra Packages for Enterprise Linux,是由 Fedora 社区创建维护,为 RHEL 及衍生发行版如 RHEL、CentOS、Scientific Linux 等提供高质量软件包的项目。EPEL中含有大量的软件,对官方标准源是一个很好的补充。
“EPEL (Extra Packages for Enterprise Linux ) is a Fedora Special Interest Group that creates, maintains, and manages a high quality set of additional packages for Enterprise Linux, including, but not limited to, Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux (SL).”
wiki:http://fedoraproject.org/wiki/EPEL
FYI:默认的epel.rep文件里面是通过mirrorlist变量来找到yum库的,如果有错误,可以注释掉mirrorlist然后,然后通过baseurl(uncomment)变量来找到yum库,帮助文档里面关于mirrorlist变量的定义
mirrorlist Specifies a URL to a file containing a list of baseurls.
This can be used instead of or with the baseurl option.
例子:
[root@localhost ~]# wget http://ftp.pbone.net/mirror/ftp.scientificlinux.org/linux/scientific/6.1/i386/os/Packages/epel-release-6-5.noarch.rpm #下载epel源RPM包
--2014-08-14 23:50:18-- http://ftp.pbone.net/mirror/ftp.scientificlinux.org/linux/scientific/6.1/i386/os/Packages/epel-release-6-5.noarch.rpm
Resolving ftp.pbone.net... 85.14.85.4
Connecting to ftp.pbone.net|85.14.85.4|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13688 (13K) [application/x-rpm]
Saving to: “epel-release-6-5.noarch.rpm”
100%[===================================================================================================================>] 13,688 14.2K/s in 0.9s
2014-08-14 23:50:25 (14.2 KB/s) - “epel-release-6-5.noarch.rpm” saved [13688/13688]
[root@localhost ~]# rpm -ivh epel-release-6-5.noarch.rpm #安装epel源RPM包
warning: epel-release-6-5.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID 192a7d7d: NOKEY
Preparing... ########################################### [100%]
1:epel-release ########################################### [100%]
[root@localhost ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 #导入EPEL源的key
[root@localhost ~]# cat /etc/yum.repos.d/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
Remi源:
Remi源大家或许很少听说,尤其对于不想编译最新版的linux使用者,因为Remi源中的软件几乎都是最新稳定版。或许您会怀疑稳定不?放心吧,这些都是Linux骨灰级的玩家编译好放进源里的,他们对于系统环境和软件编译参数的熟悉程度毋庸置疑。
Remi官网地址:http://rpms.famillecollet.com/
例子:[root@localhost ~]# wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm #下载remi源的RPM包
--2014-08-14 23:54:33-- http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Resolving rpms.famillecollet.com... 195.154.241.117, 2001:bc8:33a1:100::1
Connecting to rpms.famillecollet.com|195.154.241.117|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5688 (5.6K) [application/x-rpm]
Saving to: “remi-release-6.rpm”
100%[===================================================================================================================>] 5,688 720B/s in 7.9s
2014-08-14 23:54:47 (720 B/s) - “remi-release-6.rpm” saved [5688/5688]
[root@localhost ~]# rpm -ivh remi-release-6.rpm #安装Remi源的RPM包
warning: remi-release-6.rpm: Header V3 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
Preparing... ########################################### [100%]
1:remi-release ########################################### [100%]
[root@localhost ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-remi #导入Remi源的key
[root@localhost ~]# cat /etc/yum.repos.d/remi.repo
[remi]
name=Les RPM de remi pour Enterprise Linux 6 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/6/remi/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/6/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 6 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/6/php55/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/6/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 6 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/6/php56/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/6/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 6 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/6/test/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/6/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 6 - $basearch - debuginfo
baseurl=http://rpms.famillecollet.com/enterprise/6/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 6 - $basearch - debuginfo
baseurl=http://rpms.famillecollet.com/enterprise/6/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 6 - $basearch - debuginfo
baseurl=http://rpms.famillecollet.com/enterprise/6/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 6 - $basearch - debuginfo
baseurl=http://rpms.famillecollet.com/enterprise/6/debug-test/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
RPMForge源:
RPMForge是RHEL,CentOS,Scientific Linux系统下的RPM源,被CentOS社区认为是最安全也是最稳定的一个软件仓库。
RPMForge官方网站:http://repoforge.org/
例子:[root@localhost ~]# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm #下载RPMForge源的RPM包
--2014-08-14 23:59:08-- http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
Resolving pkgs.repoforge.org... 78.46.17.228
Connecting to pkgs.repoforge.org|78.46.17.228|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://rpmforge.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm [following]
--2014-08-14 23:59:16-- http://rpmforge.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
Resolving rpmforge.sw.be... 78.46.17.228
Connecting to rpmforge.sw.be|78.46.17.228|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://tree.repoforge.org/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm [following]
--2014-08-14 23:59:17-- http://tree.repoforge.org/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
Resolving tree.repoforge.org... 78.46.17.228
Connecting to tree.repoforge.org|78.46.17.228|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm [following]
--2014-08-14 23:59:18-- http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
Resolving apt.sw.be... 193.1.193.67
Connecting to apt.sw.be|193.1.193.67|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12640 (12K) [application/x-redhat-package-manager]
Saving to: “rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm”
100%[===================================================================================================================>] 12,640 12.3K/s in 1.0s
2014-08-14 23:59:21 (12.3 KB/s) - “rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm” saved [12640/12640]
[root@localhost ~]# rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm #安装RPMForge源的RPM包
warning: rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 6b8d79e6: NOKEY
Preparing... ########################################### [100%]
1:rpmforge-release ########################################### [100%]
[root@localhost ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-fabian #导入RPMForge源的key
[root@localhost ~]# cat /etc/yum.repos.d/rpmforge.repo
### Name: RPMforge RPM Repository for RHEL 6 - dag
### URL: http://rpmforge.net/
[rpmforge]
name = RHEL $releasever - RPMforge.net - dag
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/rpmforge
mirrorlist = http://mirrorlist.repoforge.org/el6/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1
[rpmforge-extras]
name = RHEL $releasever - RPMforge.net - extras
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/extras
mirrorlist = http://mirrorlist.repoforge.org/el6/mirrors-rpmforge-extras
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge-extras
enabled = 0
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1
[rpmforge-testing]
name = RHEL $releasever - RPMforge.net - testing
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/testing
mirrorlist = http://mirrorlist.repoforge.org/el6/mirrors-rpmforge-testing
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge-testing
enabled = 0
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1