1 00:00:06,660 --> 00:00:08,250 - [Narrator] In this video, I wanna tell you how 2 00:00:08,250 --> 00:00:10,924 the rpm command still can be useful. 3 00:00:10,924 --> 00:00:14,123 In the past, rpm was used for package installation. 4 00:00:14,123 --> 00:00:16,900 Nowadays, really, you shouldn't be doing that anymore 5 00:00:16,900 --> 00:00:20,456 because it's not taking care of any dependencies. 6 00:00:20,456 --> 00:00:23,940 However, rpm is still useful for queries. 7 00:00:23,940 --> 00:00:26,040 You can query the rpm database, 8 00:00:26,040 --> 00:00:28,383 and you can query individual packages. 9 00:00:30,311 --> 00:00:34,680 For instance, you can use rpm -qf to find the package 10 00:00:34,680 --> 00:00:37,680 where a file is coming from. 11 00:00:37,680 --> 00:00:40,177 And that is useful if you know which file you need 12 00:00:40,177 --> 00:00:42,600 to update, but you don't know the package 13 00:00:42,600 --> 00:00:43,689 that belongs to the file. 14 00:00:43,689 --> 00:00:46,688 And once you've found the package, you can use rpm -ql 15 00:00:46,688 --> 00:00:49,929 on that package to query the rpm database, 16 00:00:49,929 --> 00:00:53,474 to list the package contents. 17 00:00:53,474 --> 00:00:56,597 It can also be useful to query the package file 18 00:00:56,597 --> 00:00:58,890 instead of the package contents. 19 00:00:58,890 --> 00:01:02,034 And if you wanna do that you add a p to the options. 20 00:01:02,034 --> 00:01:04,289 Like rpm -qpc in a package. which will list 21 00:01:04,289 --> 00:01:08,730 configuration files in the downloaded package file. 22 00:01:08,730 --> 00:01:12,637 Or a very important one, rpm -qp --scripts 23 00:01:12,637 --> 00:01:14,083 on a package. 24 00:01:14,083 --> 00:01:17,423 That will show you installation scripts that are 25 00:01:17,423 --> 00:01:18,767 in the package. 26 00:01:18,767 --> 00:01:21,330 And as you know, the packages are installed 27 00:01:21,330 --> 00:01:23,070 with root privileges. 28 00:01:23,070 --> 00:01:25,740 You might want to check out the contents of the package 29 00:01:25,740 --> 00:01:29,580 before actually running the root based insular. 30 00:01:29,580 --> 00:01:30,693 Let me demonstrate. 31 00:01:32,940 --> 00:01:37,390 So let me start with pseudo rpm -qf 32 00:01:39,258 --> 00:01:42,540 on which ifconfig. 33 00:01:42,540 --> 00:01:43,440 That's a nice one. 34 00:01:43,440 --> 00:01:46,470 You remember, ifconfig the obsolete command? 35 00:01:46,470 --> 00:01:49,050 ifconfig is coming from Net Tools. 36 00:01:49,050 --> 00:01:51,420 So what else do we have in Net Tools? 37 00:01:51,420 --> 00:01:54,498 Well, pseudo rpm, 38 00:01:54,498 --> 00:01:57,763 - ql Net Tools. 39 00:01:57,763 --> 00:02:00,189 If you query packages you don't have to install 40 00:02:00,189 --> 00:02:01,933 the version information. 41 00:02:01,933 --> 00:02:04,469 Just the package name is enough. 42 00:02:04,469 --> 00:02:06,600 And now we can see that's kind of a lot 43 00:02:06,600 --> 00:02:10,950 so I need to use a graph to filter it down a little bit. 44 00:02:10,950 --> 00:02:14,835 Let me graph on bin so that we only can see the binaries. 45 00:02:14,835 --> 00:02:17,111 So here are the other deprecated packages 46 00:02:17,111 --> 00:02:19,829 from the Net Tools package. 47 00:02:19,829 --> 00:02:22,890 So that's convenient because now we know 48 00:02:22,890 --> 00:02:27,863 that we can use pseudo dnf or remove Net Tools. 49 00:02:29,641 --> 00:02:32,040 I would always verify the contents of the package 50 00:02:32,040 --> 00:02:34,980 before you are actually going to remove it. 51 00:02:34,980 --> 00:02:35,820 And that's done. 52 00:02:35,820 --> 00:02:38,970 We don't have IF conflict anymore. Right. 53 00:02:38,970 --> 00:02:41,310 The package file queries. 54 00:02:41,310 --> 00:02:44,903 Let me use ls on *rpm because I have a couple 55 00:02:44,903 --> 00:02:49,903 of rpms and I wanna work with virtio win. 56 00:02:50,340 --> 00:02:54,813 So rpm -qpc, the p is for package file, so this 57 00:02:54,813 --> 00:02:58,269 allows you to query a package file. 58 00:02:58,269 --> 00:03:01,680 The c is for configuration and oh we can see 59 00:03:01,680 --> 00:03:04,110 there's no configuration files in there. 60 00:03:04,110 --> 00:03:07,767 Well, you know what. Let's do, let's do a qpl 61 00:03:07,767 --> 00:03:11,163 and there we can see everything in this package. 62 00:03:13,225 --> 00:03:16,440 And that allows you to verify the contents of a package. 63 00:03:16,440 --> 00:03:19,927 Now packages typically are installed, 64 00:03:19,927 --> 00:03:23,586 and very often there's an installation script. 65 00:03:23,586 --> 00:03:26,176 And if you want to see what is 66 00:03:26,176 --> 00:03:29,700 in that script use --scripts. Nothing in there? 67 00:03:29,700 --> 00:03:31,920 Okay, let's see if there's an installation script 68 00:03:31,920 --> 00:03:33,480 in another one. 69 00:03:33,480 --> 00:03:36,140 Maybe we should use pseudo URL downloader. 70 00:03:37,527 --> 00:03:39,420 URL downloader is what you can use to 71 00:03:39,420 --> 00:03:41,610 download individual packages. 72 00:03:41,610 --> 00:03:43,950 And I want to download a package that contains 73 00:03:43,950 --> 00:03:46,260 a service like vsftpd. 74 00:03:46,260 --> 00:03:49,070 Services normally do have an installation script. 75 00:03:49,070 --> 00:03:52,050 So let's check if that is really the case. 76 00:03:52,050 --> 00:03:56,699 rpm -qp --scripts on vsftpd. 77 00:03:56,699 --> 00:03:58,110 And there we go. 78 00:03:58,110 --> 00:04:02,010 Here you can see the scripts that are provided. 79 00:04:02,010 --> 00:04:04,950 So there's a post-install and a pre-uninstall. 80 00:04:04,950 --> 00:04:08,640 And is there anything else, a post un-install? 81 00:04:08,640 --> 00:04:11,190 The thing here is that if we have a post-install 82 00:04:11,190 --> 00:04:12,023 that's all very nice 83 00:04:12,023 --> 00:04:15,690 but this script will be executed with root privileges. 84 00:04:15,690 --> 00:04:18,855 So you really wanna make sure that there is nothing 85 00:04:18,855 --> 00:04:21,509 happening in the script that you don't like. 86 00:04:21,509 --> 00:04:23,732 And that is how rpm queries come in handy 87 00:04:23,732 --> 00:04:25,353 every now and then.