1
00:00:00,090 --> 00:00:01,440
In this lesson, we're going to

2
00:00:01,440 --> 00:00:02,670
discuss package managers

3
00:00:02,670 --> 00:00:05,280
and their use in the Linux operating system.

4
00:00:05,280 --> 00:00:07,440
These days, one of the most important elements

5
00:00:07,440 --> 00:00:09,600
of a computer is its software.

6
00:00:09,600 --> 00:00:12,240
The Linux operating system is known for its diversity

7
00:00:12,240 --> 00:00:14,820
and adjustability because of all the different pieces

8
00:00:14,820 --> 00:00:16,860
of software that you can install.

9
00:00:16,860 --> 00:00:20,280
Nevertheless, installing new software might be frustrating

10
00:00:20,280 --> 00:00:22,080
in the beginning for new users.

11
00:00:22,080 --> 00:00:24,510
But soon, as a Linux user and administrator,

12
00:00:24,510 --> 00:00:26,910
you're going to realize the unlimited options that you have

13
00:00:26,910 --> 00:00:28,980
in your hands, by being able to understand how

14
00:00:28,980 --> 00:00:31,380
to install different pieces of software.

15
00:00:31,380 --> 00:00:32,430
One thing you should be aware

16
00:00:32,430 --> 00:00:35,880
of upfront is that Linux does have multiple different ways

17
00:00:35,880 --> 00:00:37,710
of installing pieces of software.

18
00:00:37,710 --> 00:00:40,170
And these are known as package managers.

19
00:00:40,170 --> 00:00:42,780
Now package management is really important in Linux

20
00:00:42,780 --> 00:00:45,870
because each distribution does it slightly differently.

21
00:00:45,870 --> 00:00:48,330
And knowing how to use these different package managers

22
00:00:48,330 --> 00:00:49,890
can be really, really important

23
00:00:49,890 --> 00:00:52,650
for you as a power user or system administrator

24
00:00:52,650 --> 00:00:54,000
because you're going to have to download

25
00:00:54,000 --> 00:00:55,290
and install all these different pieces

26
00:00:55,290 --> 00:00:57,960
of software from repositories, update them,

27
00:00:57,960 --> 00:00:59,310
handle their dependencies,

28
00:00:59,310 --> 00:01:01,350
and then later on, uninstall that software

29
00:01:01,350 --> 00:01:02,820
when you no longer need it.

30
00:01:02,820 --> 00:01:04,470
And all this is done different ways

31
00:01:04,470 --> 00:01:05,850
depending on what distribution

32
00:01:05,850 --> 00:01:08,760
and what package manager you're going to be using.

33
00:01:08,760 --> 00:01:11,640
So in order to become a true Linux geek,

34
00:01:11,640 --> 00:01:13,230
it's really important to understand how

35
00:01:13,230 --> 00:01:16,290
these major Linux distributions handle packages

36
00:01:16,290 --> 00:01:18,630
in order to install the necessary applications

37
00:01:18,630 --> 00:01:20,910
and keep them updated over time.

38
00:01:20,910 --> 00:01:23,940
Linux distributions really rely on two different methods

39
00:01:23,940 --> 00:01:26,670
of managing software throughout its lifecycle.

40
00:01:26,670 --> 00:01:29,580
Package managers and compiling software.

41
00:01:29,580 --> 00:01:32,580
Now package managers refer to programs that install,

42
00:01:32,580 --> 00:01:36,390
update, inventory and uninstall package software.

43
00:01:36,390 --> 00:01:38,490
This governs the entire software lifecycle

44
00:01:38,490 --> 00:01:40,320
for you and makes it much easier

45
00:01:40,320 --> 00:01:42,660
for you to control what software is being installed,

46
00:01:42,660 --> 00:01:44,490
how you can manage software versions,

47
00:01:44,490 --> 00:01:46,740
and then later on, uninstall that software

48
00:01:46,740 --> 00:01:48,390
when you no longer need it.

49
00:01:48,390 --> 00:01:51,510
Now, when you compile software manually from source code,

50
00:01:51,510 --> 00:01:53,940
this is actually much more difficult.

51
00:01:53,940 --> 00:01:56,130
Because of the open source nature of Linux,

