一、挂载本地光盘到系统:把rhel6.5安装光盘放入光驱,在终端命令行下操作
df -h查看光盘是否挂载:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_test1-lv_root
26G 6.8G 18G 29% /
tmpfs 996M 100K 996M 1% /dev/shm
/dev/sda1 485M 47M 413M 11% /boot
/dev/mapper/vg_data-oradatalv
19G 8.1G 9.7G 46% /oracle
/dev/sr0 3.5G 3.5G 0 100% /media/RHEL_6.3 x86_64 Disc 1
二、新建本地yum目录:mkdir /yum/rhel
cp -rp /media/RHEL_6.3 x86_64 Disc 1/* /yum/rhel #拷贝光盘内容到/yum/rhel目录下
cd /yum/rhel #进入挂载目录,查看内容
# pwd
/yum/rhel
# ls
EFI RELEASE-NOTES-as-IN.html RELEASE-NOTES-kn-IN.html RELEASE-NOTES-te-IN.html
EULA RELEASE-NOTES-bn-IN.html RELEASE-NOTES-ko-KR.html RELEASE-NOTES-zh-CN.html
GPL RELEASE-NOTES-de-DE.html RELEASE-NOTES-ml-IN.html RELEASE-NOTES-zh-TW.html
HighAvailability RELEASE-NOTES-en-US.html RELEASE-NOTES-mr-IN.html repodata
images RELEASE-NOTES-es-ES.html RELEASE-NOTES-or-IN.html ResilientStorage
isolinux RELEASE-NOTES-fr-FR.html RELEASE-NOTES-pa-IN.html RPM-GPG-KEY-redhat-beta
LoadBalancer RELEASE-NOTES-gu-IN.html RELEASE-NOTES-pt-BR.html RPM-GPG-KEY-redhat-release
media.repo RELEASE-NOTES-hi-IN.html RELEASE-NOTES-ru-RU.html ScalableFileSystem
Packages RELEASE-NOTES-it-IT.html RELEASE-NOTES-si-LK.html Server
README RELEASE-NOTES-ja-JP.html RELEASE-NOTES-ta-IN.html TRANS.TBL
三、配置本地yum源
cd /etc/yum.repos.d/ #进入yum配置目录
touch rhel-media.repo #建立yum配置文件
vi rhel-media.repo #编辑配置文件,添加以下内容:
[rhel-media]
name=Red Hat Enterprise 6.5 #自定义名称
baseurl=file:///yum/rhel #本地yum目录
enabled=1 #启用yum源,0为不启用,1为启用
gpgcheck=1 #检查GPG-KEY,0为不检查,1为检查
gpgkey=file:///yum/rhel/RPM-GPG-KEY-redhat-release #GPG-KEY路径
四、清楚yum缓存,使用yum install 自动安装软件
yum clean all #清除yum缓存
yum install php #安装php
例如,安装samba如下:
# yum install samba
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
rhel-media | 4.0 kB 00:00 ...
rhel-media/primary_db | 3.1 MB 00:00 ...
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package samba.x86_64 0:3.5.10-125.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================
Installing:
samba x86_64 3.5.10-125.el6 rhel-media 5.0 M
Transaction Summary
=====================================================================================================================
Install 1 Package(s)
Total download size: 5.0 M
Installed size: 17 M
Is this ok [y/N]: y
Downloading Packages:
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Retrieving key from file:///yum/rhel/RPM-GPG-KEY-redhat-release
Importing GPG key 0xFD431D51:
Userid: "Red Hat, Inc. (release key 2)
From : /yum/rhel/RPM-GPG-KEY-redhat-release
Is this ok [y/N]: y
Importing GPG key 0x2FA658E0:
Userid: "Red Hat, Inc. (auxiliary key)
From : /yum/rhel/RPM-GPG-KEY-redhat-release
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
** Found 10 pre-existing rpmdb problem(s), 'yum check' output follows:
setroubleshoot-3.0.47-2.el6.x86_64 has missing requires of gnome-python2-gnomekeyring
setroubleshoot-server-3.0.47-2.el6.x86_64 has missing requires of audit-libs-python >= ('0', '1.2.6', '3')
setroubleshoot-server-3.0.47-2.el6.x86_64 has missing requires of libapol.so.4()(64bit)
setroubleshoot-server-3.0.47-2.el6.x86_64 has missing requires of libapol.so.4(VERS_4.0)(64bit)
setroubleshoot-server-3.0.47-2.el6.x86_64 has missing requires of libqpol.so.1()(64bit)
setroubleshoot-server-3.0.47-2.el6.x86_64 has missing requires of libqpol.so.1(VERS_1.2)(64bit)
setroubleshoot-server-3.0.47-2.el6.x86_64 has missing requires of policycoreutils-python
setroubleshoot-server-3.0.47-2.el6.x86_64 has missing requires of python-slip-dbus
setroubleshoot-server-3.0.47-2.el6.x86_64 has missing requires of setools-libs-python >= ('0', '3.3.7', '4')
setroubleshoot-server-3.0.47-2.el6.x86_64 has missing requires of setroubleshoot-plugins >= ('0', '3.0.14', None)
Installing : samba-3.5.10-125.el6.x86_64 1/1
rhel-media/productid | 1.7 kB 00:00 ...
Installed products updated.
Verifying : samba-3.5.10-125.el6.x86_64 1/1
Installed:
samba.x86_64 0:3.5.10-125.el6
Complete!