Score:0

Install nginx-1.20.2 on Ubuntu 20.04

ru flag

I am using Ubuntu 20.04 and i have installed nginx using sudo apt update sudo apt install nginx

But after installation when i do nginx -V to check version it always shows 1.18 version instead of latest version.

How i can install latest stable version of nginx on ubuntu 20.04?

Score:4
in flag

If you want to install version 1.20.2 specifically, you will need to add the official nginx repository to your Sources list.

Here is how you do it:

  1. Open Terminal (or connect via SSH)
  2. Ensure you have all of the prerequisites installed:
    sudo apt install curl gnupg2 ca-certificates lsb-release ubuntu-keyring
    
  3. Import the nginx signing key for apt:
    curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor \
         | sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
    
  4. Create a sources .list file for apt:
    echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \
         http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" \
         | sudo tee /etc/apt/sources.list.d/nginx.list
    
  5. Pin the repository to ensure the nginx packages are installed instead of the Ubuntu-provided packages:
    echo -e "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" \
         | sudo tee /etc/apt/preferences.d/99-nginx
    
  6. Update apt:
    sudo apt update
    
  7. Install nginx:
    sudo apt install nginx
    
shashank verma avatar
ru flag
Working Perfect. Thanks
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.