首页 > 编程知识 正文

linux命令行安装yum,yum安装软件包的步骤

时间:2023-05-05 14:30:30 阅读:41098 作者:2378

1.yum的安装和配置

)1) yum安装

确定是否安装了yum :

[ root @ localhost~] # rpm-QA|grep yum

如果没有显示任何内容,表示系统上没有安装yum工具,yum安装软件包位于centos系统光盘上,然后运行以下命令进行安装:

[ root @ localhost~] # rpm-ivhyum-*.noarch.rpm

要安装yum,请安装Centos Linux系统安装光盘上的python-elementtree、python-sqlite、urlgrabber和yumconf等软件包的服务器如果在yum安装过程中遇到软件包之间的依赖关系,则只需按照依赖关系提示查找相应的软件包安装

以下是环境的安装示例。

[ root @ localhost~] # rpm-ivhyum-2.4.3-1.C4.noarch.rpm

warning : yum-2.4.3-1.C4.noarch.rpm : v3 dsasignature 3360 nokey,key ID 443e1821

error :故障从属关系:

python-elementtreeisneededbyyum-2.4.3-1.C4.noarch

python-sqliteisneededbyyum-2.4.3-1.C4.noarch

urlgrabberisneededbyyum-2.4.3-1.C4.noarch

yumconfisneededbyyum-2.4.3-1.C4.noarch

[ root @ localhost~] # rpm-ivhpython-element tree-1.2.6-4.2.1.i386.rpm

warning : python-element tree-1.2.6-4.2.1.i386.rpm : v3 dsasignature 3360 nokey,key ID 443e1821

preparing . # # # # # # # # # # # # # # # # # # # # # # # # 100 %

1: python-element tree # # # # # # # # # # # # # # # # # [ 100 % ]

http://www.up look.cn/a=indexm=indexc=iframe URL=mailto:root @ localhost~] # rpm-ivhsqlite-3.3.3-1.2 .

warning : SQLite-3.3.3-1.2.i386.rpm : v3 dsasignature : nokey,key ID 443e1821

preparing . # # # # # # # # # # # # # # # # # # # # # # # # 100 %

1: SQLite # # # # # # # # # # # # # # # # # # # # # # # # 100 %

[ root @ localhost~] # rpm-ivhpython-SQLite-1.1.7-1.2.i386.rpm

warning : python-SQLite-1.1.7-1.2.i386.rpm : v3 dsasignature 3360 nokey,key ID 443e1821

preparing . # # # # # # # # # # # # # # # # # # # # # # # # 100 %

1: python-SQLite # # # # # # # # # # # # # # # # # # # # # # # [ 100 % ]

[ root @ localhost~] # rpm-ivhpython-urlgrabber-2.9.8-2。

noarch.rpm

warning:python-urlgrabber-2.9.8-2.noarch.rpm: V3 DSAsignature: NOKEY, key ID 443e1821

Preparing...               ########################################### [100%]

  1:python-urlgrabber     ########################################### [100%]

http://www.uplook.cn/?a=index&m=index&c=iframe&url=mailto%3Aroot%40localhost ~]#rpm -ivh centos-yumconf-4-4.5.noarch.rpm

warning:centos-yumconf-4-4.5.noarch.rpm: V3 DSA signature: NOKEY, key ID 443e1821

Preparing...               ########################################### [100%]

  1:centos-yumconf        ########################################### [100%]

[root@localhost~]# rpm -ivh yum-2.4.3-1.c4.noarch.rpm

warning:yum-2.4.3-1.c4.noarch.rpm: V3 DSA signature:NOKEY, key ID 443e1821

Preparing...               ########################################### [100%]

  1:yum                   ########################################### [100%]

(2)yum的配置

yum工具安装完毕,接下来的工作是进行yum的配置,yum的配置文件有主配置文件/etc/yum.conf、资源库配置目录/etc/yum.repos.d,yum安装后,默认的一些资源库配置可能无法使用,因此需要进行修改,下面是/etc/yum.repos.d/CentOS-Base.repo资源库配置文件各项的详细含义:

[root@localhost~]#/etc/yum.repos.d/CentOS-Base.repo

[base]

name=CentOS-4- Base

#name就是发行版的名称,其格式表示“操作系统名和释出版本”,“base”是表明此段寻找的是base包信息。

baseurl=http://mirror.centos.org/centos/4/os/$basearch/ 

#baseurl”表示yum在互联网上查找升级文件的URL地址。其中“$basearch”代表了系统的硬件构架如“i386”、“x86-64等,同时,yum在资源更新时,会检查baseurl/repodata/repomd.xml文件。 “repomd.xml”是一个索引文件,它的作用是提供了更新rpm包文件的下载信息和SHA校验值。“repomd.xml”包括了3个文件,分别为“other.xml.gz”、”filelists.xml.gz”和”primary.xml.gz”,表示的含义依次是“其它更新包列表”、“更新文件集中列表”和“主要更新包列表”。

gpgcheck=1 

#gpgcheck表示是否启用gpg检查,1表示启用,0表示不启用校验,如果启用,就是需要在配置文件里注明GPG-RPM-KEY的位置,可以看到下面gpgkey字段,指定了GPG-RPM-KEY验证文件的位置。

#releasedupdates

[update]

#本段是updates更新模块要用到的部分配置。

name=CentOS-4- Updates

baseurl=http://mirror.centos.org/centos/4/updates/$basearch/

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

#gpgkey指定GPG密钥的地址

 

#packagesused/produced in the build but not released

#本段指定的是尚未发布的软件包部分(addons)配置

[addons]

name=CentOS-4- Addons

baseurl=http://mirror.centos.org/centos/4/addons/$basearch/

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

#additionalpackages that may be useful

#本段指定的是有用的额外软件包部分(extras)配置

[extras]

name=CentOS-4- Extras

baseurl=http://mirror.centos.org/centos/4/extras/$basearch/

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

#additionalpackages that extend functionality of existing packages

#本段指定的是扩展的额外软件包部分(centosplus)配置

[centosplus]

name=CentOS-4- Plus

baseurl=http://mirror.centos.org/centos/4/centosplus/$basearch/

gpgcheck=1

enabled=0

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

#contrib- packages by Centos Users

#这里是contrib部分

[contrib]

name=CentOS-4- Contrib

baseurl=http://mirror.centos.org/centos/4/contrib/$basearch/

gpgcheck=1

enabled=0

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

 

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。