自定义YUM官方仓库安装NGINX、常用命令及启动、进程查看

本文详细介绍了如何从NGINX官方站点获取仓库地址,自定义YUM仓库,安装NGINX,并提供了NGINX的常用命令,包括启动、查看端口、进程以及通过浏览器访问等操作。
摘要由CSDN通过智能技术生成

NGINX 官方站点获取仓库地址

1、官方站点说明

Website:

http://nginx.org/en/linux_packages.html#RHEL-CentOS

Install the prerequisites:

sudo yum install yum-utils

To set up the yum repository, create the file named /etc/yum.repos.d/nginx.repo with the following contents:

[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key

By default, the repository for stable nginx packages is used. If you would like to use mainline nginx packages, run the following command:

sudo yum-config-manager --enable nginx-mainline

To install nginx, run the following command:

sudo yum install nginx

When prompted to accept the GPG key, verify that the fingerprint matches 573B FD6B 3D8F BC64 1079 A6AB ABF5 BD82 7BD9 BF62, and if so, accept it.

2、获取仓库地址

http://nginx.org/packages/centos/7/x86_64/

在这里插入图片描述

自定义 YUM 仓库

1、创建 repo 文件

[root@Tang-Neo ~]# vim /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repository
baseurl=http://nginx.org/packages/centos/7/x86_64/
gpgcheck=0

2、查看 repolist

[root@Tang-Neo ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.bit.edu.cn
 * extras: mirror.bit.edu.cn
 * updates: mirror.bit.edu.cn
nginx                                                                                                   | 2.9 kB  00:00:00     
nginx/primary_db                                                                                        |  49 kB  00:00:01     
repo id                                                    repo name                                                     status
base/7/x86_64                                              CentOS-7 - Base                                               10,019
extras/7/x86_64                                            CentOS-7 - Extras                                                435
nginx                                                      nginx repository                                                 166
updates/7/x86_64                                           CentOS-7 - Updates                                             2,500
repolist: 13,120

3、查看 nginx 信息

[root@Tang-Neo ~]# yum info nginx
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.bit.edu.cn
 * extras: mirror.bit.edu.cn
 * updates: mirror.bit.edu.cn
Available Packages
Name        : nginx
Arch        : x86_64
Epoch       : 1
Version     : 1.16.1
Release     : 1.el7.ngx
Size        : 766 k
Repo        : nginx
Summary     : High performance web server
URL         : http://nginx.org/
License     : 2-clause BSD-like license
Description : nginx [engine x] is an HTTP and reverse proxy server, as well as
            : a mail proxy server.

安装 NGINX

1、安装

[root@Tang-Neo ~]# yum install nginx -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.bit.edu.cn
 * extras: mirror.bit.edu.cn
 * updates: mirror.bit.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 1:1.16
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值