RHEL 5.8 加载 DVD yum源
[root@localhost Server]# pwd
/media/RHEL_5.8 x86_64 DVD/Server
[root@localhost Server]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ll
total 16
-rw-r--r-- 1 root root 205 Apr 26 17:23 redhat-dvd.repo
-rw-r--r-- 1 root root 190 Apr 26 17:23 redhat.repo
-rw-r--r-- 1 root root 254 Jan 24 2012 rhel-debuginfo.repo
[root@localhost yum.repos.d]# vi redhat-dvd.repo
[redhat-dvd]
name=Red Hat Enterprise Linux $releasever - $basearch - DVD
baseurl=file:///media/RHEL_5.8%20x86_64%20DVD/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[root@localhost yum.repos.d]# yum repolist
Loaded plugins: katello, product-id, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
rhel-dvd-Server | 1.5 kB 00:00
rhel-dvd-Server/primary | 920 kB 00:00
rhel-dvd-Server 3285/3285
repo id repo name status
rhel-dvd-Server Red Hat Enterprise Linux x86 - Server
file路径内不能出现空格,空格需用%20代替,否则会出现以下报错。
[root@localhost yum.repos.d]# vi redhat-dvd.repo
redhat-dvd]
name=Red Hat Enterprise Linux $releasever - $basearch - DVD
baseurl=file:///media/RHEL_5.8 x86_64 DVD/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[root@localhost yum.repos.d]# yum clean all
Loaded plugins: katello, product-id, security, subscription-manager
Updating certificate-based repositories.
Options Error: Error parsing 'file:///media/RHEL_5.8 x86_64 DVD/Server': URL must be http, ftp, file or https not ""
使用转义符\,空格需用%20代替,否则会出现以下报错。
[root@localhost yum.repos.d]# vi redhat-dvd.repo
redhat-dvd]
name=Red Hat Enterprise Linux $releasever - $basearch - DVD
baseurl=file:///media/RHEL_5.8\ x86_64\ DVD/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[root@localhost yum.repos.d]# yum clean all
Loaded plugins: katello, product-id, security, subscription-manager
Updating certificate-based repositories.
Options Error: Error parsing 'file:///media/RHEL_5.8\\ x86_64\\ DVD/Server': URL must be http, ftp, file or https not ""
RHEL 6.4 加载 DVD yum源
挂载本地光盘到系统:把rhel6 安装光盘放入光驱,在终端命令行下操作
[root@llocalhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 9.7G 2.9G 6.3G 32% /
tmpfs 2.4G 372K 2.4G 1% /dev/shm
/dev/sda1 1008M 60M 898M 7% /boot
/dev/sda5 67G 12G 52G 19% /u01
/dev/sr0 3.5G 3.5G 0 100% /media/RHEL_6.4 x86_64 Disc 1
[root@localhost ~]# cd /media/RHEL_6.4\ x86_64\ Disc\ 1/
[root@localhost RHEL_6.4 x86_64 Disc 1]# cd /etc/yum.repos.d
[root@localhost yum.repos.d]# vi redhat-dvd.repo
[rhel-media]
name=Red Hat Enterprise Linux 6.2 #自定义名称
baseurl=file:///media/RHEL_6.4\ x86_64\ Disc\ 1/ #本地光盘挂载路径
enabled=1 #启用yum源,0为不启用,1为启用
gpgcheck=1 #检查GPG-KEY,0为不检查,1为检查
gpgkey=file:///media/rhel/RPM-GPG-KEY-redhat-release #GPG-KEY路径
清除yum缓存,使用yum install自动安装软件
[root@localhost yum.repos.d]# yum clean all #清除yum缓存
[root@localhost ~]# yum install php #安装php