如果机器上没有yum首先安装yum
-
下载新的yum包
-
64位linux系统下载安装包
-
wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm
-
wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
-
wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-4.el5.x86_64.rpm
-
32位linux系统下载安装包
-
wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm
-
wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
-
wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-4.el5.i386.rpm
centos6的源
http://tel.mirrors.163.com/centos/6/os/x86_64/Packages/
# rpm -ivh yum-3.2.29-30.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
注:这一步要两个一起安装,要不会会出现如下错误:
一.配置本地yum源
二:.配置网络yum源
-
1.配置epel源
-
-
1.如果你使用的是RHEL6.x,CentOS6.x,Scientific6.x等6.x的RHEL系linux的话,执行:
-
-
[root@test ~]# rpm -ivh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
-
-
2.如果你使用的是5.x系列的,执行:
-
-
[root@test ~]# rpm -ivh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
-
-
3.如果你使用的是4.x系列的,执行:
-
-
[root@test ~]# rpm -ivh http://download.fedoraproject.org/pub/epel/4/i386/epel-release-4-10.noarch.rpm
-
-
其实上面安装的那个包就是在你系统/etc/yum.repos.d/下释放了2个yum源的repo文件而已:
-
-
/etc/yum.repos.d/epel.repo 正式版,所有的软件都是稳定可以信赖的
-
/etc/yum.repos.d/epel-testing.repo 测试版
-
但是默认情况下,只有正式版是有效状态的,如果你想试试测试版的话,需要修改/etc/yum.repos.d/epel-testing.repo,把enabled=0改成enabled=1即可。
-
-
另外,如果你要使用yumdownloader来下载src.rpm包的话,需要把epel.repo里[epel-source]域下的enabled=0也改成enabled=1即可。
-
-
当然了,如果你暂时不想使用EPEL的yum源的话,把对应文件里的enabled=1改成enabled=0就行了,如果你完全不需要了,那就直接卸载掉:
-
-
[root@test ~]# rpm -e epel-release 删除epel源
-
[root@test ~]# yum repolist 查看epel源的具体信息
-
[root@test ~]# yum install -y htop 测试一下看可不可以
-
-
-
-
2.配置remi源
-
-
获取安装包
-
[root@test ~]# #wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
-
-
[root@test ~]# rpm -ivh remi-release-5.rpm
-
-
在 /etc/yum.repos.d/下释放了1个yum源的repo文件
-
[root@gc1.cuug.net: /etc/yum.repos.d]$ ls
CentOS-Base.repo epel.repo epel-testing.repo remi-release-5.rpm remi.repo yum.repo.old
-
-
当有多个repo源的时候我们可以指定yum源来安装软件
-
[root@gc1.cuug.net: /etc/yum.repos.d]$ yum --enablerepo=remi repolist
-
Loaded plugins: fastestmirror
-
Loading mirror speeds from cached hostfile
-
* epel: mirror01.idc.hinet.net
-
* remi: rpms.remirepo.net
-
repo id repo name status
-
addons CentOS-5 - Addons 0
-
base CentOS-5 - Base 2,791
-
epel Extra Packages for Enterprise Linux 5 - i386 5,461
-
extras CentOS-5 - Extras 272
-
remi Les RPM de remi pour Enterprise Linux 5 - i386 1,937
-
update CentOS-5 - Updates 418
-
repolist: 10,879
-
-
安装好后可以查看以下remi的php和mysql版本,都提供有5.5版,但php5.5由remi-test提供,生产环境请慎用:
-
yum --enablerepo=remi-test,remi list php mysql
-
remi-test和remi源默认是不开启的,需要通过--enablerepo参数指定,把/etc/yum.repos.d/remi.repo里对应的[remi]和[remi-test]块下的enabled=0改为enabled=1则为默认开启.
-
epel源则有fedora社区维护,里面有很多centos官方源没有的软件,比如非常实用的命令行界面任务管理器htop:
-
yum --enablerepo=epel -y install htop
-
可以省略--enablerepo=epel,因为epel默认是开启,而epel-testing是默认不开启的,要默认开启,修改同上.
3.配置其它yum源
-
-
1>centos的配置源
-
-
-
下载yum的配置源
-
wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo 下载到 /etc/yum.repos.d/ 目录下面
-
运行yum makecache生成缓存
-
-
或者使用手工的方法配置
-
-
-
-
2>其它常用yum源
-
网易(163)yum源是国内最好的yum源之一 ,无论是速度还是软件版本,都非常的不错,将yum源设置为163yum,可以提升软件包安装和更新的速度,同时避免一些常见软件版本无法找到。具体设置方法如下:
-
1,进入yum源配置目录
-
cd /etc/yum.repos.d
-
2,备份系统自带的yum源
-
mv CentOS-Base.repo CentOS-Base.repo.bk
-
下载163网易的yum源:
-
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
-
3,更新玩yum源后,执行下边命令更新yum配置,使操作立即生效
-
yum makecache
-
4,除了网易之外,国内还有其他不错的yum源,比如中科大和搜狐的,大家可以根据自己需求下载
-
中科大的yum源:
-
wget http://centos.ustc.edu.cn/CentOS-Base.repo
-
sohu的yum源
-
wget http://mirrors.sohu.com/help/CentOS-Base-sohu.repo
-
理论上讲,这些yum源redhat系统以及fedora也是可以用 的,但是没有经过测试,需要的站长可以自己测试一下
一般碰到需要安装包什么的需求时我一般都是这样做的:
本地yum源安装>epel/remi源安装>其它yum源安装
按这个步骤一般的安装包问题或者依赖关系基本都能解决~~~
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29096438/viewspace-1785734/
,如需转载,请注明出处,否则将追究法律责任。