您好,登錄后才能下訂單哦!
CentOS系統yum源代碼的使用方法和更新情況是怎樣的,針對這個問題,這篇文章詳細介紹了相對應的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。
大家應該對CentOS系統很了解了,CentOS系統應該是做為服務器的linux的佼佼者。CentOS系統采用的二進制包是rpm,不過包的依賴性解決有時候卻是個問題。yum是個不錯的東西。yum的使用和debian的apt有幾分相似,這樣對于許多包的安裝就方便多了。
這篇文章主要講兩點內容,一是yum使用方法的整理;二是找一個比較快的國內的源。
1.CentOS系統yum的使用:
1)CentOS系統包的更新
1.1)檢查可更新包: yum check-update
1.2)更新所有包: yum update
1.3)更新指定包: yum update package_name
1.4)版本升級: yum upgrade
2)CentOS系統包安裝與刪除
2.1)yum install package_name
2.2)yum remove package_name
3)CentOS系統包搜索
3.1)搜索特定包: yum search package_name
3.2)搜索包含特定文件名的包:yum provides name
4)CentOS系統包列表
4.1)列出所有安裝或更新的包: yum list
4.2)列出指定包:yum list name
4.3)列出可更新包:yum list updates
4.4)列出已安裝包:yum list installed
4.5)列出已安裝但不包含在資源庫中的包:yum list extras
2.CentOS系統yum源設定
2.1)加快yum下載速度: yum -y install yum-fastestmirror,在CentOs 4上名字叫做yum-plugin-fastestmirror
2.2)yum源文件:/etc/yum.repos.d/CentOS-Base.repo
2.3)CentOS 5的yum源設為中國科技大學網站
1.以root用戶進入CentOS系統。
[root@xuxy ~]# cd /etc/yum.repos.d
2.備份repo
[root@xuxy yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak
3.建立新的CentOS-Base.repo文件:(以CentOS 5.2為例)
[root@xuxy yum.repos.d]#vi CentOS-Base.repo
內容如下(以中國科技大學的yum源為例):
# CentOS-Base.repo # # This file uses a new mirrorlist system developed by Lance Davis for CentOS. # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # #
[base] name=CentOS-$releasever - Base #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os baseurl=http://centos.ustc.edu.cn/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5 #released updates [updates] name=CentOS-$releasever - Updates #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates baseurl=http://centos.ustc.edu.cn/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
#packages used/produced in the build but not released [addons] name=CentOS-$releasever - Addons #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons baseurl=http://centos.ustc.edu.cn/centos/$releasever/addons/$basearch/ gpgcheck=1 gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful [extras] name=CentOS-$releasever - Extras #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras baseurl=http://centos.ustc.edu.cn/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus baseurl=http://centos.ustc.edu.cn/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
關于CentOS系統yum源代碼的使用方法和更新情況是怎樣的問題的解答就分享到這里了,希望以上內容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關注億速云行業資訊頻道了解更多相關知識。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。