操作系统为RHEL5 (本实验稍作修改,可以做PXE网络装机服务器)
1.配置IP[root@localhost ~]# ifconfig eth0eth0 Link encap:Ethernet HWaddr 00:0C:29:4E:07:88 inet addr:172.16.10.18 Bcast:172.16.10.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe4e:788/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:98 errors:0 dropped:0 overruns:0 frame:0 TX packets:106 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:14341 (14.0 KiB) TX bytes:17614 (17.2 KiB) Interrupt:59 Base address:0x2024 2.挂装光盘[root@localhost ~]# mount /dev/cdrom /media/mount: block device /dev/cdrom is write-protected, mounting read-onlymount: /dev/cdrom already mounted or /media/ busy3.安装vsftpd服务器,并配置[root@localhost ~]# cd /media/Server/[root@localhost Server]# rpm -ivh vsftpd-2.0.5-16.el5_4.1.i386.rpm warning: vsftpd-2.0.5-16.el5_4.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186error: failed to stat /media/RHEL_5.5 i386 DVD: 没有那个文件或目录Preparing... ########################################### [100%] 1:vsftpd ########################################### [100%][root@localhost ~]# mkdir /var/ftp/rhel5###[root@localhost ~]# mkdir /var/ftp/other[root@localhost ~]# cp -rpf /media/* /var/ftp/rhel5/[root@localhost ~]# service vsftpd start为 vsftpd 启动 vsftpd: [确定][root@localhost ~]# chkconfig vsftpd on[root@localhost ~]# cp -rfp /media/* /var/ftp/rhel5/ #######(同时,将比赛用的所有软件包放到other目录下)4.安装createrepo工具后,使用createrepo工具建立仓库数据文件 [root@localhost Server]# rpm -ivh createrepo-0.4.11-3.el5.noarch.rpm warning: createrepo-0.4.11-3.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 37017186error: failed to stat /media/RHEL_5.5 i386 DVD: 没有那个文件或目录Preparing... ########################################### [100%] 1:createrepo ########################################### [100%]………………………………………………………………………………………………………………[root@localhost ~]# cd /var/ftp/rhel5/Server/[root@localhost Server]# createrepo -g repodata/comps-rhel5-server-core.xml ./2348/2348 - coolkey-devel-1.1.0-14.el5.i386.rpm mSaving Primary metadataSaving file lists metadataSaving other metadata………………………………………………………………………………………………………………[root@localhost Server]# cd /var/ftp/rhel5/Cluster[root@localhost Cluster]# createrepo -g repodata/comps-rhel5-cluster.xml ./32/32 - Cluster_Administration-ru-RU-5.2-1.noarch.rpm Saving Primary metadataSaving file lists metadataSaving other metadata………………………………………………………………………………………………………………[root@localhost ~]# cd /var/ftp/rhel5/ClusterStorage/[root@localhost ClusterStorage]# createrepo -g repodata/comps-rhel5-cluster-st.xml ./39/39 - perl-Config-General-2.40-1.el5.noarch.rpm Saving Primary metadataSaving file lists metadataSaving other metadata………………………………………………………………………………………………………………[root@localhost VT]# createrepo -g repodata/comps-rhel5-vt.xml ./36/36 - python-virtinst-0.400.3-9.el5.noarch.rpm Saving Primary metadataSaving file lists metadataSaving other metadata5.在ftp共享目录下,创建benet.repo文件[root@localhost ~]# cd /var/ftp/[root@localhost ftp]# vi benet.repo[Server]name=Server share source rpm packagesbaseurl=ftp://172.16.10.18/rhel5/Serverenabled=1gpgcheck=0[Cluster]name=Clusterbaseurl=ftp://172.16.10.18/rhel5/Clusterenabled=1gpgcheck=0[ClusterStorage]name=ClusterStoragebaseurl=ftp://172.16.10.18/rhel5/ClusterStorageenabled=1gpgcheck=0[VT]name=VTbaseurl=ftp://172.16.10.18/rhel5/VTenabled=1gpgcheck=0#[Other]#name=other soft#baseurl=ftp://172.16.10.18/rhel5/other#enabled=1#gpgcheck=0客户端的操作
[root@localhost ~]# cd /etc/yum.repos.d/[root@localhost yum.repos.d]# wget --2013-03-31 21:18:55-- => `benet.repo'Connecting to 172.16.10.18:21... 已连接。正在以 anonymous 登录 ... 登录成功!==> SYST ... 完成。 ==> PWD ... 完成。==> TYPE I ... 完成。 ==> 不需要 CWD。==> SIZE benet.repo ... 370==> PASV ... 完成。 ==> RETR benet.repo ... 完成。长度:370100%[======================================>] 370 --.-K/s in 0s
2013-03-31 21:18:55 (23.7 MB/s) - `benet.repo' saved [370]
[root@localhost yum.repos.d]# ls
benet.repo rhel-debuginfo.repo##疑难问题:当将所有的比赛用的文件包都放到另外一个ftp目录下other下的时候,怎么用createrepo -g 创建库数据。如果无法创建,就会弹出如下信息Loaded plugins: rhnplugin, securityThis system is not registered with RHN.RHN support will be disabled.Cluster | 1.1 kB 00:00 ClusterStorage | 1.1 kB 00:00 : [Errno 4] IOError: [Errno ftp error] 550 Failed to change directory.Trying other mirror.Error: Cannot retrieve repository metadata (repomd.xml) for repository: Other. Please verify its path and try again