1
00:00:00,000 --> 00:00:00,960
In this lesson,

2
00:00:00,960 --> 00:00:03,840
we're going to discuss RPM and YUM packages.

3
00:00:03,840 --> 00:00:06,120
RPM and YUM packages are important

4
00:00:06,120 --> 00:00:08,670
because they're used to conduct Linux package management

5
00:00:08,670 --> 00:00:12,510
inside of Red Hat-based distributions like CentOS.

6
00:00:12,510 --> 00:00:14,730
Now, they're going to be used to install, patch,

7
00:00:14,730 --> 00:00:18,210
and remove software packages on your Linux machine.

8
00:00:18,210 --> 00:00:19,770
Now, these are some of the most common tasks

9
00:00:19,770 --> 00:00:22,020
that you're going to do as a system administrator.

10
00:00:22,020 --> 00:00:24,090
And because of this, it's really important

11
00:00:24,090 --> 00:00:25,830
that you gain this essential skill

12
00:00:25,830 --> 00:00:28,110
to understand how to manage your packages.

13
00:00:28,110 --> 00:00:29,490
Different Linux distributions

14
00:00:29,490 --> 00:00:31,710
will use different package management tools,

15
00:00:31,710 --> 00:00:33,900
but if you're using Red Hat-based distributions,

16
00:00:33,900 --> 00:00:38,250
like CentOS, you can use RPM or the Red Hat Package Manager

17
00:00:38,250 --> 00:00:40,410
or you can use YUM or DNF,

18
00:00:40,410 --> 00:00:44,610
which is the Yellowdog Updater, Modified or Dandified YUM.

19
00:00:44,610 --> 00:00:46,680
Now, the RPM command is going to be used

20
00:00:46,680 --> 00:00:50,640
to manage RPM packages on Red Hat-derived distributions.

21
00:00:50,640 --> 00:00:53,790
It has options including -i and the package name

22
00:00:53,790 --> 00:00:56,730
which you use to install the specified software package.

23
00:00:56,730 --> 00:00:59,029
If you use -e and the package name,

24
00:00:59,029 --> 00:01:02,430
this is going to be used to erase or uninstall the package.

25
00:01:02,430 --> 00:01:05,010
v is going to be used to enable verbose mode

26
00:01:05,010 --> 00:01:07,140
which gives you more details and error messages

27
00:01:07,140 --> 00:01:08,253
if things go wrong.

28
00:01:09,090 --> 00:01:11,160
h is going to be used to print hash marks

29
00:01:11,160 --> 00:01:12,450
to indicate a progress bar

30
00:01:12,450 --> 00:01:14,340
as you're installing the software.

31
00:01:14,340 --> 00:01:17,400
And -V and the package name is going to be used

32
00:01:17,400 --> 00:01:19,890
to verify the software components of the package

33
00:01:19,890 --> 00:01:21,450
to ensure they exist.

34
00:01:21,450 --> 00:01:22,860
To run the RPM command,

35
00:01:22,860 --> 00:01:26,700
simply type in rpm, the options, and the package name.

36
00:01:26,700 --> 00:01:28,110
Now, one of the most powerful features

37
00:01:28,110 --> 00:01:29,880
of the RPM Package Manager

38
00:01:29,880 --> 00:01:31,770
is the ability for it to maintain a database

39
00:01:31,770 --> 00:01:33,510
of software information.

40
00:01:33,510 --> 00:01:36,000
This database will enable you as an administrator

41
00:01:36,000 --> 00:01:38,250
to discover the package version information,

42
00:01:38,250 --> 00:01:40,380
to have a list of all the installed software,

43
00:01:40,380 --> 00:01:43,380
to discover dependency information, and much more.

44
00:01:43,380 --> 00:01:45,180
If you want to be able to query this database

45
00:01:45,180 --> 00:01:46,620
and get information about it,

46
00:01:46,620 --> 00:01:50,220
you can do that by typing in rpm -qa

47
00:01:50,220 --> 00:01:52,380
to list all the installed software.

48
00:01:52,380 --> 00:01:55,890
If you type in rpm -qi and the package name,

49
00:01:55,890 --> 00:01:59,070
this'll list information about a single particular package.

50
00:01:59,070 --> 00:02:01,837
And if you use rpm -qc and the package name,

51
00:02:01,837 --> 00:02:04,620
this will list out all the configuration files

52
00:02:04,620 --> 00:02:06,450
for a particular package.

53
00:02:06,450 --> 00:02:07,283
Now, as I said,

54
00:02:07,283 --> 00:02:11,190
RPM can also be used to validate and verify your software.

55
00:02:11,190 --> 00:02:12,870
This verification will check to see

56
00:02:12,870 --> 00:02:14,670
if the installed software components

57
00:02:14,670 --> 00:02:17,310
are matching what the RPM package specifies

58
00:02:17,310 --> 00:02:18,960
that should have been installed.

59
00:02:18,960 --> 00:02:20,580
The verify option is going to be used

60
00:02:20,580 --> 00:02:22,410
to troubleshoot installed software

