用光盘简单搭建本地yum库(RHEL5,6通用)

   1,        建立yum库文件夹:/var/ftp/pub/;

2,        将光盘中Server文件夹复制到yum库文件夹内,权限不做修改(RHEL5);RHEL6将Server文件夹和Packages文件夹一起拷贝过去;

3,        找到createreporpm包,使用rpm命令安装该文件包;RHEL6,需要先安装另外两个依赖文件:deltarpm-3.5-0.5.20090913git.el6.i686.rpm和python-deltarpm-3.5-0.5.20090913git.el6.i686.rpm;然后安装createrepo-0.9.8-4.el6.noarch.rpm;

4,        用命令createrepo建立repodata的索引文件:createrepo /var/ftp/pub/Server;

如果缺少这步,会报错无法继续向下执行下去如下:

---> Downloading header for yum-utils to pack into transaction set.
media://1192663619.181374%234/xxxxxxxxxx: [Errno 4] IOError: <urlopen error unknown url                                               type: media>
Trying other mirror.
Error: failed to retrieve yum-utils-1.0.4-3.el5.noarch.rpm from dvd-server
error was [Errno 4] IOError: <urlopen error unknown url type: media>

5,        建立yum源配置文件:vi /etc/yum.repos.d/base.repo

6,        /etc/yum.repos.d/ 下的原repo文件删除,不然的话,测试会报如下错误:

Error: Cannot retrieve repository metadata (repomd.xml) for repository: InstallMedia. Please verify its path and try again

7,        测试yum是否正常可用:yum clean allyum makecacheyum install httpd

 完成。

你可能感兴趣的:(职场,yum,休闲,yum库)