52
00:01:56,130 --> 00:01:57,780
this means that you can download any piece

53
00:01:57,780 --> 00:01:59,130
of code off the internet,

54
00:01:59,130 --> 00:02:01,950
you can compile it and then run it on Linux.

55
00:02:01,950 --> 00:02:04,290
But this is much more difficult than simply using

56
00:02:04,290 --> 00:02:05,850
a package manager and installing

57
00:02:05,850 --> 00:02:08,160
a pre-packaged piece of software.

58
00:02:08,160 --> 00:02:11,070
Now, many Linux applications are considered modular

59
00:02:11,070 --> 00:02:13,320
and they depend on other pieces of software that

60
00:02:13,320 --> 00:02:16,410
are already present on your system in order for them to run.

61
00:02:16,410 --> 00:02:18,930
The great thing about using a package is that it's already

62
00:02:18,930 --> 00:02:21,750
going to list out the dependencies, the required components,

63
00:02:21,750 --> 00:02:24,720
without you having to figure out all those things yourself.

64
00:02:24,720 --> 00:02:27,000
The package manager is going to check those dependencies

65
00:02:27,000 --> 00:02:29,460
before it installs the software from the package.

66
00:02:29,460 --> 00:02:30,870
And if you're missing any of them,

67
00:02:30,870 --> 00:02:32,670
it's going to go grab those dependencies

68
00:02:32,670 --> 00:02:34,290
and install them first.

69
00:02:34,290 --> 00:02:36,480
On the other hand, if you're manually compiling

70
00:02:36,480 --> 00:02:38,550
the software yourself, you're going to have to go

71
00:02:38,550 --> 00:02:41,370
and work through all those dependencies on your own.

72
00:02:41,370 --> 00:02:42,720
On modern Linux systems,

73
00:02:42,720 --> 00:02:44,040
there are two dominant methods

74
00:02:44,040 --> 00:02:46,080
for managing software packages.

75
00:02:46,080 --> 00:02:48,390
The first method is known as RPM,

76
00:02:48,390 --> 00:02:50,490
or the Red Hat package manager.

77
00:02:50,490 --> 00:02:53,250
The second is known as dpkg,

78
00:02:53,250 --> 00:02:55,650
which is the Debian package system.

79
00:02:55,650 --> 00:02:57,690
These two managers are significantly different

80
00:02:57,690 --> 00:03:00,300
from each other, but the functionality they use

81
00:03:00,300 --> 00:03:02,310
is actually going to be the same.

82
00:03:02,310 --> 00:03:03,630
As a Linux user,

83
00:03:03,630 --> 00:03:04,980
your choice will usually be driven

84
00:03:04,980 --> 00:03:07,140
by your preferred Linux distribution.

85
00:03:07,140 --> 00:03:10,680
For example, if you're using CentOS or Red Hat,

86
00:03:10,680 --> 00:03:14,370
you're going to be using RPM or the Red Hat package manager.

87
00:03:14,370 --> 00:03:16,290
If you're using something that is Debian based,

88
00:03:16,290 --> 00:03:20,130
like Kali Linux, or Debian, you're going to be using dpkg,

89
00:03:20,130 --> 00:03:22,710
or the Debian package management system.

90
00:03:22,710 --> 00:03:25,440
Now for the most part, you're probably going to be using one

91
00:03:25,440 --> 00:03:27,390
of these two package systems instead

92
00:03:27,390 --> 00:03:30,390
of compiling the code yourself from source.

93
00:03:30,390 --> 00:03:32,520
But there are some cases where you may want

94
00:03:32,520 --> 00:03:34,410
to compile things from source.

95
00:03:34,410 --> 00:03:37,110
This is because of the open source nature of Linux.

96
00:03:37,110 --> 00:03:39,000
You have access to the source code,

97
00:03:39,000 --> 00:03:40,170
and maybe there's some options that

98
00:03:40,170 --> 00:03:41,760
you want to enable or disable.

99
00:03:41,760 --> 00:03:43,710
You want to customize some choices inside

100
00:03:43,710 --> 00:03:45,660
of that software and things like that.

101
00:03:45,660 --> 00:03:48,360
In those cases, you can create those modifications

