How to Install The Latest Version of Nginx on Ubuntu Bionic
Nginx.org maintains a repository for Ubuntu. We can use this repository to install the latest version of Nginx.
First off, let's create a repository source file for Nginx with the following command.
Paste in the following two lines to the file:
1deb [arch=amd64] http://nginx.org/packages/mainline/ubuntu/ bionic nginx 2deb-src http://nginx.org/packages/mainline/ubuntu/ bionic nginx
In order to verify the integrity of packages downloaded from this repository, we need to import Nginx public key using the commands below.
1wget http://nginx.org/keys/nginx_signing.key 2apt-key add nginx_signing.key
You should see 'OK' so that we can move on.
Run the following command to update the repository info, remove the former version, finally install the latest version of nginx.
1apt update 2apt remove nginx nginx-common nginx-full nginx-core 3apt install nginx 4systemctl status nginx
Beautiful! Right? ;)
On CentOS 8:
1dnf -y upgrade 2dnf -y install https://nginx.org/packages/rhel/8/x86_64/RPMS/nginx-1.18.0-1.el8.ngx.x86_64.rpm 3systemctl enable --now nginx
Happy coding! 😎comments powered by Disqus