您好,登錄后才能下訂單哦!
CentOS系統(tǒng)yum源代碼的使用方法和更新情況是怎樣的,針對(duì)這個(gè)問(wèn)題,這篇文章詳細(xì)介紹了相對(duì)應(yīng)的分析和解答,希望可以幫助更多想解決這個(gè)問(wèn)題的小伙伴找到更簡(jiǎn)單易行的方法。
大家應(yīng)該對(duì)CentOS系統(tǒng)很了解了,CentOS系統(tǒng)應(yīng)該是做為服務(wù)器的linux的佼佼者。CentOS系統(tǒng)采用的二進(jìn)制包是rpm,不過(guò)包的依賴(lài)性解決有時(shí)候卻是個(gè)問(wèn)題。yum是個(gè)不錯(cuò)的東西。yum的使用和debian的apt有幾分相似,這樣對(duì)于許多包的安裝就方便多了。
這篇文章主要講兩點(diǎn)內(nèi)容,一是yum使用方法的整理;二是找一個(gè)比較快的國(guó)內(nèi)的源。
1.CentOS系統(tǒng)yum的使用:
1)CentOS系統(tǒng)包的更新
1.1)檢查可更新包: yum check-update
1.2)更新所有包: yum update
1.3)更新指定包: yum update package_name
1.4)版本升級(jí): yum upgrade
2)CentOS系統(tǒng)包安裝與刪除
2.1)yum install package_name
2.2)yum remove package_name
3)CentOS系統(tǒng)包搜索
3.1)搜索特定包: yum search package_name
3.2)搜索包含特定文件名的包:yum provides name
4)CentOS系統(tǒng)包列表
4.1)列出所有安裝或更新的包: yum list
4.2)列出指定包:yum list name
4.3)列出可更新包:yum list updates
4.4)列出已安裝包:yum list installed
4.5)列出已安裝但不包含在資源庫(kù)中的包:yum list extras
2.CentOS系統(tǒng)yum源設(shè)定
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源設(shè)為中國(guó)科技大學(xué)網(wǎng)站
1.以root用戶(hù)進(jìn)入CentOS系統(tǒng)。
[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
內(nèi)容如下(以中國(guó)科技大學(xué)的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
關(guān)于CentOS系統(tǒng)yum源代碼的使用方法和更新情況是怎樣的問(wèn)題的解答就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,如果你還有很多疑惑沒(méi)有解開(kāi),可以關(guān)注億速云行業(yè)資訊頻道了解更多相關(guān)知識(shí)。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。