首页 > 系统 > Linux > 正文

Linux配置YUM

2024-06-28 14:32:47
字体:
来源:转载
供稿:网友

标签:MySQL/linux

概述  

文章主要介绍配置163,mysql,epel这三个yum源。

目录

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

步骤

安装163源

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

 

wget http://mirrors.163.com/centos/6/os/i386/Packages/yum-3.2.29-69.el6.centos.noarch.rpmwget http://mirrors.163.com/centos/6/os/i386/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpmwget http://mirrors.163.com/centos/6/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.i686.rpmwget 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 

 

添加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.combaseurl=http://mirrors.163.com/centos/6/os/i386/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=osgpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#released updates [updates]name=CentOS-6 - Updates - 163.combaseurl=http://mirrors.163.com/centos/6/updates/i386/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updatesgpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#additional packages that may be useful[extras]name=CentOS-6 - Extras - 163.combaseurl=http://mirrors.163.com/centos/6/extras/i386/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extrasgpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#additional packages that extend functionality of existing packages[centosplus]name=CentOS-6 - Plus - 163.combaseurl=http://mirrors.163.com/centos/6/centosplus/i386/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplusgpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Users[contrib]name=CentOS-6 - Contrib - 163.combaseurl=http://mirrors.163.com/centos/6/contrib/i386/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contribgpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
导入key
rpm --import http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
 
清理yum缓存
yum clean all

测试是否安装成功

yum install perl-DBI

添加mysqlYUM

下载yum包

wget http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm

安装yum包

rpm -ivh mysql-community-release-el6-5.noarch.rpm

查看yum源文件

cd /etc/yum.repos.d/

 

安装epel源

下载epel安装文件

wget http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-6.noarch.rpm

32位:http://mirrors.ustc.edu.cn/fedora/epel/6/i386/epel-release-6-6.noarch.rpm

64位:http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm

安装

rpm -ivh epel-release-6-8.noarch.rpm 

查看是否安装成功

rpm -q epel-release

导入KEY

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

 

安装yum-PRiorities

查询是否安装了

rpm -q yum-plugin-priorities

安装

yum istall yum-priorities

yum源优先级的一个文件。
是yum-plugin-priroites这个插件的一个文件。
用来给yum源分优先级的。
比如你在centos下有centos,epel,rpmfusion三个yum源。
三个yum源中可能含有相同的软件,补丁之类的东西。
yum管理器为了分辨更新系统或者安装软件的时候用那个yum源的软件所以才有这么个东西。
如果说,设置centos官方的yum源优先级最高,epelyum源第二,rpmfusion第三。(用1到99来表示,1最高)
那在安装程序的时候,先寻找centos的yum源,如果源里面有要的程序,那就停止寻找,直接安装找到的,如果没有找到,就依次寻找epel和rpmfusion的源。
如果说三个yum源都含有同一个软件,那就安装优先级最高的yum源的。

总结

 epel源里面的软件是最全的,所以我一般将epel源设为优先源。

 

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

 

备注:

    作者:pursuer.chen

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

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

《欢迎交流讨论》

 

---恢复内容结束---


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表