转载

Linux 配置YUM

文章主要介绍配置yum源,虽然网上有很多方法,但是每个多多少少都有点问题,所以就把自己的配置过程写出来。

目录

  •   概述
  •   步骤
    •   下载安装包
    •   卸载自带的yum
    •   安装yum包
    •   添加yum
  •   总结

步骤

下载安装包

我当前的服务器版本的redhat6,所以下载的安装包也应该是对应linux6的安装包,这里配置的是163的yum源。

wget http://mirrors.163.com/centos/6/os/i386/Packages/yum-3.2.29-69.el6.centos.noarch.rpm wget http://mirrors.163.com/centos/6/os/i386/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm wget http://mirrors.163.com/centos/6/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.i686.rpm wget http://mirrors.163.com/centos/6/os/i386/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

卸载自带的yum

rpm -aq|grep yum|xargs rpm -e --nodeps

安装yum包

注意顺序

rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm   rpm -ivh yum-metadata-parser-1.1.2-16.el6.i686.rpm   --注意后面两个是一起安装 rpm -ivh yum-3.2.29-69.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm

Linux 配置YUM

添加yum

切换路径

cd /etc/yum.repos.d/

下载文件

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

编辑文件

vim CentOS6-Base-163.repo

内容如下

# CentOS-Base.repo # # 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-6 - Base - 163.com baseurl=http://mirrors.163.com/centos/6/os/i386/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6  #released updates  [updates] name=CentOS-6 - Updates - 163.com baseurl=http://mirrors.163.com/centos/6/updates/i386/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6  #additional packages that may be useful [extras] name=CentOS-6 - Extras - 163.com baseurl=http://mirrors.163.com/centos/6/extras/i386/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6  #additional packages that extend functionality of existing packages [centosplus] name=CentOS-6 - Plus - 163.com baseurl=http://mirrors.163.com/centos/6/centosplus/i386/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6  #contrib - packages by Centos Users [contrib] name=CentOS-6 - Contrib - 163.com baseurl=http://mirrors.163.com/centos/6/contrib/i386/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

测试是否安装成功

yum install perl-DBI

Linux 配置YUM

总结

安装方法不难,要注意的地方就是下载rpm包的时候要选对版本,还有后面配置repo的时候可能会遇到点麻烦,但都容易解决。

文章如果对大家有帮助,请帮忙推荐,谢谢!!!

备注:

作者: pursuer.chen

博客: http://www.cnblogs.com/chenmh

本站点所有随笔都是原创,欢迎大家转载;但转载时必须注明文章来源,且在文章开头明显处给明链接,否则保留追究责任的权利。

《欢迎交流讨论》

正文到此结束
Loading...