Heroine.
And welcome back.
So now that we have our server up and running, the next important and the exciting practical that we'll
be doing is the installation part of Nginx.
So let's get started.
So installing Nginx is very straightforward.
So there are multiple public repositories that are available and you can directly go ahead and install
nginx from them.
So let's assume that you have a specific repository and this repository has the nginx RPM that is available.
So all you need to do is you have to do a Yum install nginx and the Nginx will be installed within your
Linux server.
So this is the high level overview.
So let's quickly try it out.
So I'm connected to a demo server.
So the installation of Nginx is very simple.
All you need to do is you'll have to specify yum, install nginx and it is asking for confirmation.
So let's do a Y to confirm the installation process and that's about it.
So if you quickly want to verify if Nginx is up and running, you can specify systemctl status nginx.
So currently it is showing Nginx is inactive so you can manually start it so you can run systemctl start
nginx and let's quickly verify yet again.
And now you see our nginx is up and running now from the web browser.
Let's also verify if our default nginx page is loading, so I'll copy the public IP of the server and
let's press enter.
Now, if everything is working fine you should see the default nginx page to be up and running over
here.
Now, one important part to note here is that the rock Linux that we are using, it already has one
of the repositories available from which this nginx rpm is being fetched.
Now let me quickly show you.
So if you would have gone a bit up over here.
Here you see the Nginx package is coming from a repository called as Appstream over here.
Now as we are discussing, there are other repositories available as well.
So if you would quickly look into the official website, they have their own set of repositories.
So basically let me quickly show you.
So you have a CentOS repository and if you go a bit down, you also have a Debian Ubuntu repository
over here.
So let's explore the Nginx repository.
So you have version five, version six, version seven and version eight.
So these are basically the CentOS version.
And within here under the RPMs you see you have the RPMs related to the Nginx version.
So you can also if you would want a specific version of Nginx for your environment, you can also use
this specific approach.
Now, the easiest way to do that now let me also show you this.
So currently if I do a nginx hyphen v it shows me a specific version of Nginx.
In this case it is version one point 14.1.
However, if you would like the latest version that was released by Nginx, you can also explore the
Nginx repository which have been officially provided because this is where the latest version usually
comes first.
And from here you can also go ahead and fetch the link of the latest RPM.
Let's copy this up.
You can download that RPM within the server.
So let's do a wget.
Let me paste the RPM here.
So currently the wget command is not found, so let's also go ahead and install wget.
All right, let's download this RPM.
So if I do.
LS so this is the nginx RPM and you can also directly install from this specific nginx rpm.
Let me also show you this so that we have a better clarity here.
So first let's go ahead and remove the nginx that we have installed.
All right.
So we have removed the links and we'll be installing through this specific RPM file.
So I'll specify yum install this time.
You can specify the name of the RPM file here and this time the repository you see it is showing command
line.
I'll specify why and great our nginx is installed.
So if you specify systemctl status nginx it currently is showing inactive or dead.
So let's quickly start our nginx here and let's also do a systemctl enable nginx to ensure that the
nginx automatically starts if we restart the server.
And here if you do a nginx hyphen v you should see that this is a newer version of Nginx which is one
point 20.1.
So now let's also try and refresh this page here and you should see now we have a different default
Nginx page that is available.
So depending upon your choice you can use any one of the methods.
The simplest one, as we were discussing, is you directly run the Yum install nginx command to install
the nginx.
However, for production environments in your organization there is a requirement and there should be
a requirement that all of the servers should use the exact version of Nginx.
So you can download this specific RPM file, you can store it in your organization repository and whenever
you go ahead and do a Yum install, it will only use this specific version.
So multiple approaches depending upon the use cases from your side.
So that's the high level overview.
And with this, we'll conclude today's video.