以下文章是轉載,雖然內容很多,但我們并不想制作yum。我們只是想可以用yum下載并安裝互聯(lián)網(wǎng)上的軟件包,因為紅帽沒有注冊,所以不可以用紅帽官方源,但可以用centos的,我在REDHAT5上是這樣實現(xiàn)的(相信我)
1、首先移動(這里用到是mv 命令,之所以用這個是不想讓這兩個文件影響下一步的操作)兩個文件
#mv /etc/yum.conf /etc/yum.conf.bak
#mv /etc/yum.repos.d /etc/yum.repos.d.bak 注:這個方法并不需要yum.repos.d 目錄,為了不讓它影響我們,將它換個名字
2、vi /etc/yum.conf 并復制以下代碼(這部是重新創(chuàng)建了/etc/yum.conf)
[main]
cachedir=/var/cache/yum keepcache=1 debuglevel=2 logfile=/var/log/yum.log pkgpolicy=newest distroverpkg=redhat-release tolerant=1 exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 metadata_expire=1800 # PUT YOUR REPOS HERE OR IN separate files named file.repo # in /etc/yum.repos.d [base] name=centos-5 - Base baseurl=http://centos.ustc.edu.cn/centos/5/os/i386/ # the other site: http://centos./centos/5/os/i386/ # you can find more site in: http://www./modules/tinycontent/index.php?id=13 enabled=1 gpgcheck=1 gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5 #released updates [update] name=CentOS-5 - Updates baseurl=http://mirror./centos/5/updates/i386/ gpgcheck=1 gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5 #packages used/produced in the build but not released [addons] name=CentOS-5 - Addons baseurl=http://mirror./centos/5/addons/$basearch/ gpgcheck=1 gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5 #additional packages that may be useful [extras] name=CentOS-5 - Extras baseurl=http://mirror./centos/5/extras/$basearch/ gpgcheck=1 gpgkey=http://mirror./centos/RPM-GPG-KEY-centos4 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-5 - Plus
baseurl=http://mirror./centos/5/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5 #contrib - packages by Centos Users [contrib] name=CentOS-5 - Contrib baseurl=http://mirror./centos/5/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5 #packages in testing [testing] name=CentOS-5 - Testing baseurl=http://mirror./centos/5/testing/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5 3、 yum update 以下是轉載 什么是 yum? yum 是 yellowdog updater modified 的縮寫。yellowdog 是一個 Linux 的 distribution,RH 將這種升級技術利用到自己的 distribution 形成了現(xiàn)在的 yum,感覺上 yum 和 apt 的原理類似,但是 apt 是編譯代碼,執(zhí)行效率遠高于使用 python 寫成的 yum。這是 yum 的主頁。
yum 的理念是使用一個中心倉庫(repository)管理一部分甚至一個 distribution 的應用程序相互關系,根據(jù)計算出來的軟件依賴關系進行相關的升級、安裝、刪除等等操作,減少了 Linux 用戶一直頭痛的 dependencies 的問題。這一點上,yum 和 apt 相同。apt 原為 debian 的 deb 類型軟件管理所使用,但是現(xiàn)在也能用到 RH 門下的 rpm 了。 一般這類軟件通過一個或者多個配置文件描述對應的 repository 的網(wǎng)絡地址,通過 http 或者 ftp 協(xié)議在需要的時候從 repository 獲得必要的信息,下載相關的軟件包。這樣,本地用戶通過建立不同的 repository 的描述說明,在有 Internet 連接時就能方便進行系統(tǒng)的升級維護工作。另外,如果需要使用代理,可以用 http_proxy 和 ftp_proxy 這些 shell 里面標準環(huán)境變量的設定。 repository 是用 yum-arch 或者 createrepo 命令創(chuàng)建的,也可以用別人已有的 repository 作為鏡像,這里部探討如何建立一個 repository。 相關鏈接:http://heli./5407142.html yum配置方案1:用于安裝hearbeat[root@localhost ~]# cat /etc/yum.conf [main] exclude=apache* bind-chroot courier* dovecot* exim* mod_ssl* mysql* nsd* perl* php* proftpd* pure-ftpd* ruby* spamassassin* squirrelmail* wget* http_caching=packages cachedir=/var/cache/yum keepcache=1 debuglevel=2 logfile=/var/log/yum.log pkgpolicy=newest distroverpkg=redhat-release tolerant=1 exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 timeout=10000 metadata_expire=1800 # PUT YOUR REPOS HERE OR IN separate files named file.repo # in /etc/yum.repos.d #[Base] #name=as5-base #baseurl=http://centos.ustc.edu.cn/centos/5/os/i386 #gpgcheck=1 #gpgkey=http://mirror./centos/RPM-GPG-KEY-CentOS-5
[root@localhost ~]# cat /etc/yum.repos.d/centos.repo # 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 baseurl=http://centos.ustc.edu.cn/centos/5/os/i386/ gpgcheck=1 gpgkey=http://mirror./centos/RPM-GPG-KEY-CentOS-5 #released updates [updates] name=CentOS-$releasever - Updates baseurl=http://centos.ustc.edu.cn/centos/5/updates/i386/ gpgcheck=1 gpgkey=http://mirror./centos/RPM-GPG-KEY-CentOS-5 #packages used/produced in the build but not released [addons] name=CentOS-$releasever - Addons baseurl=http://centos.ustc.edu.cn/centos/5/addons/i386/ gpgcheck=1 gpgkey=http://mirror./centos/RPM-GPG-KEY-CentOS-5 #additional packages that may be useful
[extras] name=CentOS-$releasever - Extras baseurl=http://centos.ustc.edu.cn/centos/5/extras/i386/ gpgcheck=1 gpgkey=http://mirror./centos/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus baseurl=http://centos.ustc.edu.cn/centos/5/centosplus/i386/ gpgcheck=1 enabled=0 gpgkey=http://mirror./centos/RPM-GPG-KEY-CentOS-5 yum配置方案2:尋找互聯(lián)網(wǎng)上的源大家都知道rhel想要更新軟件都是要注冊的,那么我們就不去官網(wǎng)更新!下面配置是前往和ustc.edu.cn站點更新! 配置rhel 5 使用CentOS的yum站點升級 刪除原來的/etc/yum.conf文件和/etc/yum.repo.d目錄 vi /etc/yum.conf exclude=apache* bind-chroot courier* dovecot* exim* httpd* mod_ssl* mysql* nsd* perl* php* proftpd* pure-ftpd* ruby* spamassassin* squirrelmail* wget* 【注意,這里定義的程序將不會被更新】
測試下 yum -y install system-config-date ok................................. |
|