----------------------------------------------------原文地址:http://www.phperz.com/article/14/1208/39965.html----------------------------------------------------
本文为大家讲解的是CentOS下yum安装mcrypt错误:No package php-mcrypt available.解决方法,感兴趣的同学参考下。
#yum install libmcrypt libmcrypt-devel mcrypt mhash
Setting up Install Process
No package php-mcrypt available.
Error: Nothing to do
我们会看到centos yum从仓库中根本找不到这几个包。但我不想使用源码编译就想使用yum安装,怎么办?
解决方法:
yum install epel-release //扩展包更新包
yum update //更新yum源
yum install libmcrypt libmcrypt-devel mcrypt mhash 就ok了
----------------------------------------------------原文地址:http://blog.sina.com.cn/s/blog_54a66a890101fayh.html----------------------------------------------------
一、需要安装yum-priorities插件:
yum install -y yum-priorities
插件作用主要是设置调用源时的优先级,一般将官方设置最高。
编辑CentOS-Base.repo
在每个[]段的最后加上priority=[]字段来设置每个镜像的优先级,1为最高,99为最低。
一般的配置为:[base],[updates],[extras]...priority=1
二、下载与安装相应的EPEL的rpm文件包
安装epel.repo ,找与自己系统版本相符的包
32位:
rpm -ivh http://mirrors.ustc.edu.cn/epel/6/i386/epel-release-6-8.noarch.rpm
这里,选择与系统一致的版本。
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
vi /etc/yum.repos.d/epel.repo
设置epel.repo中源的级别为priority=11
三、下载与安装相应rpmforge的rpm文件包
安装rpmforge.repo,下载地址为:http://pkgs.repoforge.org/rpmforge-release/ ,找与自己系统版本相符的包
32位:wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
wget http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
rpm --import RPM-GPG-KEY.dag.txt
或者rpm --import htt://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm -K rpmforge-release-0.5.2-2.el6.rf.i686.rpm 32位检查安装文件
rpm -ivh rpmforge-release-0.5.2-2.el6.rf.i686.rpm 32位安装程序
vi /etc/yum.repos.d/rpmforge.repo
设置rpmforge.repo文件中源的级别为priorit=12
四、下载与安装相应rpmfusion的rpm文件包
安装rpmfusion.repo,下载地址为http://download1.rpmfusion.org/
32位:
rpm -ivh http://download1.rpmfusion.org/free/el/updates/6/i386/rpmfusion-free-release-6-1.noarch.rpm
#rpm -ivh http://download1.rpmfusion.org/free/el/updates/6/i386/rpmfusion-nonfree-release-6-1.noarch.rpm
vi /etc/yum.repos.d/rpmfusion-free-updates.repo
vi /etc/yum.repos.d/rpmfusion-free-updates-testing.repo
#vi /etc/yum.repos.d/rpmfusion-nonfree-updates.repo
#vi /etc/yum.repos.d/rpmfusion-nonfree-updates-testing.repo
设置文件中源的级别为priority=13
五、安装atomic yum源
##############################################################
[atomic]
name = CentOS / Red Hat Enterprise Linux $releasever - atomicrocketturtle.com
mirrorlist = http://www.atomicorp.com/mirrorlist/atomic/centos-6-$basearch
#mirrorlist = http://www.atomicorp.com/channels/atomic/centos/6/mirrors-atomic
enabled = 1
priority = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY.art.txt
gpgcheck = 1
priority=14
六、更新yum软件包
----------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------给各种源添加Priority的方法-----------------------------------------------------
----------------------------------原文地址:http://www.cnblogs.com/ccdc/p/3728226.html -------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------
Yum Priorities
简介
Linux 发行版比较多,同时还有很多个人或组织维护了某些特定用途的安装/升级源。Yum Priorities 插件可以用来强制保护源。它通过给各个源设定不同的优先级,使得系统管理员可以将某些源(比如 Linux 发行版的官方源)设定为最高优先级,从而保证系统的稳定性(同时也可能无法更新到其它源上提供的软件最新版本)。[1]
安装
#安装 yum install yum-priorities #编辑配置文件 vim /etc/yum/pluginconf.d/priorities.conf
#priorities.conf #保证配置文件中enabled=1 启用,enable的=0 禁用 [main] enabled=1
配置yum源
#/etc/yum.repos.d/CentOS-Base.repo #为Base, Updates, Addons,Extras 添加 priority=1 #为其他源 CentOSPlus 源记录的后面 priority=2
PS:
priority=N (N为1到99的正整数,数值越小越优先),一般的配置是这样的:
[base], [addons], [updates], [extras] … priority=1
[CentOSplus],[contrib] … priority=2
其他第三的软件源为:priority=N (推荐N>10)
* 源记录(repository entry)是由 [ 和 ] 括起来的源名称。例如,Base 源记录就标记为 [base] 。
* 优先级由 1 ~ 99 的 99 个数表示,1 的优先级最高。优先级小的源即使有某软件的较新版本,如果优先级高的源中没有,在启用该插件的情况下,系统也无法安装/升级到该较新版本。图形界面的 YUM 工具一般默认就已经包含了优先级插件。[1]
参考:
[1] Haoxian Zeng.YUM 源优先级插件:Yum Priorities[EB/OL].(2012-01-29)[2014-05-14].http://cnzhx.net/blog/yum-priorities/
[2] yum-plugin-priorities[EB/OL].(2011-08-02)[2014-05-14].http://wiki.centos.org/PackageManagement/Yum/Priorities