1 00:00:00,000 --> 00:00:01,500 [No audio] 2 00:00:01,500 --> 00:00:05,550 System updates and repos. repos stands 3 00:00:05,550 --> 00:00:08,580 for repositories. This is a very 4 00:00:08,580 --> 00:00:11,700 important lesson for installing new 5 00:00:11,700 --> 00:00:14,850 packages to your systems. So there are 6 00:00:14,850 --> 00:00:18,120 two major commands that are used in 7 00:00:18,120 --> 00:00:20,730 system updates and repos installation is 8 00:00:20,730 --> 00:00:24,450 the first one is yum. yum command is 9 00:00:24,450 --> 00:00:27,570 mostly used in CentOS or in Redhat 10 00:00:27,570 --> 00:00:31,020 environment. Whereas apt-get is another 11 00:00:31,020 --> 00:00:33,540 similar command that is used in other 12 00:00:33,540 --> 00:00:38,580 Linux distribution servers. yum command 13 00:00:39,120 --> 00:00:43,230 installs a package from the repositories 14 00:00:43,230 --> 00:00:46,620 that are defined in your Linux system, 15 00:00:47,070 --> 00:00:50,310 those repositories, those configuration 16 00:00:50,310 --> 00:00:54,450 files, has the URL link for 17 00:00:54,450 --> 00:00:58,290 repositories. So when you run yum, it's 18 00:00:58,290 --> 00:01:01,380 telling the system go online with this 19 00:01:01,380 --> 00:01:04,050 URL and get the package that I'm asking 20 00:01:04,050 --> 00:01:07,830 you to install. So in other words, yum 21 00:01:07,860 --> 00:01:11,310 does need an Internet access to go 22 00:01:11,310 --> 00:01:15,893 online and install a package to your system. 23 00:01:15,893 --> 00:01:36,433 [No audio] 24 00:01:36,433 --> 00:01:39,060 Then the next command we have is 25 00:01:39,090 --> 00:01:42,540 rpm. rpm stands for Red Hat Package 26 00:01:42,540 --> 00:01:46,200 Manager. Now rpm, of course was first 27 00:01:46,200 --> 00:01:48,900 developed by Red Hat and is still in use 28 00:01:48,900 --> 00:01:52,080 by Red Hat. But nowadays many other 29 00:01:52,080 --> 00:01:54,060 Linux distributions have carried over 30 00:01:54,060 --> 00:01:56,970 the same command rpm they never changed. 31 00:01:57,480 --> 00:02:00,990 Now what's the purpose of rpm? Before I 32 00:02:00,990 --> 00:02:02,880 tell you about rpm, let me tell you a 33 00:02:02,880 --> 00:02:05,790 difference between rpm and yum. This way 34 00:02:05,790 --> 00:02:07,350 it will be much easier for you to 35 00:02:07,380 --> 00:02:12,660 understand what rpm is. rpm is used when 36 00:02:12,660 --> 00:02:17,460 you already have package downloaded in 37 00:02:17,460 --> 00:02:20,550 your system. And then you could install 38 00:02:20,550 --> 00:02:23,460 it locally by running the command rpm. 39 00:02:24,120 --> 00:02:27,600 Now whereas yum, yum does all the things 40 00:02:27,600 --> 00:02:29,820 for you. In downloads the package, 41 00:02:29,850 --> 00:02:35,040 installs the package as well. So rpm is 42 00:02:35,040 --> 00:02:37,500 mostly used in an environment where they 43 00:02:37,500 --> 00:02:41,250 don't have internet access. So let's get 44 00:02:41,250 --> 00:02:43,440 into our Linux machine I'll try both 45 00:02:43,440 --> 00:02:46,860 of these commands. Okay, I am logged 46 00:02:46,860 --> 00:02:51,660 into my Linux machine as root. Which 47 00:02:51,690 --> 00:02:54,630 directory I'm in? I'm in root directory, 48 00:02:54,660 --> 00:02:57,120 and there are different commands and of 49 00:02:57,120 --> 00:02:59,790 course what is my hostname? My hostname 50 00:02:59,820 --> 00:03:03,660 is MyFirstLinuxOS. 51 00:03:03,720 --> 00:03:05,250 Of course now we know we are not in the 52 00:03:05,250 --> 00:03:07,860 wrong system. When you are installing 53 00:03:07,860 --> 00:03:10,320 packages, please also make sure, run a 54 00:03:10,320 --> 00:03:12,480 hostname so you don't install packages 55 00:03:12,480 --> 00:03:16,650 to a wrong system. Okay, so now the next 56 00:03:16,890 --> 00:03:18,780 the first command that we will learn is 57 00:03:18,780 --> 00:03:23,880 yum. If I wanted to install a package, 58 00:03:23,910 --> 00:03:28,620 let's say ntp, all I have to do is type 59 00:03:28,620 --> 00:03:33,600 yum ntp, sorry yum install ntp. It 60 00:03:33,600 --> 00:03:36,360 will go outside to the mirrors or 61 00:03:36,360 --> 00:03:39,330 wherever the URL has been specified, and 62 00:03:39,330 --> 00:03:41,670 it will look for our NTP package. Now 63 00:03:41,670 --> 00:03:45,570 before it goes outside, it looks for 64 00:03:45,930 --> 00:03:49,890 within itself within its own 65 00:03:49,890 --> 00:03:52,890 system, and see whether the NTP package 66 00:03:52,890 --> 00:03:56,310 has been installed already or not. In 67 00:03:56,310 --> 00:03:58,380 this case, I try to install NTP package 68 00:03:58,410 --> 00:04:02,040 and what happened. It says NTP package 69 00:04:02,040 --> 00:04:03,750 has already been installed with the 70 00:04:03,750 --> 00:04:06,240 latest version, so nothing to do. Okay, 71 00:04:06,240 --> 00:04:07,920 perfect. So I don't have to install it. 72 00:04:07,950 --> 00:04:09,840 I don't have to update it. Now what 73 00:04:09,840 --> 00:04:13,470 about if I wanted to install Apache and 74 00:04:13,470 --> 00:04:17,970 Apache package name is http. It will do 75 00:04:18,000 --> 00:04:19,950 again the same thing, and if I have the 76 00:04:19,950 --> 00:04:22,019 system, if I have the package installed, 77 00:04:22,170 --> 00:04:25,264 it will give me the same message that it gave me before. 78 00:04:25,264 --> 00:04:28,951 [No audio] 79 00:04:28,951 --> 00:04:31,230 It says, No package http 80 00:04:31,230 --> 00:04:36,030 available, I believe it is httpd. Okay, 81 00:04:36,030 --> 00:04:39,900 yes, same message, https, centos already 82 00:04:39,900 --> 00:04:42,390 installed and with the latest version. 83 00:04:42,720 --> 00:04:45,930 Okay, so now before we go ahead and try 84 00:04:45,960 --> 00:04:48,720 a third package to install, I wanted to 85 00:04:48,720 --> 00:04:51,090 check if that package has already been 86 00:04:51,090 --> 00:04:53,400 installed in my system or not. And to 87 00:04:53,400 --> 00:04:57,440 check that I have to run the command rpm 88 00:04:57,440 --> 00:05:01,410 minus which has the option q for query, 89 00:05:02,550 --> 00:05:04,230 query all the packages that I have 90 00:05:04,230 --> 00:05:06,270 installed in my system with minus 91 00:05:06,270 --> 00:05:09,630 with a option. When you hit Enter, it 92 00:05:09,630 --> 00:05:11,730 went into my list of packages that are 93 00:05:11,730 --> 00:05:14,910 installed. It's giving me every single 94 00:05:14,910 --> 00:05:16,920 packages. Of course, there's so many of 95 00:05:16,920 --> 00:05:18,960 them. What if I wanted to know how many 96 00:05:18,960 --> 00:05:21,180 packages I have installed? I will do 97 00:05:21,180 --> 00:05:25,320 simply wc -l. This will give me the 98 00:05:25,320 --> 00:05:26,820 total number of packages that are 99 00:05:26,820 --> 00:05:29,760 installed. Of course, wc -l in this 100 00:05:29,760 --> 00:05:32,100 case is not actually counting the 101 00:05:32,100 --> 00:05:34,080 packages, it's actually count counting 102 00:05:34,080 --> 00:05:38,160 the lines, the output of rpm -qa, 103 00:05:38,730 --> 00:05:41,400 is telling me there are 1350 packages 104 00:05:41,400 --> 00:05:44,220 installed. Now I want to see, I want to 105 00:05:44,220 --> 00:05:47,370 install a package for DNS. Now before I 106 00:05:47,370 --> 00:05:49,230 install a package for DNS, I wanted to 107 00:05:49,260 --> 00:05:52,410 check if that package is installed. So 108 00:05:52,410 --> 00:05:55,230 I'll do rpm -qa | grep, and the 109 00:05:55,230 --> 00:05:57,330 package that needs to install 110 00:05:57,360 --> 00:06:00,630 associated with the DNS 111 00:06:00,660 --> 00:06:05,865 it's called bind. I'll do rpm minus qa 112 00:06:05,865 --> 00:06:07,980 and grep for bind only. And you will see 113 00:06:07,980 --> 00:06:10,970 here it has the bind-libs-lite, keybinder, 114 00:06:10,970 --> 00:06:13,500 bind-libs, bind-license, 115 00:06:13,680 --> 00:06:16,560 rpcbind, and bind-utils. So there 116 00:06:16,560 --> 00:06:20,760 is no package with just bind. So it 117 00:06:20,760 --> 00:06:23,220 means I don't have DNS installed. So 118 00:06:23,220 --> 00:06:25,110 what I will do is, I will install by 119 00:06:25,110 --> 00:06:30,000 running the command yum install bind. 120 00:06:30,960 --> 00:06:35,820 When I hit Enter, now it's doing the 121 00:06:35,820 --> 00:06:37,980 same thing. It's going outside on the 122 00:06:37,980 --> 00:06:40,830 internet to all the repositories that 123 00:06:40,830 --> 00:06:43,260 are defined in my configuration files. 124 00:06:43,800 --> 00:06:46,530 And it's coming back with the package 125 00:06:46,650 --> 00:06:48,990 saying, Hey, I found this package called 126 00:06:48,990 --> 00:06:51,990 bind. And its architecture version that 127 00:06:51,990 --> 00:06:54,990 I find which matches to your system is 128 00:06:54,990 --> 00:06:57,540 64 bit, the version that you will be 129 00:06:57,540 --> 00:07:00,930 installing of bind is this, repositories, 130 00:07:00,960 --> 00:07:03,150 update the repository and the 131 00:07:03,150 --> 00:07:07,110 size is 1.8 megabyte, the transaction 132 00:07:07,110 --> 00:07:08,970 summary is right here, install one 133 00:07:08,970 --> 00:07:12,090 package, total download size is going to 134 00:07:12,090 --> 00:07:17,190 be 1.8 Meg. So I'll go ahead and it will 135 00:07:17,190 --> 00:07:20,040 say is it okay? I'll say yes, go ahead 136 00:07:20,040 --> 00:07:24,870 and install the package. And if you see 137 00:07:24,870 --> 00:07:27,030 the progress, depending on the speed of 138 00:07:27,030 --> 00:07:30,540 your computer, how fast it is connected 139 00:07:30,540 --> 00:07:34,380 to the internet, that's what matters in 140 00:07:34,380 --> 00:07:37,380 doing the download and install. So right 141 00:07:37,380 --> 00:07:40,530 now, if you see that the yum is doing 142 00:07:40,530 --> 00:07:43,440 two things for us. One, it's downloading 143 00:07:43,440 --> 00:07:46,860 the package. Once it's completed 144 00:07:46,860 --> 00:07:49,500 downloading, then right here, it's 145 00:07:49,530 --> 00:07:52,620 installing the package, it's installed. 146 00:07:52,710 --> 00:07:55,650 Once it's installed, it verified it, and 147 00:07:55,650 --> 00:07:58,290 it has confirmed that it has installed 148 00:07:58,290 --> 00:08:00,900 the package. Now how do I verify again 149 00:08:00,900 --> 00:08:04,830 manually by running the command rpm -qa, 150 00:08:04,830 --> 00:08:08,918 grep for bind. 151 00:08:08,918 --> 00:08:12,431 [No audio] 152 00:08:12,431 --> 00:08:19,830 Okay, and now this time you will see right here, yes, 153 00:08:19,860 --> 00:08:23,790 the third, fourth line, this one is just 154 00:08:23,790 --> 00:08:27,510 simply bind without any libs, license, or 155 00:08:27,510 --> 00:08:30,840 any other extra packages that needed for 156 00:08:30,840 --> 00:08:36,058 bind. So, yum also installed any 157 00:08:36,120 --> 00:08:38,490 dependencies, meaning if there is any 158 00:08:38,490 --> 00:08:40,890 other packages that is required with 159 00:08:40,890 --> 00:08:43,830 this package, it does it for sure,, 160 00:08:44,039 --> 00:08:46,590 whereas rpm, if you have one rpm 161 00:08:46,590 --> 00:08:48,960 package, when you run the command, 162 00:08:48,990 --> 00:08:51,390 it will tell you, hey, I don't have that 163 00:08:51,390 --> 00:08:53,130 dependency, so you have to install that 164 00:08:53,130 --> 00:08:57,660 package as well. So to again, to go back 165 00:08:57,660 --> 00:09:01,260 to our rpm command, to install a 166 00:09:01,260 --> 00:09:04,170 package, you have to use the command rpm 167 00:09:04,320 --> 00:09:09,330 minus ihv, or you could change that to 168 00:09:09,330 --> 00:09:12,360 hiv, vih whichever the way you want, 169 00:09:12,540 --> 00:09:16,380 space, the location of your rpm. So if 170 00:09:16,380 --> 00:09:19,110 you have downloaded your rpm, in let's 171 00:09:19,110 --> 00:09:21,330 say tmp, then you will specify slash 172 00:09:21,330 --> 00:09:25,650 tmp slash package, whatever the name of 173 00:09:25,680 --> 00:09:27,900 the package is, and usually the package 174 00:09:27,930 --> 00:09:31,530 ends with dot rpm. Then when you run 175 00:09:31,530 --> 00:09:34,560 this command, it will install that 176 00:09:34,560 --> 00:09:38,640 package for you. Now, you could also do 177 00:09:38,670 --> 00:09:43,830 rpm minus e to remove a package. So let's 178 00:09:43,830 --> 00:09:45,990 say if I wanted to remove this package, 179 00:09:46,470 --> 00:09:50,910 bind, the one we just installed. So I 180 00:09:50,910 --> 00:09:53,629 will have to type here now bind, 181 00:09:53,629 --> 00:09:57,266 [No audio] 182 00:09:57,266 --> 00:10:00,600 our package is not, sorry. I did some kind 183 00:10:00,600 --> 00:10:02,700 of mistake, so rpm minus e, let me see if I 184 00:10:02,700 --> 00:10:05,970 could copy and paste, should be able to do that. 185 00:10:05,970 --> 00:10:09,269 [No audio] 186 00:10:09,269 --> 00:10:12,989 Yes, copy and paste. 187 00:10:12,989 --> 00:10:16,191 [No audio] 188 00:10:16,191 --> 00:10:18,299 It's gone. Now 189 00:10:18,299 --> 00:10:23,439 can, I verify it rpm -qa, grep for bind. 190 00:10:23,439 --> 00:10:26,487 [No audio] 191 00:10:26,493 --> 00:10:28,739 Okay, you see it's not there. So 192 00:10:28,739 --> 00:10:30,599 what do we do now if I want to install 193 00:10:30,599 --> 00:10:33,509 it back, I will do yum install bind. 194 00:10:33,509 --> 00:10:42,120 [No audio] 195 00:10:42,120 --> 00:10:45,990 Click yes to install it, yes it is 196 00:10:45,990 --> 00:10:48,720 downloading again, same process and it's 197 00:10:48,720 --> 00:10:50,430 downloading. Now you probably would 198 00:10:50,430 --> 00:10:52,710 thinking hey, didn't it download when we 199 00:10:52,740 --> 00:10:54,480 when we did the same command before? 200 00:10:54,750 --> 00:10:57,990 Yes, it did download, but yum is very 201 00:10:59,070 --> 00:11:01,710 smart tool. What it does, it downloads, it 202 00:11:01,710 --> 00:11:04,770 installs, it verifies, and it also cleans 203 00:11:04,770 --> 00:11:07,530 up your downloads, so your space, 204 00:11:07,530 --> 00:11:09,660 this space is used more efficiently, so 205 00:11:09,690 --> 00:11:11,820 it doesn't keep the old downloads on 206 00:11:11,820 --> 00:11:14,940 your system. Okay, so now the download 207 00:11:14,940 --> 00:11:18,291 is completed, let's check again if we have the package. 208 00:11:18,339 --> 00:11:21,444 [No audio] 209 00:11:21,444 --> 00:11:22,950 Yes, we do have the 210 00:11:22,950 --> 00:11:25,200 package, and package is right here the 211 00:11:25,200 --> 00:11:28,230 first one. Now we use the rpm -e 212 00:11:28,230 --> 00:11:30,930 command to remove that package. Now we 213 00:11:30,930 --> 00:11:37,320 could also do yum remove bind, and it 214 00:11:37,320 --> 00:11:39,690 will do the same thing as if I would do 215 00:11:39,870 --> 00:11:42,240 rpm -e. So it says, Remove one 216 00:11:42,240 --> 00:11:44,609 package, yes, go ahead and remove it. 217 00:11:44,619 --> 00:11:46,772 [No audio] 218 00:11:46,772 --> 00:11:51,090 There you go, so it's gone. So anyway guys, I hope 219 00:11:51,510 --> 00:11:55,410 you know now that how rpm and yum command 220 00:11:55,410 --> 00:11:58,500 works. You will be working a lot with 221 00:11:58,500 --> 00:12:00,570 this these two commands if you're going 222 00:12:00,570 --> 00:12:03,450 to be in a system administration capacity. 223 00:12:03,450 --> 00:12:10,838 [No audio]