配置本地yum源的方法
1. 挂载光驱
如果是上传iso镜像到服务器上,则直接挂载iso镜像即可:
#mount -o loop -t iso9660 /xxxx.iso /挂载目录
开机自动加载#vi /etc/rc.d/rc.local增加mount -o loop -t iso9660 /xxxx.iso /挂载目录
[root@namenode1]# mount /dev/cdrom /mnt
[root@namenode1 ]# ls /mnt EFI EULA_pt README RELEASE-NOTES-it-IT.html RELEASE-NOTES-ru-RU.html RPM-GPG-KEY-redhat-release EULA EULA_zh RELEASE-NOTES-as-IN.html RELEASE-NOTES-ja-JP.html RELEASE-NOTES-si-LK.html ScalableFileSystem EULA_de GPL RELEASE-NOTES-bn-IN.html RELEASE-NOTES-kn-IN.html RELEASE-NOTES-ta-IN.html Server EULA_en HighAvailability RELEASE-NOTES-de-DE.html RELEASE-NOTES-ko-KR.html RELEASE-NOTES-te-IN.html TRANS.TBL EULA_es images RELEASE-NOTES-en-US.html RELEASE-NOTES-ml-IN.html RELEASE-NOTES-zh-CN.html EULA_fr isolinux RELEASE-NOTES-es-ES.html RELEASE-NOTES-mr-IN.html RELEASE-NOTES-zh-TW.html EULA_it LoadBalancer RELEASE-NOTES-fr-FR.html RELEASE-NOTES-or-IN.html repodata EULA_ja media.repo RELEASE-NOTES-gu-IN.html RELEASE-NOTES-pa-IN.html ResilientStorage EULA_ko Packages RELEASE-NOTES-hi-IN.html RELEASE-NOTES-pt-BR.html RPM-GPG-KEY-redhat-beta
2. 复制所有RPM包到指定目录:cp -rf /mnt/Packages /opt/local_yum/
3. 创建local.repo文件:
[root@namenode1 ]# vi /etc/yum.repos.d/local.repo --把这个目录下原来的所有其它配置文件改名或删除
[rhel6]
name=rhel6
baseurl=file:///opt/local_yum/Packages
enabled=1
gpgcheck=0
4. 创建YUM库
# createrepo -g /yum/Server/repodata/comps-rhel5-server-core.xml /opt/local_yum/Packages
5. 测试:yum list