YUM倉庫搭建純文本

操作系統爲RHEL5  (本實驗稍作修改,可以做PXE網絡裝機服務器)
1.配置IP
[root@localhost ~]# ifconfig eth0
eth0      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-only
mount: /dev/cdrom already mounted or /media/ busy
3.安裝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 37017186
error: 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 37017186
error: 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                                 m
Saving Primary metadata
Saving file lists metadata
Saving 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 metadata
Saving file lists metadata
Saving 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 metadata
Saving file lists metadata
Saving 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 metadata
Saving file lists metadata
Saving other metadata
5.在ftp共享目錄下,創建benet.repo文件
[root@localhost ~]# cd /var/ftp/
[root@localhost ftp]# vi benet.repo
[Server]
name=Server share source rpm packages
baseurl=ftp://172.16.10.18/rhel5/Server
enabled=1
gpgcheck=0
[Cluster]
name=Cluster
baseurl=ftp://172.16.10.18/rhel5/Cluster
enabled=1
gpgcheck=0
[ClusterStorage]
name=ClusterStorage
baseurl=ftp://172.16.10.18/rhel5/ClusterStorage
enabled=1
gpgcheck=0
[VT]
name=VT
baseurl=ftp://172.16.10.18/rhel5/VT
enabled=1
gpgcheck=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 ftp://172.16.10.18/benet.repo
--2013-03-31 21:18:55--  ftp://172.16.10.18/benet.repo
           => `benet.repo'
Connecting to 172.16.10.18:21... 已連接。
正在以 anonymous 登錄 ... 登錄成功!
==> SYST ... 完成。    ==> PWD ... 完成。
==> TYPE I ... 完成。  ==> 不需要 CWD。
==> SIZE benet.repo ... 370
==> PASV ... 完成。    ==> RETR benet.repo ... 完成。
長度:370

100%[======================================>] 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, security
This system is not registered with RHN.
RHN support will be disabled.
Cluster                                                  | 1.1 kB     00:00     
ClusterStorage                                           | 1.1 kB     00:00     
ftp://172.16.10.18/rhel5/other/repodata/repomd.xml: [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

 

本文出自 “技術成就未來” 博客,請務必保留此出處http://jishuweiwang.blog.51cto.com/6977090/1208372

發佈了32 篇原創文章 · 獲贊 0 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章