RHEL6___構建基於vsftd的YUM源服務器
1.爲何要構建本地YUM源
在Linux主機中使用YUM客戶端工具在線升級、安裝軟件時,因爲受到網絡鏈接速度、網絡帶寬的限制,每每給用戶安裝帶來沒必要要的麻煩。可是若是在局域網中構建一個基於本地的YUM源服務器,則能夠大大解決用戶安裝軟件速度較慢的問題。
2.如何構建本地YUM源
思路:能夠經過從rhel6安裝光盤獲取須要的rpm包,結合使用HTTP或FTP協議,便可構建一個位於本地局域網的YUM源服務器工具
實現步驟測試
(1)安裝createrepo工具
createrepoa主要用於收集目錄中的rpm包文件的頭信息,以建立repodata軟件倉庫數據(經gzip壓縮的xml文件)。
mount /dev/cdrom /media/cdrom/ //掛載光盤
rpm -ivh /media/cdrom/Packages/createrepo-0.9.8-4.el6.noarch.rpm
(2)安裝FTP服務器
rpm -ivh /media/cdrom/Packages/vsftpd
(3)配置軟件倉庫目錄
可參考安裝光盤的Server目錄
mkdir /var/ftp/pub/Packages
mkdir /var/ftp/pub/repodata
從光盤把全部的RPM包複製到/var/ftp/pub/Packages目錄下(要確保硬盤有足夠的磁盤空間)
cp -rv /media/cdrom/Packages/* /var/ftp/pub/Packages/
(3)建立軟件倉庫信息文件
cd /var/ftp/pub/
createrepo --database ./
[root@server pub]# ls repodata/
filelists.sqlite.bz2 other.sqlite.bz2 primary.sqlite.bz2 repomd.xml
filelists.xml.gz other.xml.gz primary.xml.gz
能夠看到已經建立好了相應的軟件倉庫信息文件
(4)啓動vsftpd服務
service vsftpd start
chkconfig --level 35 vsftpd on
(5)在另外一臺客戶端測試,首先建立repo文件指定YUM源位置
vi /etc/yum.repos.d/server1.repo,注意文件的擴展名要以repo結尾,文件內容以下
[rhel6] //軟件倉庫的名字
name=rhel6 //軟件倉庫的描述
baseurl=ftp://192.168.100.1/pub //軟件倉庫的位置
enabled=1 //是否起用軟件倉庫
gpgcheck=1 //是否檢查GPG簽名(用來驗證要安裝的包是否是REDHAT官方的)
gpgkey=file://etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release GPG簽名密鑰的位置
使用yum客戶工具安裝samba
[root@mail ~]# yum -y install samba*
Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Package samba-winbind-clients-3.5.4-68.el6.x86_64 already installed and latest version
Package samba-common-3.5.4-68.el6.x86_64 already installed and latest version
Package samba-client-3.5.4-68.el6.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package samba.x86_64 0:3.5.4-68.el6 set to be updated
---> Package samba-winbind.x86_64 0:3.5.4-68.el6 set to be updated
--> Finished Dependency Resolution
Package Arch Version Repository Size
===================================================================================
Installing:
samba x86_64 3.5.4-68.el6 rhel6 5.0 M
samba-winbind x86_64 3.5.4-68.el6 rhel6 3.6 M
===================================================================================
Install 2 Package(s)
Upgrade 0 Package(s)
Installed size: 30 M
Downloading Packages:
(1/2): samba-3.5.4-68.el6.x86_64.rpm | 5.0 MB 00:00
(2/2): samba-winbind-3.5.4-68.el6.x86_64.rpm | 3.6 MB 00:00
-----------------------------------------------------------------------------------
Total 25 MB/s | 8.6 MB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : samba-winbind-3.5.4-68.el6.x86_64 1/2
Installing : samba-3.5.4-68.el6.x86_64 2/2
Installed:
samba.x86_64 0:3.5.4-68.el6 samba-winbind.x86_64 0:3.5.4-68.el6
samba-3.5.4-68.el6.x86_64
samba-client-3.5.4-68.el6.x86_64
samba-winbind-clients-3.5.4-68.el6.x86_64
samba-common-3.5.4-68.el6.x86_64
samba-winbind-3.5.4-68.el6.x86_64
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release 導入簽名密鑰