1
00:00:00,000 --> 00:00:14,759
Hey guys and welcome back.

2
00:00:14,759 --> 00:00:20,800
Okay so we have a lot of cool concepts to cover within this skill and one of the most

3
00:00:20,800 --> 00:00:26,800
important things I want to talk to you about is how we can install programs directly from

4
00:00:26,800 --> 00:00:27,800
source.

5
00:00:27,800 --> 00:00:33,600
Now in order to be able to do such a thing we have to understand some basic components

6
00:00:33,600 --> 00:00:34,960
and concepts.

7
00:00:34,960 --> 00:00:40,520
One of the first things I want to talk to you about is some basics around packaging

8
00:00:40,520 --> 00:00:46,640
because when we happen to choose to install from source well we're going to download a

9
00:00:46,640 --> 00:00:51,240
particular software package and this is going to be presented to us in a very particular

10
00:00:51,240 --> 00:00:56,799
way so we have to understand how we can operate this so that we can then begin using this

11
00:00:56,799 --> 00:01:00,359
package such that we can then build from source.

12
00:01:00,359 --> 00:01:05,319
So what we'll do right now is we'll talk about how we can actually begin to download

13
00:01:05,319 --> 00:01:10,439
particular source code and then we will discuss how that download will be presented to us

14
00:01:10,439 --> 00:01:13,280
in the form of particular compression types.

15
00:01:13,280 --> 00:01:19,719
Now when we want to be able to download particular source code we have different options available

16
00:01:19,719 --> 00:01:20,719
to us.

17
00:01:20,719 --> 00:01:25,640
Now typically what's going to happen with most distributions is that as we know those

18
00:01:25,640 --> 00:01:32,239
distros are going to have some type of package manager so on Red Hat this could be Yum on

19
00:01:32,239 --> 00:01:34,719
Debian based systems this could be apt.

20
00:01:34,719 --> 00:01:41,840
However we can actually download our source code directly from the developer who actually

21
00:01:41,840 --> 00:01:43,120
created this.

22
00:01:43,120 --> 00:01:48,760
This may be on something like say GitHub which is a popular website whereby people share

23
00:01:48,760 --> 00:01:53,599
code and upload their own code or it may be available to download from a developer's

24
00:01:53,599 --> 00:01:55,040
particular website.

25
00:01:55,040 --> 00:02:02,120
Now whether we happen to get this source code from a package manager or directly via a website

26
00:02:02,120 --> 00:02:07,800
or a GitHub page whatever it may be we want to be able to understand whereabouts should

27
00:02:07,800 --> 00:02:14,240
we store this source code on our system and the reality is we do have some particular

28
00:02:14,240 --> 00:02:19,280
locations on our system that is designed to do justice.

29
00:02:19,280 --> 00:02:21,080
So where are these locations?

30
00:02:21,080 --> 00:02:24,280
The first one I want to talk to you about is in the user.

31
00:02:24,280 --> 00:02:31,920
Fobr slash src directory this is src for source and what this is is this is the default

32
00:02:31,920 --> 00:02:35,800
location for storing our source files.

33
00:02:35,800 --> 00:02:40,400
Now one thing to really point out here is that this location here this is where we would

34
00:02:40,400 --> 00:02:46,240
like to store source code but this is not where we want to actually build the source

35
00:02:46,240 --> 00:02:49,400
code so really get that straight in your mind.

36
00:02:49,400 --> 00:02:55,360
User source we can download and keep the code here but when we go to build it this is not

37
00:02:55,360 --> 00:02:58,240
the location we want to be using ok.

38
00:02:58,240 --> 00:03:05,120
Now I will say here that the user source directory is the default and it is the preferred directory

39
00:03:05,120 --> 00:03:10,480
to store our source files but this is not mandatory you can in fact choose to store them

40
00:03:10,480 --> 00:03:11,879
elsewhere if you like.

41
00:03:11,879 --> 00:03:17,400
Now we actually also have other locations that we have to be aware of we also have the

42
00:03:17,400 --> 00:03:21,159
user forward slash local directory.

43
00:03:21,159 --> 00:03:27,640
Now this directory here this is going to be used by the system administrator ok and the

44
00:03:27,640 --> 00:03:34,360
system admin will use this particular location when the system admin wants to install software

45
00:03:34,360 --> 00:03:35,360
locally.

