Install NGINX on Ubuntu
In this tutorial, we will install NGINX on Ubuntu PC,
Steps to Install NGINX on Ubuntu
Following is a step by step guide to install NGINX on Ubuntu.
1. Get the Public Key
We have to get the public Key to verify signatures while installing.
Open a terminal and run the following command.
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $key
arjun@arjun-VPCEH26EN:~$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $key
[sudo] password for arjun:
Executing: /tmp/tmp.oIPmrXaOiq/gpg.1.sh --keyserver
keyserver.ubuntu.com
--recv-keys
Keep the terminal open, we have to run some more commands.
2. Update All Packages
Run the following command in terminal to update ubuntu package.
$ sudo apt-get update
arjun@arjun-VPCEH26EN:~$ sudo apt-get update
Get:1 file:/var/cuda-repo-8-0-local-ga2 InRelease
Ign:1 file:/var/cuda-repo-8-0-local-ga2 InRelease
Get:2 file:/var/cuda-repo-8-0-local-ga2 Release [574 B]
Get:2 file:/var/cuda-repo-8-0-local-ga2 Release [574 B]
Hit:4 http://in.archive.ubuntu.com/ubuntu xenial InRelease
Ign:5 http://ppa.launchpad.net/natecarlson/maven3/ubuntu xenial InRelease
Get:6 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:7 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Hit:8 http://archive.canonical.com/ubuntu xenial InRelease
3. Install NGINX
Run the following command in terminal to install NGINX in your Ubuntu PC.
$ sudo apt-get install nginx
arjun@arjun-VPCEH26EN:~$ sudo apt-get install nginx
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
nginx-common nginx-core
Suggested packages:
fcgiwrap nginx-doc
The following NEW packages will be installed:
nginx nginx-common nginx-core
0 upgraded, 3 newly installed, 0 to remove and 28 not upgraded.
Need to get 458 kB of archives.
After this operation, 1,482 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu xenial-updates/main amd64 nginx-common all 1.10.3-0ubuntu0.16.04.2 [26.6 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu xenial-updates/main amd64 nginx-core amd64 1.10.3-0ubuntu0.16.04.2 [428 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu xenial-updates/main amd64 nginx all 1.10.3-0ubuntu0.16.04.2 [3,490 B]
Fetched 458 kB in 1s (351 kB/s)
Preconfiguring packages ...
Selecting previously unselected package nginx-common.
(Reading database ... 1243835 files and directories currently installed.)
Preparing to unpack .../nginx-common_1.10.3-0ubuntu0.16.04.2_all.deb ...
Unpacking nginx-common (1.10.3-0ubuntu0.16.04.2) ...
Selecting previously unselected package nginx-core.
Preparing to unpack .../nginx-core_1.10.3-0ubuntu0.16.04.2_amd64.deb ...
Unpacking nginx-core (1.10.3-0ubuntu0.16.04.2) ...
Selecting previously unselected package nginx.
Preparing to unpack .../nginx_1.10.3-0ubuntu0.16.04.2_all.deb ...
Unpacking nginx (1.10.3-0ubuntu0.16.04.2) ...
Processing triggers for ureadahead (0.100.0-19) ...
ureadahead will be reprofiled on next reboot
Processing triggers for ufw (0.35-0ubuntu2) ...
Processing triggers for systemd (229-4ubuntu19) ...
Setting up nginx-common (1.10.3-0ubuntu0.16.04.2) ...
Setting up nginx-core (1.10.3-0ubuntu0.16.04.2) ...
Setting up nginx (1.10.3-0ubuntu0.16.04.2) ...
Processing triggers for systemd (229-4ubuntu19) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
NGINX is installed successfully.
4. Verify the installation of NGINX
Run the following command in terminal to display the version of NGINX.
$ sudo nginx -v
arjun@arjun-VPCEH26EN:~$ sudo nginx -v
nginx version: nginx/1.10.3 (Ubuntu)
Conclusion
In this NGINX Tutorial, we have successfully learnt to install NGINX on Ubuntu.