CentOS VPS新手教程(3)YUM源配置

來源:互聯網
上載者:User

CentOS VPS新手教程(3)YUM源配置 在伺服器上,可能需要安裝許多軟體。如果要搭建一個部落格,通常需要一個支援PHP的web伺服器,如Apache,Nginx等,還需要一個關係型資料庫,如MySQL。 安裝這一些類的軟體可能需要很長的時間,其中涉及到很多配置、初始化、依賴的問題,還有可能需要自己編譯某些軟體。我們可以通過使用CentOS中內建的YUM包管理軟體方管理安裝的軟體,使軟體的安裝、更新和刪除方便了不少。(各個Linux發行版通常都帶有各自的包管理軟體,如Ubuntu的apt) YUM的對於軟體的管理依賴於設定檔中設定的YUM源,這些YUM源通常是由某些公司、組織管理的。我們可以通過這些源來找尋我們需要安裝的軟體。 添加YUM源一般CentOS VPS都內建了一些預設的YUM源,可以通過查看/etc/yum.repos.d/目錄, 1$ ls /etc/yum.repos.d/來查看預設有那些源。其中,每一個*.repo檔案都表示某個YUM源,檔案中描述了該源的名稱、地址、是否啟動、校正等資訊。 可以通過在該目錄下添加一個自己的*.repo檔案來增加一個源。 下面是我的源: CentOS-Base.repo 01# CentOS-Base.repo02#03# The mirror system uses the connecting IP address of the client and the04# update status of each mirror to pick mirrors that are updated to and05# geographically close to the client.  You should use this for CentOS updates06# unless you are manually picking other mirrors.07#08# If the mirrorlist= does not work for you, as a fall back you can try the09# remarked out baseurl= line instead.10#11#12 13[base]14name=CentOS-$releasever - Base15mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os16#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/17gpgcheck=118enabled=119gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-520 21#released updates22[updates]23name=CentOS-$releasever - Updates24mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates25#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/26gpgcheck=127enabled=128gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-529 30#additional packages that may be useful31[extras]32name=CentOS-$releasever - Extras33mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras34#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/35gpgcheck=136enabled=137gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-538 39#additional packages that extend functionality of existing packages40[centosplus]41name=CentOS-$releasever - Plus42mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus43#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/44gpgcheck=145enabled=046gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-547 48#contrib - packages by Centos Users49[contrib]50name=CentOS-$releasever - Contrib51mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib52#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/53gpgcheck=154enabled=0如果你是教育網IPv6環境(IPv4亦可)的,可以添加清華大學開源鏡像站的源,速度很快 tsinghua.repo 01[base]02name=CentOS-6 - Base03repo=os04baseurl=http://mirrors.tuna.tsinghua.edu.cn/centos/6.4/os/$basearch/05gpgcheck=106gpgkey=http://mirrors.tuna.tsinghua.edu.cn/centos/RPM-GPG-KEY-CentOS-607 08[update]09name=CentOS-6 - Updates10baseurl=http://mirrors.tuna.tsinghua.edu.cn/centos/6.4/updates/$basearch/11gpgcheck=112gpgkey=http://mirrors.tuna.tsinghua.edu.cn/centos/RPM-GPG-KEY-CentOS-613 14[extras]15name=CentOS-6 - Extras16baseurl=http://mirrors.tuna.tsinghua.edu.cn/centos/6.4/extras/$basearch/17gpgcheck=118gpgkey=http://mirrors.tuna.tsinghua.edu.cn/centos/RPM-GPG-KEY-CentOS-619 20[centosplus]21name=CentOS-6 - Plus22baseurl=http://mirrors.tuna.tsinghua.edu.cn/centos/6.4/centosplus/$basearch/23gpgcheck=124enabled=025gpgkey=http://mirrors.tuna.tsinghua.edu.cn/centos/RPM-GPG-KEY-CentOS-626 27[contrib]28name=CentOS-6 - Contrib29baseurl=http://mirrors.tuna.tsinghua.edu.cn/centos/6.4/contrib/$basearch/30gpgcheck=131enabled=032gpgkey=http://mirrors.tuna.tsinghua.edu.cn/centos/RPM-GPG-KEY-CentOS-6添加完YUM後,更新yum, 1# yum check-update這樣就完成了YUM源的添加。 安裝軟體包例如,安裝git,則運行如下命令, 1# yum install git 更新軟體包可以通過先檢查更新,在根據返回的所需更新軟體包進行更新操作。 1# yum check-update如返回以下更新資訊, 1<span>java-1.7.0-openjdk.i386    1:1.7.0.25-2.3.10.4.el5_9    updates</span>則表示openjdk1.7有更新,運行如下命令進行更新, 1# yum update java-1.7.0-openjdk.i386刪除軟體包例如,刪除git,則運行, 1# yum delete git 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.