102
00:03:48,360 --> 00:03:50,910
to the source code and then compile the source code

103
00:03:50,910 --> 00:03:52,800
on your own system to run it.

104
00:03:52,800 --> 00:03:55,350
But again, manually compiling software does require

105
00:03:55,350 --> 00:03:57,240
more effort and more knowledge,

106
00:03:57,240 --> 00:03:59,910
but it can give you something that is really customized

107
00:03:59,910 --> 00:04:01,350
to your own needs.

108
00:04:01,350 --> 00:04:04,295
For the most part, though, probably 99% of the time

109
00:04:04,295 --> 00:04:07,170
you're going to be just fine using packages using

110
00:04:07,170 --> 00:04:09,960
either RPM or dpkg.

111
00:04:09,960 --> 00:04:12,030
Let's talk a little bit more about RPM.

112
00:04:12,030 --> 00:04:14,850
Now, RPM is the Red Hat package manager,

113
00:04:14,850 --> 00:04:17,880
and it's still in use today by many system administrators.

114
00:04:17,880 --> 00:04:19,410
Software packages that are prepared

115
00:04:19,410 --> 00:04:23,520
for RPM will have a file extension of .rpm.

116
00:04:23,520 --> 00:04:26,430
RPM is very flexible and very powerful.

117
00:04:26,430 --> 00:04:28,710
And one of the most useful features is the ability

118
00:04:28,710 --> 00:04:31,320
for it to inventory software on your system.

119
00:04:31,320 --> 00:04:33,660
This enables the system administrator to easily

120
00:04:33,660 --> 00:04:36,180
see what software is installed and what versions

121
00:04:36,180 --> 00:04:39,480
of those pieces of software are installed on a given system.

122
00:04:39,480 --> 00:04:42,270
There's actually a newer and more advanced package manager

123
00:04:42,270 --> 00:04:43,560
than the RPM.

124
00:04:43,560 --> 00:04:46,320
And this is also supported by all Red Hat derivatives

125
00:04:46,320 --> 00:04:48,960
including Red Hat Linux, and CentOS.

126
00:04:48,960 --> 00:04:53,040
This is known as YUM, the Yellowdog Updater, Modified.

127
00:04:53,040 --> 00:04:54,900
Now YUM does rely on RPM,

128
00:04:54,900 --> 00:04:57,810
and it still uses .rpm package files,

129
00:04:57,810 --> 00:04:59,400
but it offers a more elegant set

130
00:04:59,400 --> 00:05:01,290
of commands and greater flexibility

131
00:05:01,290 --> 00:05:02,970
for using software repositories

132
00:05:02,970 --> 00:05:05,310
and handling dependencies for you.

133
00:05:05,310 --> 00:05:07,770
Now just like YUM has replaced RPM,

134
00:05:07,770 --> 00:05:11,730
there's a newer version called DNF that is replacing YUM.

135
00:05:11,730 --> 00:05:15,660
DNF stands for the Dandified YUM package manager.

136
00:05:15,660 --> 00:05:18,510
It's an improved version of YUM and uses fewer resources

137
00:05:18,510 --> 00:05:20,130
while still maintaining support for

138
00:05:20,130 --> 00:05:23,340
the fundamental RPM package manager underneath.

139
00:05:23,340 --> 00:05:26,670
Most people find that DNF is easier to use than YUM

140
00:05:26,670 --> 00:05:28,860
because it has a more simplified set of commands

141
00:05:28,860 --> 00:05:30,840
while still being backwards compatible to most

142
00:05:30,840 --> 00:05:33,450
of the YUM sub commands if you're used to those.

143
00:05:33,450 --> 00:05:34,680
If you've been using YUM,

144
00:05:34,680 --> 00:05:37,200
moving to DNF is pretty easy.

145
00:05:37,200 --> 00:05:38,970
To install a package using DNF,

146
00:05:38,970 --> 00:05:42,510
simply type in dnf install and the package name.

147
00:05:42,510 --> 00:05:46,320
For example, dnf install Apache2 would install

148
00:05:46,320 --> 00:05:48,150
the Apache2 web server.

149
00:05:48,150 --> 00:05:50,220
If you want to uninstall a DNF package,

150
00:05:50,220 --> 00:05:53,280
simply type in dnf remove package name.

