[转]CentOS中yum安装非标准库中的包(Nginx)
#yum install nginx
?
补充:
如果遇到以下错误提示:
?
[root@localhost ~]# yum -y install nginxLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile * addons: centos.ustc.edu.cn * base: centos.ustc.edu.cn * extras: centos.ustc.edu.cn * updates: data.nicehosting.co.krSetting up Install ProcessNo package nginx available.Nothing to do
?
原因是:
对CentOS系统而言,Nginx不在标准库里,不过可以使用EPEL库,EPEL参考资料(http://www.cyberciti.biz/faq/rhel-fedora-centos-linux-enable-epel-repo/)。 使用EPEL库安装Nginx,命令如下:
?# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
?
检查一下 yum list:
#yum repolist
?
[root@localhost ~]# yum repolistLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile * addons: centos.ustc.edu.cn * base: centos.ustc.edu.cn * extras: centos.ustc.edu.cn * updates: data.nicehosting.co.krrepo id repo name statusaddons CentOS-5 - Addons enabled: 0base CentOS-5 - Base enabled: 3,434extras CentOS-5 - Extras enabled: 303updates CentOS-5 - Updates enabled: 919repolist: 4,656
?
如果没有 EPEL, 运行:
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
版本号需要调整, 如果找不到。
?
[root@localhost ~]# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpmRetrieving http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpmerror: skipping http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm - transfer failed - Unknown or unexpected error[root@localhost ~]# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpmRetrieving http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpmwarning: /var/tmp/rpm-xfer.2DN7ju: Header V3 DSA signature: NOKEY, key ID 217521f6Preparing... ########################################### [100%] 1:epel-release ########################################### [100%]?
?
再检查一下 yum list,
?
[root@localhost ~]# yum repolistLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile * addons: centos.ustc.edu.cn * base: centos.ustc.edu.cn * epel: ftp.sjtu.edu.cn * extras: centos.ustc.edu.cn * updates: data.nicehosting.co.krepel | 3.7 kB 00:00 epel/primary_db | 3.3 MB 00:15 repo id repo name statusaddons CentOS-5 - Addons enabled: 0base CentOS-5 - Base enabled: 3,434epel Extra Packages for Enterprise Linux 5 - x86_64 enabled: 5,832extras CentOS-5 - Extras enabled: 303updates CentOS-5 - Updates enabled: 919repolist: 10,488?
如果 EPEL 更新成功, 则运行:
#yum install nginx