46
00:03:35,360 --> 00:03:42,280
Similarly within this directory we can also store our source code within user local and

47
00:03:42,280 --> 00:03:48,080
within again we have a directory called src within the local directory this can also

48
00:03:48,080 --> 00:03:50,360
be used for storing source code.

49
00:03:50,360 --> 00:03:56,719
Now another location we want to be aware of is the opt directory you may recall from the

50
00:03:56,719 --> 00:04:02,400
lpik one the type of contents we would store within this directory in this case here what

51
00:04:02,400 --> 00:04:08,759
we are going to do is install optional add on applications so really these are the main

52
00:04:08,759 --> 00:04:15,639
locations we want to be thinking about the opt directory the user local directory as

53
00:04:15,639 --> 00:04:23,000
well as user local src and the user forward slash src directory.

54
00:04:23,000 --> 00:04:27,879
Now once we actually have downloaded and are storing our source files what we would want

55
00:04:27,879 --> 00:04:32,240
to do is we want to be able to unpack the source code.

56
00:04:32,240 --> 00:04:38,680
Now the reality is you may happen to download the source code over multiple files but this

57
00:04:38,680 --> 00:04:45,800
really is not the norm instead you are very much likely to see one single file that is

58
00:04:45,800 --> 00:04:52,759
in the form of a tape archive using the tar command and that tape archive will very likely

59
00:04:52,759 --> 00:04:58,240
also be compressed this is the kind of standard way that you can expect to receive this source

60
00:04:58,240 --> 00:05:04,040
code so as it transpires it does make sense for us just to quickly refresh the types of

61
00:05:04,040 --> 00:05:10,280
compression that we are going to see here as well as how we can use the tar option so

62
00:05:10,280 --> 00:05:17,160
really the very first compression type is a very common one this is the gzip compression

63
00:05:17,160 --> 00:05:21,640
so much of the source code that you download is going to be using this compression.

64
00:05:21,640 --> 00:05:28,040
Now one thing to note here that may not be apparent is that gzip can actually only compress

65
00:05:28,040 --> 00:05:34,000
a single file so you can't actually compress multiple files with gzip the caveat here though

66
00:05:34,439 --> 00:05:40,360
is that you can combine files into what we just said a tape archive using the tar command

67
00:05:40,360 --> 00:05:45,319
which ultimately glues them all together like they are one file and then we can use gzip to

68
00:05:45,319 --> 00:05:51,439
compress that tar ball this is what I mean when I say this type of software or this type of source

69
00:05:51,439 --> 00:05:56,639
code should I say will be presented using a combination of tar and a combination of a

70
00:05:56,639 --> 00:06:03,600
particular compression now you'll be able to tell when a file is using the gzip compression

71
00:06:03,600 --> 00:06:08,000
because the file should actually follow a convention it should actually be named

72
00:06:08,000 --> 00:06:16,879
an ending with dot gz or alternatively it might just end in dot z if you see a file with these

73
00:06:16,879 --> 00:06:22,640
types of extensions you should be thinking about gzip compression now the caveat to that is that

74
00:06:22,640 --> 00:06:29,360
if the file indeed or the files have been smushed together using tar in the form of an archive

75
00:06:29,360 --> 00:06:38,400
and that archive was then ran through gzip then the extension you should expect to see is tgz a

76
00:06:38,400 --> 00:06:45,360
tar ball that has been compressed with gzip now you may recall if we happen to receive a file that

77
00:06:45,360 --> 00:06:52,480
has say for example the gz extension the way we can decompress this file is we can actually use a

78
00:06:52,480 --> 00:06:58,960
tool called gunzip so if we happen to be downloading source code and we have this particular information

79
00:06:58,959 --> 00:07:05,120
and we have this particular extension with the download we know we can use gunzip to decompress

80
00:07:05,120 --> 00:07:11,439
that data so that we can then begin building from that source code now of course we also have other

81
00:07:11,439 --> 00:07:18,560
forms of compression another very popular one is bzip 2 the deal with bzip 2 is that it should end

82
00:07:18,560 --> 00:07:27,120
with the extension bz 2 or alternatively it might just end in bz any of these extensions should

83
00:07:27,120 --> 00:07:33,519
indicate to you that the file or files have been indeed compressed with bzip 2 similarly if we

84
00:07:33,519 --> 00:07:41,280
happen to see the extension tbz 2 this should tell you that you're dealing with a group of files or

