- 论坛徽章:
- 0
|
近来本打算在机上安装apache httpd的rpm包,使用rpm -ivh 命令安装时发现与很多包有依赖关系,这样一个包一个包安装且不说嫌麻烦况且也不知道那个先那个后;后来转变思路rpm不行,俺用下载个tar.gz压缩包自己编译呗,运行./configure命令发现机上没有gcc,通过rpm -ivh gcc时又发现包的相互依赖,感觉不甚其烦。在网上google发现有yum这个好东西,我把使用yum的一些心得小结如下,以下配置实现软件的在线安装。
1.yum安装
在RHEL AS5.1的安装光盘中自带有yum的rpm包,运行rpm -ivh yum.****.rpm 即可。或者安装前通过rpm -qi yum命令查看下。
2.yum配置
安装后,其配置文件位于/etc/yum.conf,通过vi yum.conf打开配置文件并末尾处添加以下内容
- [Base]
- name=as5-base
- baseurl=http://centos.ustc.edu.cn/centos/5/os/$basearch
- gpgcheck=1
- gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
复制代码
由于RHEL AS系统升级为收费服务,所以无法使用RHEL自身的yum源进行软件安装和升级,但由于centos与RHEL系统几乎相差无几,所以对RHEL进行软件安装和升级时可使用centos的yum源。RHEL AS5.1yum的配置除更改yum.conf文件外还可在/etc/yum.repos.d下新建一个*.repo文件,把以上代码内容粘贴于此文件中而不用改动yum.conf文件,在以上代码中‘$basearch’表示电脑架构,PC的为I386。作此配置可实现软件的安装,如要实现系统升级需在配置[updates]项,完整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/$basearch/
- 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/$basearch/
- 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/$basearch/
- 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/$basearch/
- 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/$basearch/
- gpgcheck=1
- enabled=0
- gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
复制代码
3.yum使用
yum install 软件名,如yum install gcc
[ 本帖最后由 outmylife 于 2008-9-17 12:49 编辑 ] |
|