以下文章是转载,虽然内容很多,但我们并不想制作yum。我们只是想可以用yum下载并安装互联网上的软件包,因为红帽没有注册,所以不可以用红帽官方源,但可以用centos的,我在REDHAT5上是这样实现的(相信我)
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 并复制以下代码(这部是重新创建了/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 形成了现在的 yum,感觉上 yum 和 apt 的原理类似,但是 apt 是编译代码,执行效率远高于使用 python 写成的 yum。这是 yum 的主页。
yum 的理念是使用一个中心仓库(repository)管理一部分甚至一个 distribution 的应用程序相互关系,根据计算出来的软件依赖关系进行相关的升级、安装、删除等等操作,减少了 Linux 用户一直头痛的 dependencies 的问题。这一点上,yum 和 apt 相同。apt 原为 debian 的 deb 类型软件管理所使用,但是现在也能用到 RH 门下的 rpm 了。 一般这类软件通过一个或者多个配置文件描述对应的 repository 的网络地址,通过 http 或者 ftp 协议在需要的时候从 repository 获得必要的信息,下载相关的软件包。这样,本地用户通过建立不同的 repository 的描述说明,在有 Internet 连接时就能方便进行系统的升级维护工作。另外,如果需要使用代理,可以用 http_proxy 和 ftp_proxy 这些 shell 里面标准环境变量的设定。 repository 是用 yum-arch 或者 createrepo 命令创建的,也可以用别人已有的 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:寻找互联网上的源大家都知道rhel想要更新软件都是要注册的,那么我们就不去官网更新!下面配置是前往和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................................. |
|