85
00:07:41,280 --> 00:07:47,040
directories that have been like i say smushed together using tar to form an archive and that

86
00:07:47,040 --> 00:07:53,360
archive has indeed been compressed with bz 2 compression similarly you may also just see the

87
00:07:53,360 --> 00:08:01,840
extension tbz same type of deal we are dealing with a taped archive that has been compressed using bz

88
00:08:01,840 --> 00:08:08,639
2 now if we happen to run in to a particular source code file with this extension and we have to

89
00:08:08,639 --> 00:08:15,680
unzip it the way we can do so is by using the bunzip 2 command this utility will allow us to

90
00:08:15,759 --> 00:08:24,560
ultimately decompress those compressed files now we also have the xz compression this is a very

91
00:08:24,560 --> 00:08:30,319
popular and more common general compression tool and if we happen to see a particular source code

92
00:08:30,319 --> 00:08:36,960
file that ends in xz you know or you can infer should i say that this file has been compressed

93
00:08:36,960 --> 00:08:43,519
with xz based compression and similarly if you download some type of source code and it ends

94
00:08:43,519 --> 00:08:50,240
in the extension txz you can probably guess where i'm going here this is a archive file using the tar

95
00:08:50,240 --> 00:08:56,559
command and that taped archive has indeed been compressed with xz compression so the question

96
00:08:56,559 --> 00:09:04,079
is how do we undo or decompress this particular compression we can use the command on xz and

97
00:09:04,079 --> 00:09:08,720
like i say if you're unsure about how to use the particular options with these commands

98
00:09:08,720 --> 00:09:14,160
then you can go in to the man pages say for example man gzip we can see here this is going to

99
00:09:14,160 --> 00:09:20,080
allow us to compress or expand files we get the general description around the command

100
00:09:20,080 --> 00:09:25,040
so if we scroll on down we can see the different options we can use dash f to force the compression

101
00:09:25,040 --> 00:09:30,560
or decompression we can suppress all warnings so on so forth and if we scroll on down you can

102
00:09:30,560 --> 00:09:38,000
actually see some examples of using gzip or gunzip and similar is true with respect to bzip

103
00:09:38,000 --> 00:09:43,519
we can do man bzip too same type of deal we can get all the information we need to use these tools

104
00:09:43,519 --> 00:09:49,039
if we happen to spot a particular extension with respect to our source codes and lastly we can do

105
00:09:49,039 --> 00:09:55,919
man xz same type of deal we can see how we can compress and decompress using this particular

106
00:09:55,919 --> 00:10:00,960
tool so really just understand how to spot these particular extensions when we download

107
00:10:00,960 --> 00:10:06,720
particular source code files understand which ones we use in which scenario and again if we

108
00:10:06,720 --> 00:10:12,240
could use the tar command so we can say man tar and if we scroll on down we can see the different

109
00:10:12,240 --> 00:10:18,960
options available to us say for example if we do dash lowercase j this is going to allow us to run

110
00:10:18,960 --> 00:10:26,960
the tape archive through the bzip to compression so we would want to use the t bz to extension

111
00:10:27,519 --> 00:10:33,360
in this case here or as we can see here we could do dash capital j and we could give the extension

112
00:10:33,440 --> 00:10:40,000
t xz because it would be a typed archive using xz compression and notice we also have these

113
00:10:40,000 --> 00:10:44,720
additional options we can actually do dash dash bzip too which might be easier to remember

114
00:10:44,720 --> 00:10:52,000
or dash dash xz a little bit more explicit than using dash uppercase j or dash lowercase j

115
00:10:52,000 --> 00:10:58,399
similar deal with respect to gzip compression we also have options for that too so these are

116
00:10:58,399 --> 00:11:04,079
just some of the bare bones basics around package management with respect to our source code so once

117
00:11:04,079 --> 00:11:10,000
we have these package files downloaded on our machine what we now want to do is to understand

118
00:11:10,000 --> 00:11:17,039
the process whereby we can take these particular files and eventually end up with the fully

119
00:11:17,039 --> 00:11:22,799
functioning and working program how do we go through the steps of building and compiling this

120
00:11:22,799 --> 00:11:28,319
information this source code to do just that well how about we talk about those steps in the very

121
00:11:28,320 --> 00:11:36,080
next nuggets i hope this has been informative for you and i'd like to thank you for viewing

