How to upgrade to latest stable nginx on Ubuntu 18

19,220

I'm not sure where you are getting your instructions from but the first step you are failing at is not part of the official instructions posted at https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/#stable_vs_mainline

$ sudo wget https://nginx.org/keys/nginx_signing.key
$ sudo apt-key add nginx_signing.key
$ sudo vi /etc/apt/sources.list
    deb https://nginx.org/packages/mainline/ubuntu/ bionic nginx
    deb-src https://nginx.org/packages/mainline/ubuntu/ bionic nginx
$ sudo apt-get remove nginx-common
$ sudo apt-get update
$ sudo apt-get install nginx
Share:
19,220

Related videos on Youtube

Panos Zamanis
Author by

Panos Zamanis

Updated on September 18, 2022

Comments

  • Panos Zamanis
    Panos Zamanis over 1 year

    I have a linode server with virtualmin that hosts several of my domains. I am trying to find a guide on how to upgrade to latest stable nginx on Ubuntu 18 but the only article i found in medium said as a first step to Install the dependencies

    $ sudo apt-get install software-properties-common python-software-properties
    

    BUT a get a message

    $ sudo apt-get install software-properties-common python-software-properties
    sh: 1: $: not found
    $ apt-get install software-properties-common python-software-properties
    sh: 1: $: not found
    

    The rest of the guide sugest the following but i am not surewhat to do since the first step is not working

    Add the repository for the stable version of Nginx

    $ sudo add-apt-repository ppa:nginx/stable
    

    Now update it

    $ sudo apt-get update
    

    Run install

    $ sudo apt-get install nginx
    When it asks you if you want to keep using the old config or get the new config like this.
    Configuration file '/etc/nginx/nginx.conf'
     ==> Modified (by you or by a script) since installation.
     ==> Package distributor has shipped an updated version.
       What would you like to do about it ?  Your options are:
        Y or I  : install the package maintainer's version
        N or O  : keep your currently-installed version
          D     : show the differences between the versions
          Z     : start a shell to examine the situation
     The default action is to keep your current version.
    *** nginx.conf (Y/I/N/O/D/Z) [default=N] ?
    Select N(No). It will Install the new version of the current config files in /etc/nginx/sites-available directory.