Nginx ---- Installing Prebuilt Ubuntu Packages

 

NGINX provides packages for the following Ubuntu operating systems:nginx

Version Codename Supported Platforms
12.04 precise x86_64, i386
14.04 trusty x86_64, i386, aarch64/arm64
16.04 xenial x86_64, i386, ppc64el, aarch64/arm64
16.10 yakkety x86_64, i386

The package can be installed from:ubuntu

  • A default Ubuntu repository. This is the quickest way, but generally the provided package is outdated. For example, Ubuntu 14.04 by default includes nginx 1.4.6, released in March 2014.
  • The official repo at nginx.org. You have to set up the apt-get repository the first time, but after that the provided package is always up to date.

Installing a Prebuilt Ubuntu Package from an Ubuntu Repository

  1. Update the Ubuntu repository information:curl

    $ sudo apt-get update
  2. Install the package:ide

    $ sudo apt-get install nginx
  3. Verify the installation:ui

    $ sudo nginx -v
    nginx version: nginx/1.4.6 (Ubuntu)

Installing a Prebuilt Ubuntu Package from the Official NGINX Repository

  1. Download the key used to sign NGINX packages and the repository, and add it to the apt program’s key ring:url

    $ sudo wget http://nginx.org/keys/nginx_signing.key
    $ sudo apt-key add nginx_signing.key
  2. Edit the /etc/apt/sources.list file, for example with vi:spa

    $ sudo vi /etc/apt/sources.list
  3. Add these lines sources.list to name the repositories from which the NGINX OSS source can be obtained:code

    deb http://nginx.org/packages/mainline/ubuntu/ <CODENAME> nginx
    deb-src http://nginx.org/packages/mainline/ubuntu/ <CODENAME> nginx

    where:orm

    • The /mainline element in the pathname points to the latest mainline version of NGINX OSS; delete it to get the latest stable version
    • <CODENAME> is the codename of an Ubuntu release

    For example, to get the latest mainline package for Ubuntu 14.04 (「trusty」), add:ci

    deb http://nginx.org/packages/mainline/ubuntu/ trusty nginx
    deb-src http://nginx.org/packages/mainline/ubuntu/ trusty nginx
  4. Save the changes and quit vi (press ESC and type wq at the : prompt).

  5. Install NGINX OSS:

    $ sudo apt-get remove nginx-common
    $ sudo apt-get update
    $ sudo apt-get install nginx
  6. Start NGINX OSS:

    $ sudo nginx
  7. Verify that NGINX OSS is up and running:

    $ curl -I 127.0.0.1
    HTTP/1.1 200 OK
    Server: nginx/1.13.8
相關文章
相關標籤/搜索