|簡體中文

比思論壇

 找回密碼
 按這成為會員
搜索



查看: 1125|回復: 0
打印 上一主題 下一主題

yum 本地源及网络源的配置汇总

[複製鏈接]

111

主題

1

好友

463

積分

中學生

Rank: 3Rank: 3

  • TA的每日心情
    開心
    2024-4-11 17:15
  • 簽到天數: 338 天

    [LV.8]以壇為家I

    推廣值
    0
    貢獻值
    22
    金錢
    169
    威望
    463
    主題
    111
    樓主
    發表於 2011-10-24 10:53:36
    yum 本地源及网络源的配置汇总
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    yum 本地源的配置
    [root@jesse ~]# cd /etc/yum.repos.d/
    [root@jesse yum.repos.d]# ls
    CentOS-Base.repo  CentOS-Media.repo
    [root@jesse yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.BAK
    [root@jesse yum.repos.d]# ls
    CentOS-Base.repo.BAK  CentOS-Media.repo
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    [root@jesse yum.repos.d]# vi CentOS-Media.repo   
    #本地yum源修改成以下配置文件即可
    # CentOS-Media.repo
    #
    # This repo is used to mount the default locations for a CDROM / DVD on
    #  CentOS-5.  You can use this repo and yum to install items directly off the
    #  DVD ISO that we release.
    #
    # To use this repo, put in your DVD and use it with the other repos too:
    #  yum --enablerepo=c5-media [command]
    #
    # or for ONLY the media repo, do this:
    #
    #  yum --disablerepo=\* --enablerepo=c5-media [command]

    [c5-media]
    name=CentOS-$releasever - Media
    baseurl=file:///mnt/
    gpgcheck=0
    enabled=1

    #wq 保存并退出
    #/mount /dev/cdrom mnt
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    网络源的配置详解:
    [root@jesse ~]# cd /etc/yum.repos.d/
    [root@jesse yum.repos.d]# ls
    CentOS-Base.repo  CentOS-Media.repo

    [root@jesse yum.repos.d]# vi
    CentOS-Base.repo
    #以下是我修改好的网络源
    #改动地点:1注释掉了mirrorlist开头得行,打开baseurl开头的行2:将mirror.centos.org修改成了mirrors.sohu.com
    #批量替换方法:vi 命令模式下输入%s/mirror.centos.org/mirrors.sohu.com/g

    [base]
    name=CentOS-$releasever - Base
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
    baseurl=http://mirrors.sohu.com/centos/$releasever/os/$basearch/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/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://mirrors.sohu.com/centos/$releasever/updates/$basearch/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/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://mirrors.sohu.com/centos/$releasever/addons/$basearch/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/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://mirrors.sohu.com/centos/$releasever/extras/$basearch/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/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://mirrors.sohu.com/centos/$releasever/centosplus/$basearch/
    gpgcheck=1
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

    #contrib - packages by Centos Users
    [contrib]
    name=CentOS-$releasever - Contrib
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
    baseurl=http://mirrors.sohu.com/centos/$releasever/contrib/$basearch/
    gpgcheck=1
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

    #以上是配置好的较快的网络更新源
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    默认情况下:yum 安装好后的rpm包会被自动清除,如果我们想不自动清除的话,
    [root@jesse ~]# vi /etc/yum.conf
    [main]
    cachedir=/var/cache/yum
    keepcache=1     #将这里的0修改为1
    debuglevel=2
    #保存退出
    #我们安装好后的软件存放的位置:/var/cache/yum/base/packages
    重要聲明:本論壇是以即時上載留言的方式運作,比思論壇對所有留言的真實性、完整性及立場等,不負任何法律責任。而一切留言之言論只代表留言者個人意見,並非本網站之立場,讀者及用戶不應信賴內容,並應自行判斷內容之真實性。於有關情形下,讀者及用戶應尋求專業意見(如涉及醫療、法律或投資等問題)。 由於本論壇受到「即時上載留言」運作方式所規限,故不能完全監察所有留言,若讀者及用戶發現有留言出現問題,請聯絡我們比思論壇有權刪除任何留言及拒絕任何人士上載留言 (刪除前或不會作事先警告及通知 ),同時亦有不刪除留言的權利,如有任何爭議,管理員擁有最終的詮釋權。用戶切勿撰寫粗言穢語、誹謗、渲染色情暴力或人身攻擊的言論,敬請自律。本網站保留一切法律權利。

    手機版| 廣告聯繫

    GMT+8, 2024-11-16 04:57 , Processed in 0.043116 second(s), 25 queries , Gzip On.

    Powered by Discuz! X2.5

    © 2001-2012 Comsenz Inc.

    回頂部