今天重裝好redhat 系統後,安裝apache時,遇到了no acceptable C compiler found in $PATH錯誤,從網上找來一些資料,提示我沒有安裝gcc等編譯器,為了方便快捷,就建議使用yum這個服務,從網上瞭解來一些關於YUM服務的資料,我這裡就不在贅述了,你可以百度一下,資料很多;從網上的資料瞭解到;YUM主要是用於自動升級、安裝/移除rpm軟體包,它能夠自動尋找並解決rpm包之間的依賴關係,而無需咱們管理員逐個安裝每一個包,這樣的話為咱們管理員節約很多時間那。。呵呵呵。。
yum包系統預設是安裝的。。。查看命令
[root@learn ~]# rpm -qa | grep yum
yum-metadata-parser-1.0-8.fc6
yum-3.0.1-5.el5
yum-rhn-plugin-0.4.3-1.el5
yum-updatesd-3.0.1-5.el5
下面就來描述一下如何構建本地源,下面的這個方法是找了一些資料以及自己的親身實踐,同樣會把一些心得寫出來,希望可以幫到大家;
這裡是使用RHEL5內建的DVD的軟體包組成軟體庫,並結合VSFTPD服務,提供基於ftp方式的簡易的YUM源,這個雖然簡易,但實用性強;
步驟如下:
1.安裝vsftpd包和createrpro 軟體包
安裝vsftpd包的目的我就不解釋了。。就是ftp服務嘛
createrpro工具主要是用於收集rpm包檔案頭大資訊,以建立repodata軟體庫資料(是經gaip壓縮的xml檔案)
首先是建立目錄、media/cdrom目錄,掛在包, 命令:mount /dev/cdrom /media/cdrom/
之後安裝vsftpd和creatrepo包
rpm -ivh /media/cdrom/Server/vsftpd-2.0.5-10.el5.i386.rpm
warning: /media/cdrom/Server/vsftpd-2.0.5-10.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
package vsftpd-2.0.5-10.el5 is already installed
[root@learn ~]# rpm -ivh /media/cdrom/Server/createrepo-0.4.4-2.fc6.noarch.rpm
2.是準備軟體庫目錄,為了方面就放在了/var/ftp/rhel5(建立的目錄)
將/media/cdrom/下面的包放到/rhel5/下,是為了讓使用者能訪問到,這個是在ftp的路徑下
cp -prf /media/cdrom/* /var/ftp/rhel5/
3.建立repository 軟體庫的資訊檔
createrepo -g repodata/comps-rhel5-cluster.xml ./
cd ../ClusterStorage/
createrepo -g repodata/comps-rhel5-cluster-st.xml ./
cd ../Server/
createrepo -g repodata/comps-rhel5-server-core.xml ./
cd ../VT/
createrepo -g repodata/comps-rhel5-vt.xml ./
rm -rf /var/ftp/rhel5/*.olddata/ 這個是清除舊資料
4.開啟vsftpd 服務
[root@learn ~]# service vsftpd restart
\關閉vsftpd:[確定]
為vsftpd 啟動vsftpd:[確定] 如果啟動不起來,看看你的vsftpd.conf的設定檔
5.設定YUM源位置
使用YUM之前,必須為用戶端建立指定的設定檔,設定好源檔案的位置和可以用的目錄等
[root@learn ~]# cd /etc/yum.repos.d/
[root@learn yum.repos.d]# ls
rhel5-pkgs-yumser.repo 這個檔案是自己定義的
編輯這個檔案
[Cluster]
name=cluster directory
baseurl=ftp://172.16.17.120/rhel5/Cluster
enabled=1
gpgcheck=0
[ClusterStorage]
name=clusterStorage directory
baseurl=ftp://172.16.17.120/rhel5/ClusterStorage
enabled=1
gpgcheck=0
[Server]
name=Server directory
baseurl=ftp://172.16.17.120/rhel5/Server
enabled=1
gpgcheck=0
[VT]
name=VT directory
baseurl=ftp://172.16.17.120/rhel5/VT
enabled=1
gpgcheck=0
儲存、、退出就OK
執行命令:yum clean all 是表示更新緩衝
常用yum命令
yum list updates 查看那些是可以升級的包
yum list installed 查看本機已安裝的包
yum install 包名 安裝××包
之後要按“Y”進行確認
這樣的話。。。。YUM源就構建ok了、、
應用一下::;
[root@learn mysql-5.0.56]# yum -y install ncurses-devel
Loading "rhnplugin" plugin
Loading "installonlyn" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Setting up repositories
Cluster 100% |=========================| 1.1 kB 00:00
ClusterStorage 100% |=========================| 1.1 kB 00:00
VT 100% |=========================| 1.1 kB 00:00
Server 100% |=========================| 1.1 kB 00:00
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for ncurses-devel to pack into transaction set.
ncurses-devel-5.5-24.2006 100% |=========================| 98 kB 00:00
---> Package ncurses-devel.i386 0:5.5-24.20060715 set to be updated
--> Running transaction check
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
ncurses-devel i386 5.5-24.20060715 Server 1.6 M
Transaction Summary
=============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 1.6 M
Downloading Packages:
(1/1): ncurses-devel-5.5- 100% |=========================| 1.6 MB 00:00
Running Transaction Test
warning: ncurses-devel-5.5-24.20060715: Header V3 DSA signature: NOKEY, key ID 37017186
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: ncurses-devel ######################### [1/1]
Installed: ncurses-devel.i386 0:5.5-24.20060715
Complete!