Now it doesn't matter what package that we're looking at here,
we're looking at the port scanner, Nmap. And when
we take a look at the versions,
when we're working with our current version of Ubuntu 20.04, the version
of Nmap that comes with the repository is version 7.80.
When we go through and take a look at what's available
currently from the Nmap repositories, we're able to get
the source code, which is 7.92.
Working with the source code is going to give you a couple advantages.
One of those advantages is that you are going to get the latest version.
The second is you might be able to customize the way the code is compiled.
We can take a look at installing software from source now. As we go through,
we will put onto our Ubuntu system some of the basic software that we
need to be able to work with software and compile it.
So you can see that we're installing git wget build‑essential and a
few other packages you see from the list. With Git installed, we're
able then to copy from the Git repository of Nmap, and this will
then download our source code.
We can move into the directory that will be created.
A directory will be created with the same name of the
Nmap repo that we've downloaded.
Moving into that Nmap directory, we run the ./configure script,
which will create our make file. We can then run make, which will
go through and compile the code, and then with administrative
privileges, we can run make install,
which puts the binaries in the correct locations.
We're then able to go through and check the version, and we
should see that we've got the latest version of Nmap
available from the GitHub repository.
Now with this, of course, we didn't have to write any code.
We're only compiling the code, but to get an idea of what that is involved,
we can go through and create our own C code file,
so a source file written in C.
Now the first line is not a comment. It's a preprocessor
command, and is to include a library file.
We can then go through and start our main function. Void just means
that in our instance, we're not returning any code. The brace brackets
hold the code, and all we're doing, yes,
you've guessed it,
printing Hello world! The \n is a new line at the end of
Hello World! We can then go through and close off our
brace brackets, and we're done.
We've created some source code. Now with the source code created,
we can use then the GCC compiler, and we'll see how to do this in the next demonstration where we're working on our Ubuntu 20.04 system.