61
00:02:22,410 --> 00:02:24,840
and ensure that the entire software package is installed,

62
00:02:24,840 --> 00:02:27,120
and valid, and working properly.

63
00:02:27,120 --> 00:02:27,960
To do this,

64
00:02:27,960 --> 00:02:32,430
you're going to use rpm -V and the package name.

65
00:02:32,430 --> 00:02:34,050
Now part of the software lifecycle

66
00:02:34,050 --> 00:02:36,000
is also to keep your software current

67
00:02:36,000 --> 00:02:38,130
with the latest versions and updates.

68
00:02:38,130 --> 00:02:41,730
RPM offers two primary ways for you to accomplish this goal.

69
00:02:41,730 --> 00:02:44,790
The first is to use the -U option.

70
00:02:44,790 --> 00:02:46,980
This will be used to upgrade the installed package

71
00:02:46,980 --> 00:02:50,010
and then install the package if it's not already installed.

72
00:02:50,010 --> 00:02:53,130
The second method is use the -F option.

73
00:02:53,130 --> 00:02:55,500
This is known as the freshen option.

74
00:02:55,500 --> 00:02:57,630
Now, when you freshen the installed package,

75
00:02:57,630 --> 00:03:00,180
this is going to update the package if it's installed.

76
00:03:00,180 --> 00:03:02,220
But, if it's not already installed,

77
00:03:02,220 --> 00:03:03,750
it's not going to do anything

78
00:03:03,750 --> 00:03:06,420
because you're just freshening an existing install.

79
00:03:06,420 --> 00:03:08,880
So remember, if you use -U,

80
00:03:08,880 --> 00:03:11,580
you will install the package if it doesn't already exist

81
00:03:11,580 --> 00:03:14,100
or you'll upgrade the package if it does.

82
00:03:14,100 --> 00:03:18,840
With -F, you will only upgrade the package if it exists.

83
00:03:18,840 --> 00:03:20,400
The yum command is another way

84
00:03:20,400 --> 00:03:22,260
that you can use package management.

85
00:03:22,260 --> 00:03:25,200
The yum command improves on the functionality of RPM

86
00:03:25,200 --> 00:03:28,080
while still using those RPM packages themself

87
00:03:28,080 --> 00:03:30,390
and maintaining an RPM database.

88
00:03:30,390 --> 00:03:32,070
This provides a more straightforward method

89
00:03:32,070 --> 00:03:33,570
for you to manage your packages

90
00:03:33,570 --> 00:03:36,540
and works as an upgraded version of RPM.

91
00:03:36,540 --> 00:03:39,330
One of the biggest benefits of using yum is its ability

92
00:03:39,330 --> 00:03:41,970
to automatically handle software dependencies.

93
00:03:41,970 --> 00:03:43,860
This means that administrators can tell yum

94
00:03:43,860 --> 00:03:45,540
to install a particular package

95
00:03:45,540 --> 00:03:46,950
along with automatically installing

96
00:03:46,950 --> 00:03:48,540
all the additional packages

97
00:03:48,540 --> 00:03:50,670
that that thing depends upon.

98
00:03:50,670 --> 00:03:54,180
An additional yum benefit is also the use of repositories.

99
00:03:54,180 --> 00:03:56,100
Now repositories enable administrators

100
00:03:56,100 --> 00:03:59,460
to more easily maintain version control over the software.

101
00:03:59,460 --> 00:04:02,160
The yum command comes with lots of different sub commands

102
00:04:02,160 --> 00:04:04,260
that you can use to manage your packages.

103
00:04:04,260 --> 00:04:07,830
For example, if you type yum install and the package name,

104
00:04:07,830 --> 00:04:08,970
this will install the package

105
00:04:08,970 --> 00:04:11,160
from any configured repository.

106
00:04:11,160 --> 00:04:13,980
If you use yum local install package name,

107
00:04:13,980 --> 00:04:16,860
this will install the package from the local repository.

108
00:04:16,860 --> 00:04:19,230
If you use yum remove package name,

109
00:04:19,230 --> 00:04:21,240
this will uninstall your package.

110
00:04:21,240 --> 00:04:23,700
If you use yum update package name,

111
00:04:23,700 --> 00:04:25,680
this will update the package.

112
00:04:25,680 --> 00:04:27,660
If you want to update all of your software,

113
00:04:27,660 --> 00:04:30,750
you can do this by typing yum update and hitting enter

114
00:04:30,750 --> 00:04:33,270
and this will update all of your installed packages.

115
00:04:33,270 --> 00:04:34,650
Now note, if you do this,

116
00:04:34,650 --> 00:04:37,140
it is going to download all the updates and install them

117
00:04:37,140 --> 00:04:39,600
so this can actually take quite a bit of time.

118
00:04:39,600 --> 00:04:42,420
If you type in yum info and the package name,

119
00:04:42,420 --> 00:04:43,620
this will provide information

120
00:04:43,620 --> 00:04:45,660
about the package that's installed.

