西安美林数据怎么样:【yum】 自从有了yum,红帽变得好美丽!~

来源:百度文库 编辑:九乡新闻网 时间:2024/05/08 08:52:14
以下文章是转载,虽然内容很多,但我们并不想制作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.candishosting.com.cn/centos/5/os/i386/
# you can find more site in: http://www.centos.org/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.org/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.org/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.org/centos/5/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5 - Plus
baseurl=http://mirror.centos.org/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.org/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.org/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.bokee.com/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.org/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.org/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.org/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.org/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.org/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.org/centos/RPM-GPG-KEY-CentOS-5

yum配置方案2:寻找互联网上的源

大家都知道rhel想要更新软件都是要注册的,那么我们就不去官网更新!下面配置是前往centos.org和ustc.edu.cn站点更新!

配置rhel 5 使用CentOS的yum站点升级

删除原来的/etc/yum.conf文件和/etc/yum.repo.d目录
rm -rf /etc/yum.conf
cd /etc/yum.repos.d/
rm -rf rhel-debuginfo.repo

vi /etc/yum.conf
[main]

exclude=apache* bind-chroot courier* dovecot* exim* httpd* mod_ssl* mysql* nsd* perl* php* proftpd* pure-ftpd* ruby* spamassassin* squirrelmail* wget*   【注意,这里定义的程序将不会被更新】
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.candishosting.com.cn/centos/5/os/i386/
# you can find more site in: http://www.centos.org/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.org/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.org/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.org/centos/5/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5 - Plus
baseurl=http://mirror.centos.org/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.org/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.org/centos/5/testing/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5


到此就ok了 ,是不是很方便!!!,这个是中科大的源,号称每隔小时跟新一次,速度确实蛮快

 

测试下

yum -y install system-config-date

ok.................................

本段参考:http://hxl2009.blog.51cto.com/779549/197359