1.挂载OS介质文件
[root@server-557 Packages]# mkdir -p /media/dvd [root@server-557 Packages]# mount -t iso9660 -o loop RHEL6.4-20130130.0-Server-x86_64-DVD1.iso /media/dvd
2.安装createrepo工具
[root@server-557 Packages]# cd /media/dvd/Packages
[root@server-557 Packages]# ls | grep delta
deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
xdelta-1.1.4-8.el6.i686.rpm
xdelta-1.1.4-8.el6.x86_64.rpm
[root@server-557 Packages]# rpm -ivh deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
warning: deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:deltarpm ########################################### [100%]
[root@server-557 Packages]# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
warning: python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:python-deltarpm ########################################### [100%]
[root@server-557 Packages]# ls | grep createrepo
createrepo-0.9.9-17.el6.noarch.rpm
[root@server-557 Packages]# rpm -ivh createrepo-0.9.9-17.el6.noarch.rpm
warning: createrepo-0.9.9-17.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:createrepo ########################################### [100%]
3.安装httpd
[root@server-557 Packages]#cd /media/dvd/Packages
[root@server-557 Packages]# rpm -ivh postgresql-libs-8.4.13-1.el6_3.x86_64.rpm [root@server-557 Packages]# rpm -ivh apr-1.3.9-5.el6_2.x86_64.rpm [root@server-557 Packages]# rpm -ivh apr-util-1.3.9-3.el6_0.1.x86_64.rpm [root@server-557 Packages]# rpm -ivh apr-util-ldap-1.3.9-3.el6_0.1.x86_64.rpm [root@server-557 Packages]# rpm -ivh httpd-tools-2.2.15-26.el6.x86_64.rpm
[root@server-557 Packages]# rpm -ivh mailcap-2.1.31-2.el6.noarch.rpm
[root@server-557 Packages]# rpm -ivh httpd-2.2.15-26.el6.x86_64.rpm
4.拷贝文件到www目录
[root@server-557 Packages]# mkdir -p /var/www/html/dvd [root@server-557 dvd]# cp -r /media/dvd/* /var/www/html/dvd/
5.建立repo
[root@server-557 dvd]# createrepo .
6.设置本机操作系统的yum repo.
新建文件/etc/yum.repos.d/rhel-pub.repo,内容如下
[rhel-pub] name=Red Hat Enterprise Linux 6.4 baseurl=http://10.10.96.54/dvd enabled=1 gpgcheck=0
7.Startup your web server
service httpd start
测试
yum clean all yum repolist
注:
如果发现错误说
http://10.10.96.54/dvd/repo/repo.xml 403无法访问,原因可能是selinux没有关掉