1.挂载光盘,拷贝光盘内容 # mount -t iso9660 -o loop /dev/hdc /media/cdrom # cp -a /media/cdrom/* /var/ftp/pub/
2.安装createrepo软件包 # cd /var/ftp/pub/Server # rpm -ivh createrepo-xxx.noarch.rpm
3.创建YUM仓库 # cd /var/ftp/pub/ # createrepo .
4.启动ftp服务 # service vsftpd start # chkconfig vsftpd on
(2)基于HTTP方式的YUM服务器
1.挂载光盘,拷贝光盘内容 # mount -t iso9660 -o loop /dev/hdc /media/cdrom # mkdir /rhel5 # cp -a /media/cdrom/* /rhel5/
2.安装createrepo软件包 # cd /rhel5/Server # rpm -ivh createrepo-xxx.noarch.rpm
3.创建YUM仓库 # cd /rhel5 # createrepo .
4.配置www服务 # vi /etc/httpd/conf/httpd.conf :set nu 分别将第281行和306行如下内容: DocumentRoot "/var/www/html" 改为: DocumentRoot "/rhel5"
5.启动http服务: # service httpd start # chkconfig httpd on
二、配置YUM客户端
(1)基于FTP方式的YUM客户端
1.创建server.repo文件 # cd /etc/yum.repos.d/ # cp rhel-debuginfo.repo server.repo
2.修改server.repo文件 # vi server.repo [Server] name=Red Hat Enterprise Linux 5 baseurl=ftp://192.168.0.1/pub/Server enabled=1 gpgcheck=1 gpgkey=ftp://192.168.0.1/pub/RPM-GPG-KEY-redhat-release [VT] name=Red Hat Enterprise Linux 5 baseurl=ftp://192.168.0.1/pub/VT enabled=1 gpgcheck=1 gpgkey=ftp://192.168.0.1/pub/RPM-GPG-KEY-redhat-release [Cluster] name=Red Hat Enterprise Linux 5 baseurl=ftp://192.168.0.1/pub/Cluster enabled=1 gpgcheck=1 gpgkey=ftp://192.168.0.1/pub/RPM-GPG-KEY-redhat-release [ClusterStorage] name=Red Hat Enterprise Linux 5 baseurl=ftp://192.168.0.1/pub/ClusterStorage enabled=1 gpgcheck=1 gpgkey=ftp://192.168.0.1/pub/RPM-GPG-KEY-redhat-release
3.测试 yum list yum install
(2)基于HTTP方式的YUM客户端
1.创建server.repo文件 # cd /etc/yum.repos.d/ # cp rhel-debuginfo.repo server.repo
2.修改server.repo文件 # vi server.repo [Server] name=Red Hat Enterprise Linux 5 baseurl= enabled=1 gpgcheck=1 gpgkey=ftp://192.168.0.1/RPM-GPG-KEY-redhat-release