LNMP一键安装包是微魔常用的一键安装包,在CentOS和Debian/Ubuntu下安装都十分顺利,只是最近在RedHat Enterprise Linux Server(RHEL)下安装却出了一些问题,主要原因是RHEL的yum需要商业授权,使用LNMP一键安装包安装时,会出现以下错误:
[root@vpser ~]# yum install libjpeg libjpeg-devel Loaded plugins: rhnplugin, security This system is not registered with RHN. RHN support will be disabled. Setting up Install Process No package libjpeg-devel available. Nothing to do
解决方法:
原理:用CentOS的免费yum替代RHEL的商业yum
1.卸载yum
rpm -qa|grep yum|xargs rpm -e --nodeps
2.确认你的RHEL的版本,如RHEL 5.4 64bit
cat /etc/issue && uname -a
本文均以RHEL 5.4 64bit系统为例,下文的5,x86_64对应5.x 64位;若你的系统为6.x 32bit,请到http://mirrors.kernel.org/centos/相关目录查询并替代
3.安装CentOS的yum
wget http://mirrors.kernel.org/centos/5/os/x86_64/CentOS/yum-3.2.22-39.el5.centos.noarch.rpm wget http://mirrors.kernel.org/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm wget http://mirrors.kernel.org/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm rpm -ivh yum-*
4.设置yum的库(如果此命令出错或无效,请将$releasever替换成5或6;$basearch替换成i386或x86_64,依据系统的实际情况而定)
cat >/etc/yum.repos.d/CentOS-Base.repo<<eof [base] name=CentOS-$releasever - Base baseurl=http://mirrors.kernel.org/centos/$releasever/os/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #released updates [updates] name=CentOS-$releasever - Updates baseurl=http://mirrors.kernel.org/centos/$releasever/updates/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #packages used/produced in the build but not released [addons] name=CentOS-$releasever - Addons baseurl=http://mirrors.kernel.org/centos/$releasever/addons/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras baseurl=http://mirrors.kernel.org/centos/$releasever/extras/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus baseurl=http://mirrors.kernel.org/centos/$releasever/centosplus/$basearch/ #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-5 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib baseurl=http://mirrors.kernel.org/centos/$releasever/contrib/$basearch/ #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-5 eof
5.最后,执行以下命令进行测试:
yum makecache
本文技术内容来源于军哥Licess的原帖(点击查看),根据自身实践,添加部分注解,感谢原作者的不断付出!