RHEL 5.1 搭建本地YUM源
2021-10-22 11:24 askscuti 阅读(190) 评论(0) 编辑 收藏 举报因演示XEN虚拟化,下载了个RHEL 5.1,按照正常挂在总是报错,原因在于RHEL 5.1 搭建YUM本地源无法直接挂在光盘使用
错误信息
# 类似于
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for gcc-objc to pack into transaction set.
media://1192663619.181374%233/gcc-objc-4.1.2-14.el5.x86_64.rpm: [Errno 4] IOError: <urlopen error unknown url type: media>
Trying other mirror.
Error: failed to retrieve gcc-objc-4.1.2-14.el5.x86_64.rpm from henry
error was [Errno 4] IOError: <urlopen error unknown url type: media>
错误原因
- RHEL 5.1 无法直接挂在光盘使用yum源
解决方法
- 将光盘上传系统
[root@henry ~]# mkdir /isoso
[root@henry ~]# cd /isoso/
[root@henry isoso]# ls
rhel-server-5.1-x86_64-dvd.iso
- 挂载光盘
[root@henry /]# mkdir /dvd
[root@henry isoso]# mount /isoso/rhel-server-5.1-x86_64-dvd.iso /dvd/
- 安装createrepo
[root@henry ~]# rpm -ivh /dvd/Server/createrepo-0.4.4-2.fc6.noarch.rpm
- 生成库文件
[root@henry yum]# mkdir /media/yum
[root@henry yum]# mkdir /media/yum2
[root@henry yum]# createrepo -o /media/yum/ -g /dvd/Server/repodata/comps-rhel5-server-core.xml /dvd/Server/
2857/2857 - zsh-html-4.2.6-1.x86_64.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@henry yum]# createrepo -o /media/yum2/ -g /dvd/VT/repodata/comps-rhel5-vt.xml /dvd/VT/
34/34 - xen-devel-3.0.3-41.el5.x86_64.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
- 挂在连接目录
[root@henry yum]# mount --bind /media/yum/repodata/ /dvd/Server/repodata/
[root@henry yum]# mount --bind /media/yum2/repodata/ /dvd/VT/repodata/
- 配置YUM源
[root@henry yum]# cd /etc/yum.repos.d/
[root@henry yum.repos.d]# vim dvd.repo
[root@henry yum.repos.d]# cat dvd.repo
[henry]
name=henry
baseurl=file:///dvd/Server
gpgcheck=0
enabled=1
[henry2]
name=henry2
baseurl=file:///dvd/VT
gpgcheck=0
enabled=1
- 清理缓存测试
[root@henry yum.repos.d]# yum clean all;yum makecache
[root@henry yum.repos.d]# yum install gcc*