linux yum怎么安装 及过程

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux yum怎么安装 及过程相关的知识,希望对你有一定的参考价值。

参考技术A 第一种方法:(推荐)

第一步:新建一个文件夹,并把光盘内的所有文件复制到这个文件夹里:

[root@localhost ~]# mkdir /yum

[root@localhost ~]# cp -rvf /misc/cd/* /yum

第二步:备份repodata文件。因为有四个文件夹里都有这个文件,所以都要备份。

[root@localhost ~]# mv /yum/Server/repodata /yum/Server/repodata.bak

[root@localhost ~]# mv /yum/VT/repodata /yum/VT/repodata.bak

[root@localhost ~]# mv /yum/Cluster/repodata
/yum/Cluster/repodata.bak

[root@localhost ~]# mv /yum/ClusterStorage/repodata
/yum/ClusterStorage/repodata.bak

第三步:安装工具包:

[root@localhost ~]# rpm -ivh
/yum/Server/createrepo-0.4.11-3.el5.noarch.rpm

第四步:生成仓库数据库:

[root@localhost ~]# createrepo -g
/yum/Server/repodata.bak/comps-rhel5-server-core.xml /yum/Server/

[root@localhost ~]# createrepo -g /yum/VT/repodata.bak/comps-rhel5-vt.xml
/yum/VT/

[root@localhost ~]# createrepo -g /yum/Cluster/repodata.bak/
/yum/Cluster

[root@localhost ~]# createrepo -g
/yum/ClusterStorage/repodata.bak/comps-rhel5-cluster-st.xml
/yum/ClusterStorage/

第五步:查看仓库数据文件:

[root@localhost ~]# ls /yum/Server/repodata/

comps-rhel5-server-core.xml //这个文件软件包组的分类。

filelists.xml.gz other.xml.gz primary.xml.gz //这三个文件为软件包列表文件。

repomd.xml //这个文件为MD5校验信息。

在/yum/VT /yum/Cluster
/yum/ClusterStorage下面都有这几个文件,作用和这一样。如果想更新软件包,只需把下载完的软件包放在Server或者其他三个目录里,再使用第四步重新生成数据库文件即可。

第六步:客户端配置:主要修改下面红色的部分:

[root@localhost ~]# cp /etc/yum.repos.d/rhel-debuginfo.repo
/etc/yum.repos.d/chenbin.repo

[root@localhost ~]# vi /etc/yum.repos.d/chenbin.repo

[rhel-Server]

name=Red Hat Enterprise Linux $releasever - $basearch - Debug

baseurl=file:///yum/Server

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-VT]

name=Red Hat Enterprise Linux $releasever - $basearch - Debug

baseurl=file:///yum/VT

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-Cluster]

name=Red Hat Enterprise Linux $releasever - $basearch - Debug

baseurl=file:///yum/Cluster

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-ClusterStorage]

name=Red Hat Enterprise Linux $releasever - $basearch - Debug

baseurl=file:///yum/ClusterStorage

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

参考文章:http://www.jb51.net/LINUXjishu/32188.html

linux下yum安装及配置

  • 技术分享1
  • 技术分享2
  • 技术分享3
  • 技术分享4
分步阅读

公司使用的是linux搭建服务器,linux安装软件能够使用yum安装依赖包是一件非常简单而幸福的事情,所以这里简单介绍一下linux安装yum源流程和操作。

工具/原料

  • 电脑
  • linux基础操作知识

方法/步骤

  1. 1

    查看、卸载已安装的yum包

    查看已安装的yum包

    #rpm –qa|grep yum

    卸载软件包

    #rpm –e –nodeps yum

    技术分享
  2. 2

    下载安装依赖包python python-iniparse

    下载地址http://centos.ustc.edu.cn/centos/6.5/os/x86_64/Packages/

    http://mirrors.163.com/centos/6/os/x86_64/Packages/

    找到对应包如:python-2.6.6-51.el6.x86_64.rpm python-iniparse-0.3.1-2.1.el6.noarch.rpm

    源地址可以从网上找一些速度比较快的,自身测试这两个地址速度还不错。包的名字可能跟上面不同,主要是版本和操作系统位数的不同,建议不要在页面搜索全部,如第一个包只搜索python,第二个包搜索python-iniparse。

    技术分享
  3. 3

    安装

    #rpm –ivh python-2.6.6-51.el6.x86_64.rpm python-iniparse-0.3.1-2.1.el6.noarch.rpm

    下载安装yum包

    下载地址http://centos.ustc.edu.cn/centos/6.5/os/x86_64/Packages/

    http://mirrors.163.com/centos/6/os/x86_64/Packages/

    找 到对应包如:http://centos.ustc.edu.cn/centos/6.5/os/x86_64/Packages/ yum- plugin-fastestmirror-1.1.30-14.el6.noarch.rpm yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

    yum-3.2.29-40.el6.centos.noarch.rpm

    #rpm-ivh yum-*

    若安装失败可重新输入此命令并加参数--nodeps –force

    查找包的方法与步骤二相同,在此不做赘述。

  4. 4

    更改yum源

    下载配置文件

    http://mirrors.163.com/.help/CentOS6-Base-163.repo

    将此配置文件替换/etc/yum.repos.d同名文件

    编辑配置文件

    #cd /etc/yum.repos.d

    #vi CentOS-Base.repo

    技术分享
  5. 5

    将文件中$releasever改成对应版本(6/6.5)

    将源mirrorlist.centos.org改为使用的yum源

    centos.ustc.edu.cn

    mirrors.163.com

    保存配置文件即可

    技术分享
  6. 6

    清理yum缓存

    #yum clean all

    将服务器软件包信息缓存至本地,提高搜索安装效率

    #yum makecache

     

    若上面两条命令有报错,一般为配置文件更改不完全,可根据错误信息查找配置文件中更改错误

     

    测试

    #yum install vim

     

    完成

以上是关于linux yum怎么安装 及过程的主要内容,如果未能解决你的问题,请参考以下文章

linux yum怎么安装 及过程

CentOS安装过程及yum安装软件错误解决

Linux查看Yum的安装目录及包目录

中标麒麟Linux操作系统怎么安装软件

linux 怎么安装postgresql-9.2.1-1-linux

linux怎么配置yum