avatar

Centos 7下安装nginx,使用yum install nginx,提示没有可用的软件包。

Centos 7下安装nginx,使用yum install nginx,提示没有可用的软件包。

1
2
3
4
5
6
7
8
# yum -y install nginx
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
没有可用软件包 nginx。
错误:无须任何处理

原因: nginx位于第三方的yum源里面,而不在centos官方yum源里面。

了解Nginx (engine x) 是一个高性能的HTTP反向代理web服务器,同时也提供了IMAP/POP3/SMTP服务

解决方案: 很多软件包在yum里面没有的,我们要使用epel源,也就是安装epel-release软件包。EPEL (Extra Packages for Enterprise Linux)是基于Fedora的一个项目,为“红帽系”的操作系统提供额外的软件包,适用于RHEL、CentOS等系统。

具体步骤

  1. 安装epel

    1
    sudo yum install epel-release
  2. 更新 (时间较长)

    1
    yum update
  3. 安装nginx

    1
    yum install -y nginx
  4. 安装成功:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    已安装:
    nginx.x86_64 1:1.12.2-3.el7

    作为依赖被安装:
    nginx-all-modules.noarch 1:1.12.2-3.el7
    nginx-filesystem.noarch 1:1.12.2-3.el7
    nginx-mod-http-geoip.x86_64 1:1.12.2-3.el7
    nginx-mod-http-image-filter.x86_64 1:1.12.2-3.el7
    nginx-mod-http-perl.x86_64 1:1.12.2-3.el7
    nginx-mod-http-xslt-filter.x86_64 1:1.12.2-3.el7
    nginx-mod-mail.x86_64 1:1.12.2-3.el7
    nginx-mod-stream.x86_64 1:1.12.2-3.el7

    完毕!

参考

文章作者: CodeHao
文章链接: http://codehao.top/cl1c6w8w10008jkla5n5ih3yk/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 CodeHao's Blog
打赏
  • 微信
    微信
  • 支付宝
    支付宝

评论
简体中文