標籤:yum 基本命令 yum庫
yum(全稱為 Yellow dog Updater, Modified)是一個在Fedora和RedHat以及SUSE中的Shell前端軟體包管理器。基於RPM包管理,能夠從指定的伺服器自動下載RPM包並且安裝,可以自動處理依賴性關係,並且一次安裝所有依賴的軟體包,無須繁瑣地一次次下載、安裝。yum提供了尋找、安裝、刪除某一個、一組甚至全部軟體包的命令,而且命令簡潔而又好記。
yum的命令形式:yum [options] [command] [package ...]
[options] 為可選項 ,[command]為所要進行的操作,[package ...]是操作的對象。
yum常用命令
1、列出所有可用repo yum repolist {enabled|disabled|all}
2、列出rpm包 yum list {all|installed|available}
3、包的描述資訊 yum info package_name
4、列出所有的包組資訊 yum grouplist
5、顯示包組的資訊:例如組中包含的程式包列表 yum groupinfo "GROUP NAME"
6、清理緩衝 yum clean {all|packages|metadata|expire-cache|rpmdb|plugins}
7、安裝程式包 yum install package_name
重新安裝: yum reinstall package_name
8、卸載 yum remove|erase package_name
9、安裝包組 yum groupinstall "GROUP NAME"
10、卸載包組 yum groupremove "GROUP NAME
yum相關的設定檔
主設定檔(中心設定檔):/etc/yum.conf
一個或幾個相關倉庫的配置資訊可儲存為一個檔案,檔案名稱都以.rep結尾:/etc/yum.repos.d/
在.repo檔案定義一個yum repo指向的格式:
[REPOID]
name=Some name for this repository
baseurl=file:///media/cdrom
ftp://sever/path
http://sever/path
enabled={0|1}
gpgcheck={0|1}
建立本地yum源
1,安裝需要的環境,在這裡需要用到httpd。
# yum install httpd
2,安裝recreaterepo包
# yum install createrepo
3,將rpm包複製到html下
# cp -rf /path /var/www/html
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/41/66/wKioL1PVCd2hpWAYAAAQY7_bpRg669.png" title="複製yum源.PNG" alt="wKioL1PVCd2hpWAYAAAQY7_bpRg669.png" />
4,執行createrepo 我是在/var/www/html下執行的
#createrepo sources
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/41/66/wKioL1PVCarhM9QnAAAcSD_Murk568.png" title="createrepo.PNG" alt="wKioL1PVCarhM9QnAAAcSD_Murk568.png" />
5,在/etc/yum.repos.d下編輯設定檔 此處為test
#vim test.repo
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/41/65/wKiom1PVCHyBoF0QAABy8MzTw1A365.jpg" title="編輯yum設定檔.png" alt="wKiom1PVCHyBoF0QAABy8MzTw1A365.jpg" />
6,啟動httpd,並查看是否使用80連接埠
# service httpd start 650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/41/66/wKioL1PVCT2iXxreAAAYtwBKQZk366.png" title="qidong httpd.PNG" alt="wKioL1PVCT2iXxreAAAYtwBKQZk366.png" />
# netstat -anlpt | grep httpd650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/41/65/wKiom1PVCDvxlGSzAABNgOBZgCc696.jpg" title="80duankou.png" alt="wKiom1PVCDvxlGSzAABNgOBZgCc696.jpg" />
7,在外部瀏覽器先開啟
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/41/65/wKiom1PVCGzSS4BZAAGdYYuGxzk340.jpg" title="sss.png" alt="wKiom1PVCGzSS4BZAAGdYYuGxzk340.jpg" />