我們接著上一篇,繼續搭建YUM服務
1.掛載光盤鏡像
先接著把光盤鏡像掛載起來,因為YUM數據倉庫的RPM包都要先從安裝光盤中拷貝出來
# mount /dev/cdrom /media/
mount: block device /dev/sr0 is write-protected, mounting read-only
2.將光盤中的內容,復制到/var/ftp/pub目錄下
/var/ftp/pub目錄在vsftp安裝完成後,一般會自動生成
# cp -a /media/* /var/ftp/pub/
3.更新數據倉庫中的依賴關系,及分組信息
# createrepo -g /var/ftp/pub/repodata/2727fcb43fbe4c1a3588992af8c19e4d97167aee2f6088959221fc285cab6f72-c6-x86_64-comps.xml /var/ftp/pub/
Spawning worker 0 with 3955 pkgs
Workers Finished
Gathering worker results
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
4.啟動vsftp並檢查監聽是否正常
# service vsftpd start
Starting vsftpd for vsftpd: [ OK ]
# netstat -nlptu |grep vsftpd
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 2806/vsftpd
5.本地登陸,查看是否可以正常看到/var/ftp/pub目錄中的內容
# ftp 127.0.0.1
Connected to 127.0.0.1 (127.0.0.1).
220 (vsFTPd 2.2.2)
Name (127.0.0.1:root): ftp
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (127,0,0,1,195,194).
150 Here comes the directory listing.
drwxr-xr-x 7 0 0 4096 Nov 06 13:48 pub
226 Directory send OK.
ftp> cd pub
250 Directory successfully changed.
ftp> ls
227 Entering Passive Mode (127,0,0,1,142,7).
150 Here comes the directory listing.
 
-r--r--r-- 1 0 0 14 Mar 05 2013 CentOS_BuildTag
dr-xr-xr-x 3 0 0 4096 Mar 05 2013 EFI
-r--r--r-- 1 0 0 212 Mar 02 2013 EULA
-r--r--r-- 1 0 0 18009 Mar 02 2013 GPL
dr-xr-xr-x 2 0 0 282624 Mar 05 2013 Packages
-r--r--r-- 1 0 0 1354 Mar 02 2013 RELEASE-NOTES-en-US.html
-r--r--r-- 1 0 0 1706 Mar 02 2013 RPM-GPG-KEY-CentOS-6
-r--r--r-- 1 0 0 1730 Mar 02 2013 RPM-GPG-KEY-CentOS-Debug-6
-r--r--r-- 1 0 0 1730 Mar 02 2013 RPM-GPG-KEY-CentOS-Security-6
-r--r--r-- 1 0 0 1734 Mar 02 2013 RPM-GPG-KEY-CentOS-Testing-6
-r--r--r-- 1 0 0 3380 Mar 05 2013 TRANS.TBL
dr-xr-xr-x 3 0 0 4096 Mar 05 2013 images
dr-xr-xr-x 2 0 0 4096 Mar 05 2013 isolinux
drwxr-xr-x 2 0 0 4096 Nov 06 13:48 repodata
226 Directory send OK.
ftp>
可以看到,一切ok,下面到CentOS2上面配置客戶端
2號機上配置客戶端與前文所說的配置本地客戶端基本一致,只是把basurl的指向改為1號機的ftp
# cd /etc/yum.repos.d/
# rename repo repo.bak *
# cp -a CentOS-Debuginfo.repo.bak CentOS-Ftp.repo
# vim CentOS-Ftp.repo
[ftp]
name=CentOS-6 - FTPinfo
baseurl=ftp://192.168.80.3/pub
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
# yum clean all
Loaded plugins: fastestmirror, security
Cleaning repos: ftp
Cleaning up Everything
# yum repolist all
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
repo id repo name status
ftp CentOS-6 - FTPinfo enabled: 3,955
repolist: 3,955