1.挂载光盘:mount /dev/cdrom /mnt
或(iso文件)mount -t iso9660 /dev/hda /mnt/cdrom
2.安装软件: rpm -ivh createrepo-xxx.noarch.rpm
rpm -ivh vsftpd-****.rpm
3.建立目录:cd /var/ftp/pub
mkdir Server
4.复制文件:cp -a /mnt/cdrom/Server /var/ftp/pub/Server
5. 建立本地源:createrepo -v /var/ftp/pub/Server
6. 重建依赖关系: createrepo -g /var/ftp/pub/Server/repodata/compsrhel5-server-core.xml /var/ftp/pub/Server/Server
7.重启vsftpd服务:service vsftpd restart
8.创建Server.repo文件(本地客户端)/etc/yum.repos.d/:
[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
9.远程客户端修改 /etc/yum.repos.d/:
[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
9.清除缓存:yum clean all
10.关闭防火墙和SElinux。(重要)
备注: Error: Cannot retrieve repository metadata (repomd.xml) for repository: rhel-debuginfo. Please verify its path and try again 解决方法:关闭防火墙和SElinux。 |
转载于:https://blog.51cto.com/stuart/700850