151
00:05:53,280 --> 00:05:57,060
So dnf remove Apache2 would uninstall

152
00:05:57,060 --> 00:06:00,330
the Apache2 web server from that Linux system.

153
00:06:00,330 --> 00:06:02,850
Now another package manager you may run across

154
00:06:02,850 --> 00:06:04,350
is known as Zypper.

155
00:06:04,350 --> 00:06:07,410
Zypper is a package manager that supports repositories,

156
00:06:07,410 --> 00:06:10,500
dependencies and management of the software lifecycle

157
00:06:10,500 --> 00:06:12,570
on an openSUSE system.

158
00:06:12,570 --> 00:06:15,180
This still does support .rpm packages,

159
00:06:15,180 --> 00:06:18,090
but it is specific to that Linux distribution.

160
00:06:18,090 --> 00:06:20,010
It's very efficient and it does a great job

161
00:06:20,010 --> 00:06:22,170
of managing package dependencies for you.

162
00:06:22,170 --> 00:06:24,480
But if you're not on an openSUSE system,

163
00:06:24,480 --> 00:06:26,250
you're probably not going to be using it.

164
00:06:26,250 --> 00:06:29,310
If you are on an openSUSE system, you can install a package

165
00:06:29,310 --> 00:06:33,090
by simply typing in zypper in and the package name.

166
00:06:33,090 --> 00:06:36,420
To uninstall a package, simply type in zypper rm

167
00:06:36,420 --> 00:06:37,563
and that package name.

168
00:06:39,120 --> 00:06:41,760
If you're using a Debian based Linux system though,

169
00:06:41,760 --> 00:06:43,980
you're going to be using dpkg,

170
00:06:43,980 --> 00:06:46,200
which is the Debian package manager.

171
00:06:46,200 --> 00:06:47,760
This is available in all Debian

172
00:06:47,760 --> 00:06:49,830
and Debian based Linux distributions.

173
00:06:49,830 --> 00:06:51,960
For example, Kali Linux is based

174
00:06:51,960 --> 00:06:55,650
on Debian and therefore it uses dpkg.

175
00:06:55,650 --> 00:06:58,980
The dpkg manager can control the entire software lifecycle

176
00:06:58,980 --> 00:07:03,030
for you just like RPM can, but it's done on a Debian system.

177
00:07:03,030 --> 00:07:06,960
Software packages are going to have the .deb file extension

178
00:07:06,960 --> 00:07:10,440
if they're able to be used with the dpkg software,

179
00:07:10,440 --> 00:07:14,550
because it's .deb for Debian package manager.

180
00:07:14,550 --> 00:07:16,620
The preferred method of package management, though,

181
00:07:16,620 --> 00:07:19,710
on Debian based systems today is actually using a tool known

182
00:07:19,710 --> 00:07:22,950
as APT, the advanced package tool.

183
00:07:22,950 --> 00:07:26,880
This is a more flexible tool than the dpkg package manager,

184
00:07:26,880 --> 00:07:30,180
but it still relies on .deb packages.

185
00:07:30,180 --> 00:07:35,180
Much like YUM still uses RPM, APT still uses .deb files.

186
00:07:36,780 --> 00:07:38,070
Okay, so as you can see

187
00:07:38,070 --> 00:07:40,560
there are lots of different package managers out there.

188
00:07:40,560 --> 00:07:42,270
But what it comes down to is

189
00:07:42,270 --> 00:07:45,420
that package managers are an easy way for you to install

190
00:07:45,420 --> 00:07:48,240
or remove software on a given Linux system.

191
00:07:48,240 --> 00:07:50,370
If you're using something that is Red Hat based,

192
00:07:50,370 --> 00:07:52,230
like CentOS or Red Hat,

193
00:07:52,230 --> 00:07:56,100
you're going to be using .rpm files using either the DNF

194
00:07:56,100 --> 00:07:58,170
or YUM package managers.

195
00:07:58,170 --> 00:08:00,540
If you're using a Debian based distribution,

196
00:08:00,540 --> 00:08:03,900
you're going to be using .deb files as your packages,

197
00:08:03,900 --> 00:08:08,013
and using tools like APT or the older dpkg.

