centos 5 6安装本地yum源
生活随笔
收集整理的這篇文章主要介紹了
centos 5 6安装本地yum源
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
5.7 6.5 試用:?
mkdir /opt/mnt mount /dev/cdrom /opt/mnt 配置如下 文件:
備份一下原來(lái)文件 cp /etc/yum.redo.d/**.repo ?/etc/yum.redo.d/**.repo.bak? vim /etc/yum.redo.d/**.repo 添加: 如下既可
在Red Hat Enterprise Linux Server release 5.7 上配置YUM本地源時(shí),
遇到了"Errno 5] OSError: [Errno 2] No such file or directory xxxx",花了點(diǎn)時(shí)間搞清楚錯(cuò)誤的來(lái)龍去脈。特此記錄一下:
[media]
name=Red Hat Enterprise Linux 5.7??????????????????????????????? baseurl=file:///mnt/cdrom/LinuxSrc????????????????????????????????????????; enabled=1?????????????????????????????????????????????????????????
gpgcheck=0
gpgkey=file:///mnt/cdrom/LinuxSrc/RPM-GPG-KEY-redhat-release
[media]
name=Red Hat Enterprise Linux?baseurl=file:///mnt/cdrom/LinuxSrc/Server
enabled=1
gpgcheck=0
gpgkey=file:///mnt/cdrom/LinuxSrc/RPM-GPG-KEY-redhat-release
?warning: createrepo-0.4.11-3.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 37017186Preparing...????????????????########################################### [100%]?? 1:createrepo?????????????########################################### [100%]
?[root@DB-Server Server]# createrepo --update /mnt/cdrom/LinuxSrc
Previous repo file missing: /mnt/cdrom/LinuxSrc/repodata/primary.xml.gz3388/3388 - VT/etherboot-roms-5.4.4-15.el5.x86_64.rpm????
???????????????????????
mmSaving Primary metadataSaving file lists metadataSaving other metadataYou have new mail?in?/var/spool/mail/root
[root@DB-Server Server]# yum makecache
Loaded plugins: product-id, security, subscription-managerUpdating Red Hat repositories.media??????????????????? |? 951 B???? 00:00???? media/filelists????????? | 3.1 MB???? 00:00???? media/other????????????? |? 11 MB???? 00:00???? media/primary??????????? | 1.1 MB???? 00:00???? media???????????????????????????????? 3388/3388media???????????????????????????????? 3388/3388media???????????????????????????????? 3388/3388Metadata Cache Created
mkdir /opt/mnt mount /dev/cdrom /opt/mnt 配置如下 文件:
備份一下原來(lái)文件 cp /etc/yum.redo.d/**.repo ?/etc/yum.redo.d/**.repo.bak? vim /etc/yum.redo.d/**.repo 添加: 如下既可
在Red Hat Enterprise Linux Server release 5.7 上配置YUM本地源時(shí),
遇到了"Errno 5] OSError: [Errno 2] No such file or directory xxxx",花了點(diǎn)時(shí)間搞清楚錯(cuò)誤的來(lái)龍去脈。特此記錄一下:
將Redhat 5.7的光盤鏡像拷貝到了/mnt/cdrom/LinuxSrc目錄下,配置了rhel-media.repo文件,如下所示
[root@DB-Server yum.repos.d]# more rhel-media.repo?[media]
name=Red Hat Enterprise Linux 5.7??????????????????????????????? baseurl=file:///mnt/cdrom/LinuxSrc????????????????????????????????????????; enabled=1?????????????????????????????????????????????????????????
gpgcheck=0
gpgkey=file:///mnt/cdrom/LinuxSrc/RPM-GPG-KEY-redhat-release
執(zhí)行yum clean all命令后,執(zhí)行yum makecache遇到了下面錯(cuò)誤:
[root@DB-Server yum.repos.d]# yum clean allLoaded plugins: product-id, security, subscription-managerUpdating Red Hat repositories.Cleaning up Everything[root@DB-Server yum.repos.d]# yum makecacheLoaded plugins: product-id, security, subscription-managerUpdating Red Hat repositories.file:///mnt/cdrom/LinuxSrc/repodata/repomd.xml: [Errno 5] OSError: [Errno 2] No such file or directory:?'/mnt/cdrom/LinuxSrc/repodata/repomd.xml'Trying other mirror.Error: Cannot retrieve repository metadata (repomd.xml)?for?repository: media. Please verify its path and try again[root@DB-Server yum.repos.d]#
出現(xiàn)這個(gè)錯(cuò)誤的根本原因在于RHEL 5.x 版本與RHEL 6.x 版本的rpm包存放路徑不同:
RHEL 5.x : ../Server??? 例如:我案例環(huán)境位于/mnt/cdrom/LinuxSrc/Server 下。
RHEL 6.x : ../Packages
所以還在于上面的baseurl參數(shù)設(shè)置錯(cuò)誤。那么我們可以通過兩種方法解決這個(gè)問題:
?
方法1:配置正確的baseurl參數(shù)。
[root@DB-Server yum.repos.d]# vi rhel-media.repo?[media]
name=Red Hat Enterprise Linux?baseurl=file:///mnt/cdrom/LinuxSrc/Server
enabled=1
gpgcheck=0
gpgkey=file:///mnt/cdrom/LinuxSrc/RPM-GPG-KEY-redhat-release
?
方法2:使用createrepo命令創(chuàng)建本地源目錄,將其指向baseurl指定的目錄
?
?warning: createrepo-0.4.11-3.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 37017186Preparing...????????????????########################################### [100%]?? 1:createrepo?????????????########################################### [100%]
?[root@DB-Server Server]# createrepo --update /mnt/cdrom/LinuxSrc
Previous repo file missing: /mnt/cdrom/LinuxSrc/repodata/primary.xml.gz3388/3388 - VT/etherboot-roms-5.4.4-15.el5.x86_64.rpm????
???????????????????????
mmSaving Primary metadataSaving file lists metadataSaving other metadataYou have new mail?in?/var/spool/mail/root
[root@DB-Server Server]# yum makecache
Loaded plugins: product-id, security, subscription-managerUpdating Red Hat repositories.media??????????????????? |? 951 B???? 00:00???? media/filelists????????? | 3.1 MB???? 00:00???? media/other????????????? |? 11 MB???? 00:00???? media/primary??????????? | 1.1 MB???? 00:00???? media???????????????????????????????? 3388/3388media???????????????????????????????? 3388/3388media???????????????????????????????? 3388/3388Metadata Cache Created
總結(jié)
以上是生活随笔為你收集整理的centos 5 6安装本地yum源的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 关闭sql执行功能及找回08CMS系统管
- 下一篇: 你能想象吗?几年后数据科学家纷纷下岗再就