Hey guys and welcome back.
Okay so we have a lot of cool concepts to cover within this skill and one of the most
important things I want to talk to you about is how we can install programs directly from
source.
Now in order to be able to do such a thing we have to understand some basic components
and concepts.
One of the first things I want to talk to you about is some basics around packaging
because when we happen to choose to install from source well we're going to download a
particular software package and this is going to be presented to us in a very particular
way so we have to understand how we can operate this so that we can then begin using this
package such that we can then build from source.
So what we'll do right now is we'll talk about how we can actually begin to download
particular source code and then we will discuss how that download will be presented to us
in the form of particular compression types.
Now when we want to be able to download particular source code we have different options available
to us.
Now typically what's going to happen with most distributions is that as we know those
distros are going to have some type of package manager so on Red Hat this could be Yum on
Debian based systems this could be apt.
However we can actually download our source code directly from the developer who actually
created this.
This may be on something like say GitHub which is a popular website whereby people share
code and upload their own code or it may be available to download from a developer's
particular website.
Now whether we happen to get this source code from a package manager or directly via a website
or a GitHub page whatever it may be we want to be able to understand whereabouts should
we store this source code on our system and the reality is we do have some particular
locations on our system that is designed to do justice.
So where are these locations?
The first one I want to talk to you about is in the user.
Fobr slash src directory this is src for source and what this is is this is the default
location for storing our source files.
Now one thing to really point out here is that this location here this is where we would
like to store source code but this is not where we want to actually build the source
code so really get that straight in your mind.
User source we can download and keep the code here but when we go to build it this is not
the location we want to be using ok.
Now I will say here that the user source directory is the default and it is the preferred directory
to store our source files but this is not mandatory you can in fact choose to store them
elsewhere if you like.
Now we actually also have other locations that we have to be aware of we also have the
user forward slash local directory.
Now this directory here this is going to be used by the system administrator ok and the
system admin will use this particular location when the system admin wants to install software
locally.
Similarly within this directory we can also store our source code within user local and
within again we have a directory called src within the local directory this can also
be used for storing source code.
Now another location we want to be aware of is the opt directory you may recall from the
lpik one the type of contents we would store within this directory in this case here what
we are going to do is install optional add on applications so really these are the main
locations we want to be thinking about the opt directory the user local directory as
well as user local src and the user forward slash src directory.
Now once we actually have downloaded and are storing our source files what we would want
to do is we want to be able to unpack the source code.
Now the reality is you may happen to download the source code over multiple files but this
really is not the norm instead you are very much likely to see one single file that is
in the form of a tape archive using the tar command and that tape archive will very likely
also be compressed this is the kind of standard way that you can expect to receive this source
code so as it transpires it does make sense for us just to quickly refresh the types of
compression that we are going to see here as well as how we can use the tar option so
really the very first compression type is a very common one this is the gzip compression
so much of the source code that you download is going to be using this compression.
Now one thing to note here that may not be apparent is that gzip can actually only compress
a single file so you can't actually compress multiple files with gzip the caveat here though
is that you can combine files into what we just said a tape archive using the tar command
which ultimately glues them all together like they are one file and then we can use gzip to
compress that tar ball this is what I mean when I say this type of software or this type of source
code should I say will be presented using a combination of tar and a combination of a
particular compression now you'll be able to tell when a file is using the gzip compression
because the file should actually follow a convention it should actually be named
an ending with dot gz or alternatively it might just end in dot z if you see a file with these
types of extensions you should be thinking about gzip compression now the caveat to that is that
if the file indeed or the files have been smushed together using tar in the form of an archive
and that archive was then ran through gzip then the extension you should expect to see is tgz a
tar ball that has been compressed with gzip now you may recall if we happen to receive a file that
has say for example the gz extension the way we can decompress this file is we can actually use a
tool called gunzip so if we happen to be downloading source code and we have this particular information
and we have this particular extension with the download we know we can use gunzip to decompress
that data so that we can then begin building from that source code now of course we also have other
forms of compression another very popular one is bzip 2 the deal with bzip 2 is that it should end
with the extension bz 2 or alternatively it might just end in bz any of these extensions should
indicate to you that the file or files have been indeed compressed with bzip 2 similarly if we
happen to see the extension tbz 2 this should tell you that you're dealing with a group of files or
directories that have been like i say smushed together using tar to form an archive and that
archive has indeed been compressed with bz 2 compression similarly you may also just see the
extension tbz same type of deal we are dealing with a taped archive that has been compressed using bz
2 now if we happen to run in to a particular source code file with this extension and we have to
unzip it the way we can do so is by using the bunzip 2 command this utility will allow us to
ultimately decompress those compressed files now we also have the xz compression this is a very
popular and more common general compression tool and if we happen to see a particular source code
file that ends in xz you know or you can infer should i say that this file has been compressed
with xz based compression and similarly if you download some type of source code and it ends
in the extension txz you can probably guess where i'm going here this is a archive file using the tar
command and that taped archive has indeed been compressed with xz compression so the question
is how do we undo or decompress this particular compression we can use the command on xz and
like i say if you're unsure about how to use the particular options with these commands
then you can go in to the man pages say for example man gzip we can see here this is going to
allow us to compress or expand files we get the general description around the command
so if we scroll on down we can see the different options we can use dash f to force the compression
or decompression we can suppress all warnings so on so forth and if we scroll on down you can
actually see some examples of using gzip or gunzip and similar is true with respect to bzip
we can do man bzip too same type of deal we can get all the information we need to use these tools
if we happen to spot a particular extension with respect to our source codes and lastly we can do
man xz same type of deal we can see how we can compress and decompress using this particular
tool so really just understand how to spot these particular extensions when we download
particular source code files understand which ones we use in which scenario and again if we
could use the tar command so we can say man tar and if we scroll on down we can see the different
options available to us say for example if we do dash lowercase j this is going to allow us to run
the tape archive through the bzip to compression so we would want to use the t bz to extension
in this case here or as we can see here we could do dash capital j and we could give the extension
t xz because it would be a typed archive using xz compression and notice we also have these
additional options we can actually do dash dash bzip too which might be easier to remember
or dash dash xz a little bit more explicit than using dash uppercase j or dash lowercase j
similar deal with respect to gzip compression we also have options for that too so these are
just some of the bare bones basics around package management with respect to our source code so once
we have these package files downloaded on our machine what we now want to do is to understand
the process whereby we can take these particular files and eventually end up with the fully
functioning and working program how do we go through the steps of building and compiling this
information this source code to do just that well how about we talk about those steps in the very
next nuggets i hope this has been informative for you and i'd like to thank you for viewing