121
00:04:45,660 --> 00:04:48,480
And if you use yum provides file name,

122
00:04:48,480 --> 00:04:51,270
this will provide a report of what the package provides

123
00:04:51,270 --> 00:04:53,580
for specified files and libraries.

124
00:04:53,580 --> 00:04:55,680
Essentially listing out everything that was installed

125
00:04:55,680 --> 00:04:57,540
for that particular package.

126
00:04:57,540 --> 00:04:59,970
If you want to run the yum command in general,

127
00:04:59,970 --> 00:05:02,310
you're simply going to type in yum, the options,

128
00:05:02,310 --> 00:05:05,040
the sub command and the package name.

129
00:05:05,040 --> 00:05:06,450
Now, another thing you might use

130
00:05:06,450 --> 00:05:09,540
inside of your yum is the -y option.

131
00:05:09,540 --> 00:05:12,600
The -y option is going to automatically answer yes

132
00:05:12,600 --> 00:05:14,940
to installing additional software dependencies

133
00:05:14,940 --> 00:05:16,800
when you're trying to install a package.

134
00:05:16,800 --> 00:05:18,030
If you don't do this,

135
00:05:18,030 --> 00:05:20,460
yum is actually going to prompt you to answer yes or no

136
00:05:20,460 --> 00:05:23,340
to each and every dependency that it wants to install

137
00:05:23,340 --> 00:05:25,170
based on the software you asked.

138
00:05:25,170 --> 00:05:27,510
Now, if you don't understand the concept of dependencies,

139
00:05:27,510 --> 00:05:29,070
think about it this way.

140
00:05:29,070 --> 00:05:31,020
If I wanted to create a new program,

141
00:05:31,020 --> 00:05:33,750
there's lots of existing code that already exists out there.

142
00:05:33,750 --> 00:05:36,240
So would I want to rewrite everything from scratch?

143
00:05:36,240 --> 00:05:37,590
Well, probably not.

144
00:05:37,590 --> 00:05:40,950
So instead, I can link to other libraries that exist.

145
00:05:40,950 --> 00:05:43,890
For example, if you're used to using a Windows machine,

146
00:05:43,890 --> 00:05:47,520
every single Windows software has the same basic features

147
00:05:47,520 --> 00:05:50,070
where you can open a file or save a file.

148
00:05:50,070 --> 00:05:50,910
It'd be kind of dumb

149
00:05:50,910 --> 00:05:52,860
if everyone had to code that themselves.

150
00:05:52,860 --> 00:05:55,110
So instead, there's a library you can call

151
00:05:55,110 --> 00:05:58,080
that's called the file input output system, right?

152
00:05:58,080 --> 00:06:00,720
And that way you can choose to just reference

153
00:06:00,720 --> 00:06:03,690
the open dialogue box or the save dialogue box

154
00:06:03,690 --> 00:06:04,890
using a single line of code

155
00:06:04,890 --> 00:06:07,320
and everything else will be run by that library.

156
00:06:07,320 --> 00:06:09,180
That now becomes a dependency.

157
00:06:09,180 --> 00:06:12,060
And so when I go and give you my source code or my package

158
00:06:12,060 --> 00:06:13,410
and you try to install it,

159
00:06:13,410 --> 00:06:16,590
it now says in addition to installing Jason's new program,

160
00:06:16,590 --> 00:06:19,680
I also need to install the file input output library

161
00:06:19,680 --> 00:06:22,290
that was a dependency of Jason's program.

162
00:06:22,290 --> 00:06:23,123
If you have to figure out

163
00:06:23,123 --> 00:06:24,450
all those dependencies on your own,

164
00:06:24,450 --> 00:06:26,280
it can be a nightmare,

165
00:06:26,280 --> 00:06:28,770
but by using packages, you don't have to do that

166
00:06:28,770 --> 00:06:31,260
because yum is going to find all those dependencies

167
00:06:31,260 --> 00:06:32,400
and install them for you,

168
00:06:32,400 --> 00:06:34,530
as long as you tell it to.

169
00:06:34,530 --> 00:06:36,810
Finally, when it comes to RPM packages,

170
00:06:36,810 --> 00:06:40,110
we can also use DNF as our package manager.

171
00:06:40,110 --> 00:06:41,850
To install a package using DNF,

172
00:06:41,850 --> 00:06:45,090
simply type in dnf install and the package name.

173
00:06:45,090 --> 00:06:46,860
To uninstall a package using DNF,

174
00:06:46,860 --> 00:06:50,040
simply type in dnf remove and the package name.

175
00:06:50,040 --> 00:06:52,530
In general, most of the sub commands used by YUM

176
00:06:52,530 --> 00:06:54,750
are going to also work in DNF

177
00:06:54,750 --> 00:06:56,250
and if you want to learn more about DNF,

178
00:06:56,250 --> 00:06:57,480
you can check the man pages

179
00:06:57,480 --> 00:07:00,060
by typing man dnf and pressing enter

180
00:07:00,060 --> 00:07:01,710
in your command line environment.

