We saw how to install software from ubuntu's repositories,
but also from third party repositories.
Now, let's take a look at a third method of installing software
to get the absolute latest version of some application.
In some cases,
we'll simply have to download the code from
a place like github and compile it ourselves.
We'll have to convert it from human readable text code
to executable code that our computers can run efficiently.
So let's install git first.
Now you might notice
that it's already installed.
In fact, in most versions of
Ubuntu and Linux, it's already there.
Well, we're going to download the git repository for an application called HTOP.
And so we'll type in git
clone
and then the github
URL.
Now let's switch to the project's directory
and we'll take a look at the files in here
and will notice a readme file.
Every project has different compilation requirements, different libraries,
it needs different commands to run
to get some clues about what we need to do to get this to work.
We can look at the instructions in this file.
Now, I already read the instructions here. So here's what we need to do
first we install a library and some compilation tools.
Now, the library is included in the live
ncurses W five dash DEV package.
Now, since the name starts with LIB
and it ends with dash DEV,
it suggests that this is a package
containing a library used for development purposes.
Hops
code relies on this library to draw the application interface.
So that's why we need it here.
And the build essential package is almost always needed as it
pulls in most of the compilation tools that we require.
And if we take a look at the directory again,
we'll notice an executable file marked with a green color
Autogen dot sh. Now in the Readme file, we've been instructed to run this
to execute this shell script. We type a period sign to tell our bash shell.
We want to run a file from within this current directory.
So type in a period
and in a slash with the path to the file,
this will generate a configuration script.
And if we type
we can see it here.
So this file is simply called configure and it helps
us configure how we want to build this application.
For example, what features of the app we want to enable or disable plus other things.
And we can type in
not configure
help.
And this will give us a lot of the configuration options that we need.
If you want to configure it with the default options,
you simply run the script with no arguments.
Now, besides the configuration tasks,
this script also verifies if some compilation requirements are met by this system,
everything is in order. So we can continue to our next step,
we can use the make utility to compile and build our final application.
Now make also accepts additional arguments.
But what arguments it supports depends on the project we're compiling
and to see what arguments we can pass to make, we can use the familiar trick
we type in make
and then space and press tab two times
127 possibilities here.
And these are called Make targets.
Now, not everything we see here is a valid target though,
but for the ones that are valid, not only do they work here,
they'll be available in most of the other projects as well.
For example, the targets clean, this clean install and uninstall
clean can be useful when things are not going according to plan.
A scenario is when the compilation fails midway
through and we get some inconsistent results.
It's basically like a half built project to clean everything up and start again.
We'll enter a command like make clean and
then fix the problem and recompile our project
and we'll soon see what make install is used for as well.
Generally, if all we want to do is compile and build this app,
we just run make without any arguments.
So let's do that.
Now, if we take a look at this directory. Again, we'll see. The executable
hop has been compiled into a binary called HTOP. It's right here
and we can run it by typing dot slash
HTOP.
Great.
Now, let's press Q to quit the app.
Now,
the disadvantage here is that we need to type the relative or
full path to this utility every time we need to use it.
For example, if I was in another directory, I'd have to run home
Jeremy
H top
htop
to run this application
and that's inconvenient.
So we can instruct the make command to
install this application in a dedicated directory.
Now, we'll see that the binary HTOP file was moved to the user local bin directory.
So now every time we want to run this app, no matter where we are, we would type in
htop.
Let's test it out. I'll go to my home directory
and type in HTOP.
That's because by default, every user shell on an
Ubuntu system is configured to also look for applications
in the slash user slash local slash bin directory.
So we don't need to type in the full path to the utility anymore.
And this wraps up our current lesson. I'll see you in the next one.