1 00:00:00,000 --> 00:00:03,360 Hi. So now this is the topic about 2 00:00:03,360 --> 00:00:06,270 creating a local repository from your 3 00:00:06,270 --> 00:00:09,000 DVD. Now what is a repository? A 4 00:00:09,000 --> 00:00:11,100 repository is something where all your 5 00:00:11,100 --> 00:00:14,850 packages are stored, and then you could 6 00:00:14,880 --> 00:00:17,940 download and install the package that 7 00:00:17,940 --> 00:00:21,270 you wish to. Now you do need an Internet 8 00:00:21,270 --> 00:00:24,480 access to go out of the, outside 9 00:00:24,480 --> 00:00:27,390 repository and download and install the 10 00:00:27,390 --> 00:00:30,360 RPM. But what if you do not have 11 00:00:30,390 --> 00:00:33,509 internet access? That's where exactly the 12 00:00:33,509 --> 00:00:36,870 local repository comes in. So you have a 13 00:00:36,870 --> 00:00:38,820 Linux machine, right? Whether it's a 14 00:00:38,820 --> 00:00:40,590 virtual or physical machine doesn't 15 00:00:40,590 --> 00:00:43,440 really matter. It goes out to the 16 00:00:43,470 --> 00:00:46,230 internet. And then it goes out to a 17 00:00:46,230 --> 00:00:50,994 server, which is also most likely a Redhat server 18 00:00:50,994 --> 00:00:53,880 or CentOS server, which has 19 00:00:53,880 --> 00:00:56,820 repositories. Now, some companies do 20 00:00:56,820 --> 00:00:59,610 have those repositories local to their 21 00:00:59,610 --> 00:01:02,310 environment, which is called, the 22 00:01:02,310 --> 00:01:04,590 product that holds the repository is 23 00:01:04,590 --> 00:01:07,920 called satellite server. So that is the 24 00:01:07,920 --> 00:01:11,340 repository which holds all your repos or 25 00:01:11,340 --> 00:01:14,130 RPM packages. So you could bring them 26 00:01:14,130 --> 00:01:16,740 back and solid downloads. Now what 27 00:01:16,740 --> 00:01:20,190 happens if you do not have access to the 28 00:01:20,190 --> 00:01:22,500 outside world, or if you do not have a 29 00:01:22,500 --> 00:01:24,180 Redhat Satellite server in your 30 00:01:24,180 --> 00:01:27,150 environment? Then how are you going to 31 00:01:27,180 --> 00:01:30,120 install new programs? Well, in that 32 00:01:30,120 --> 00:01:33,210 case, you create a local repository 33 00:01:33,240 --> 00:01:35,970 within your server. So this is what 34 00:01:35,970 --> 00:01:38,310 we're going to learn in this lesson on 35 00:01:38,310 --> 00:01:41,400 creating a local repository. Now, just 36 00:01:41,400 --> 00:01:45,090 remember, if you do have an Internet 37 00:01:45,090 --> 00:01:48,270 access to your VM, or your machine, you 38 00:01:48,270 --> 00:01:49,740 don't have to worry about this lesson. 39 00:01:50,130 --> 00:01:52,650 Or if you just want to learn for just 40 00:01:52,650 --> 00:01:54,930 for educational purposes, how to create 41 00:01:54,930 --> 00:01:56,670 a local repository, then please go 42 00:01:56,670 --> 00:01:59,820 through this video. So the command to 43 00:01:59,820 --> 00:02:02,070 create or we will learn in this lesson 44 00:02:02,070 --> 00:02:05,550 it's createrepo, that's just one simple 45 00:02:05,580 --> 00:02:08,880 command. So how does it work? So let's 46 00:02:08,880 --> 00:02:12,000 get into our Linux machine. My virtual 47 00:02:12,000 --> 00:02:14,220 machine is powered off. Now I want you 48 00:02:14,220 --> 00:02:16,860 to go ahead and create a snapshot. What 49 00:02:16,860 --> 00:02:19,410 snapshot does is, it just takes a snapshot 50 00:02:19,410 --> 00:02:21,240 in case we need to revert back or if 51 00:02:21,240 --> 00:02:23,880 something goes wrong, we could always go 52 00:02:23,880 --> 00:02:28,628 back to the snapshot. Click right here says Snapshot, 53 00:02:28,628 --> 00:02:30,546 [No audio] 54 00:02:30,546 --> 00:02:34,440 and click on Take, and it 55 00:02:34,590 --> 00:02:36,630 by default gives the name Snapshot 1, 56 00:02:36,630 --> 00:02:40,470 but you could give the date or anything 57 00:02:40,470 --> 00:02:41,790 that you like that will make you 58 00:02:41,790 --> 00:02:45,300 remember. I like to pick date or sometime 59 00:02:45,300 --> 00:02:46,950 times if I'm creating multiple 60 00:02:46,950 --> 00:02:50,460 snapshots. So now it has created a 61 00:02:50,460 --> 00:02:53,490 snapshot. So in case I mess up during 62 00:02:53,490 --> 00:02:56,160 this creating local repository and I 63 00:02:56,160 --> 00:02:58,740 need to report back to my original state 64 00:02:58,800 --> 00:03:00,510 which is right now that I could always 65 00:03:00,510 --> 00:03:03,564 come back to it. So now let's go ahead and power on. 66 00:03:03,564 --> 00:03:06,785 [No audio] 67 00:03:06,785 --> 00:03:08,700 Okay, so our machine has 68 00:03:08,700 --> 00:03:12,254 been started. So let's go ahead and become root. 69 00:03:12,254 --> 00:03:16,325 [No audio] 70 00:03:16,325 --> 00:03:18,090 Okay, so now you are 71 00:03:18,090 --> 00:03:20,100 creating a local repository. So what 72 00:03:20,100 --> 00:03:21,030 you're going to do is, you're going to 73 00:03:21,030 --> 00:03:23,760 take all the RPM, all the packages from 74 00:03:23,760 --> 00:03:27,660 your DVD, or CD ROM drive, which is a 75 00:03:27,660 --> 00:03:31,050 disk which has all your packages. So 76 00:03:31,050 --> 00:03:33,900 what you do is you go into these menu 77 00:03:33,900 --> 00:03:42,930 Devices, Optical Drives, Choose Disk and 78 00:03:42,930 --> 00:03:45,810 pick CentOS ISO image. So I have it 79 00:03:45,810 --> 00:03:48,960 saved on my Desktop. So just choose it 80 00:03:49,200 --> 00:03:52,650 and click Open. So now this should 81 00:03:52,680 --> 00:03:55,920 automatically mount your DVD to your 82 00:03:55,920 --> 00:03:58,560 Linux machine. See right away, a pop 83 00:03:58,560 --> 00:04:04,020 menu came up. And also if you notice, it 84 00:04:04,020 --> 00:04:08,790 will also create an icon on your Desktop 85 00:04:08,880 --> 00:04:10,770 saying this is disk this has been 86 00:04:10,800 --> 00:04:13,110 attached. So now we have it attached. 87 00:04:13,110 --> 00:04:15,270 How can we verify it on the command line? 88 00:04:15,270 --> 00:04:18,269 You do df -h, and you will see right 89 00:04:18,269 --> 00:04:22,560 here, the last row tells you that it is 90 00:04:23,459 --> 00:04:30,284 at /dev/sr0 and it is mounted on /run/media/iafzal/CentOS 7. 91 00:04:30,284 --> 00:04:35,850 So now if it is not mounted automatically, then 92 00:04:35,850 --> 00:04:39,330 you go run a command mount slash dev CD 93 00:04:39,330 --> 00:04:41,190 ROM and wherever you want it to be 94 00:04:41,190 --> 00:04:43,560 mounted. Anyway, since it's already 95 00:04:43,560 --> 00:04:47,010 mounted for us, now, the next step is 96 00:04:47,160 --> 00:04:51,060 where are you going to put all your 97 00:04:51,060 --> 00:04:53,280 packages? So you have to create a 98 00:04:53,280 --> 00:04:55,560 directory, right? So the directory I'm 99 00:04:55,560 --> 00:04:58,560 going to pick is let's go to slash, cd 100 00:04:58,560 --> 00:05:02,520 slash and underneath slash make a 101 00:05:02,520 --> 00:05:05,640 directory. Let's call a localrepo. 102 00:05:06,510 --> 00:05:07,740 It's just the name, we've got pick 103 00:05:07,740 --> 00:05:09,930 anything, you will pick seinfeld, george, 104 00:05:09,930 --> 00:05:12,000 kramer, whatever you that you like. So 105 00:05:12,000 --> 00:05:15,540 go ahead and hit enter do ls -ltr 106 00:05:15,540 --> 00:05:17,910 to verify it is there. Yes, the 107 00:05:17,910 --> 00:05:21,180 directory is there. Now I want you to 108 00:05:21,180 --> 00:05:24,750 copy all the contents, so do df -h 109 00:05:24,750 --> 00:05:27,360 to copy all the content of the disk. So 110 00:05:27,450 --> 00:05:32,672 do cd slash run slash media slash iafzal. 111 00:05:32,672 --> 00:05:35,850 Now as you notice, the name of this 112 00:05:35,880 --> 00:05:40,290 ISO image is CentOS space 7 space 113 00:05:40,350 --> 00:05:43,920 x86. Now Linux does not 114 00:05:43,920 --> 00:05:48,570 like spaces. So how are we going to put 115 00:05:48,570 --> 00:05:50,490 that in my path? So if I just put in 116 00:05:50,490 --> 00:05:59,040 CentOS 7 x86_64? See 117 00:05:59,040 --> 00:06:00,780 it says no such file or directory, then 118 00:06:00,780 --> 00:06:04,860 how? How can I make Linux understand 119 00:06:04,890 --> 00:06:07,920 that there are spaces? To do that, the 120 00:06:07,920 --> 00:06:09,990 best thing that I would tell you to do 121 00:06:10,020 --> 00:06:14,970 is do cd /run/media/iafzal. And 122 00:06:14,970 --> 00:06:18,090 when you are at this point on the fourth 123 00:06:18,120 --> 00:06:20,610 directory, subdirectory, then hit tab. 124 00:06:21,270 --> 00:06:24,120 And it will automatically pick the ISO 125 00:06:24,120 --> 00:06:27,780 image under the I have solved directory. 126 00:06:27,870 --> 00:06:31,380 So if you notice, it has backslash 127 00:06:31,380 --> 00:06:34,590 backslash, which is telling Linux that 128 00:06:34,620 --> 00:06:37,290 it there are spaces in it. So go ahead 129 00:06:37,290 --> 00:06:40,200 and hit enter. And now you are in that 130 00:06:40,200 --> 00:06:43,110 directory. do ls myself here and see 131 00:06:43,110 --> 00:06:45,900 what's inside of it. You see, there are 132 00:06:45,930 --> 00:06:49,230 a few directories and files, cd into 133 00:06:49,230 --> 00:06:52,560 packages. That's where all the RPM jar. 134 00:06:52,710 --> 00:06:54,540 If you do ls myself here, you'll see a 135 00:06:54,570 --> 00:06:59,370 bunch of RPMs in there. Okay, so if I 136 00:06:59,370 --> 00:07:02,010 wanted to see how many RPMs do I have, I 137 00:07:02,010 --> 00:07:07,170 could do ls minus of your pipe ID, WC 138 00:07:07,170 --> 00:07:09,990 minus l. And it's telling me there are 139 00:07:10,020 --> 00:07:17,850 3973 packages or RPMs that are that are 140 00:07:17,850 --> 00:07:20,370 coming within that DVD ISO image. Well, 141 00:07:20,370 --> 00:07:22,470 that's a lot. So it is kind of like a 142 00:07:22,800 --> 00:07:24,660 repository. So what we're going to do is 143 00:07:24,870 --> 00:07:26,640 you're going to copy all of these 144 00:07:26,640 --> 00:07:31,470 packages to our local drive that local 145 00:07:31,470 --> 00:07:33,270 folder that we just created. And the 146 00:07:33,630 --> 00:07:37,770 folder name is local repo, right. So now 147 00:07:37,770 --> 00:07:39,660 before you do that, also make sure that 148 00:07:39,660 --> 00:07:41,520 you have enough space in your Linux 149 00:07:41,520 --> 00:07:44,040 machine. So how do you find out first 150 00:07:44,040 --> 00:07:45,660 you are in that directory right 151 00:07:45,660 --> 00:07:50,040 packages, run the command d u minus S H 152 00:07:50,160 --> 00:07:52,890 and dot which telling it which asking 153 00:07:52,890 --> 00:07:54,600 the Linux machine give me this disk 154 00:07:54,600 --> 00:07:57,330 space of the current location of the 155 00:07:57,330 --> 00:08:00,270 directory that I'm in, hit enter is 156 00:08:00,270 --> 00:08:03,690 saying 3.7 game now do d f minus h and 157 00:08:03,690 --> 00:08:07,350 make sure your slash directory has that 158 00:08:07,620 --> 00:08:11,580 space empty Yes, we do have 4.4 159 00:08:11,580 --> 00:08:14,370 available so it's good. So now we could 160 00:08:14,370 --> 00:08:17,700 go ahead with the copying every package 161 00:08:17,700 --> 00:08:21,660 that we have in this location. The 162 00:08:21,660 --> 00:08:24,660 command I would choose to copy is copy 163 00:08:24,900 --> 00:08:31,500 everything from this directory.or You 164 00:08:31,500 --> 00:08:34,950 can specify the full path to run media. 165 00:08:35,490 --> 00:08:40,140 I have solved CentOS packages so you 166 00:08:40,140 --> 00:08:43,740 could do everything asterik because 167 00:08:43,740 --> 00:08:45,780 you're copying everything under packages 168 00:08:45,809 --> 00:08:53,220 to your local repo, hit Enter. Now it is 169 00:08:53,220 --> 00:08:57,060 going to copy every single RPM to the 170 00:08:57,060 --> 00:09:00,330 local report directory. This is going to 171 00:09:00,330 --> 00:09:01,680 take some time 172 00:09:18,030 --> 00:09:20,940 if you open up another window and then 173 00:09:20,940 --> 00:09:23,640 you go to CD to local repo and do ls 174 00:09:23,640 --> 00:09:27,240 minus L pipe it to WC minus L you will 175 00:09:27,240 --> 00:09:30,750 see the number of files being copied. So 176 00:09:30,750 --> 00:09:36,420 right now we have 14 180 files that have 177 00:09:36,420 --> 00:09:39,930 been copied we have to go up to 39 and 178 00:09:39,930 --> 00:09:41,790 something files to be copied 179 00:09:47,040 --> 00:09:48,810 Okay, all the RPMs have been copied 180 00:09:48,810 --> 00:09:50,940 successfully. Very good. So we have to 181 00:09:50,940 --> 00:09:52,800 tell Linux don't go outside we do have 182 00:09:52,800 --> 00:09:54,840 all the packages locally. So how do we 183 00:09:54,840 --> 00:09:58,680 define that? So there are files in Apt 184 00:09:58,680 --> 00:10:04,230 See ya On da repose dot deep these are 185 00:10:04,230 --> 00:10:06,630 all the files that tells the Linux to go 186 00:10:06,630 --> 00:10:09,090 to these different mirrors so what are 187 00:10:09,090 --> 00:10:12,240 we going to do is we're going to remove 188 00:10:12,270 --> 00:10:17,880 everything in here now again before you 189 00:10:17,880 --> 00:10:19,890 remove that please make sure you do have 190 00:10:19,890 --> 00:10:21,780 a snapshot if you delete all of these 191 00:10:21,780 --> 00:10:23,640 packages and you do not have the 192 00:10:23,640 --> 00:10:26,040 snapshot then you won't be able to go to 193 00:10:26,100 --> 00:10:28,890 internet and download the packages 194 00:10:28,890 --> 00:10:29,910 through yum commands 195 00:10:38,940 --> 00:10:40,710 okay, everything is gone. Now go ahead 196 00:10:40,710 --> 00:10:44,190 and create a new repo here, call it 197 00:10:44,190 --> 00:10:51,600 local dot repo and add these values 198 00:10:57,660 --> 00:11:00,000 CentOS seven is just telling me that 199 00:11:00,000 --> 00:11:01,980 these are positive for CentOS seven 200 00:11:01,980 --> 00:11:10,410 name, sent OS seven. Base URL. This is 201 00:11:10,410 --> 00:11:14,820 what matters file slash slash slash 202 00:11:14,940 --> 00:11:19,560 local read local repo. This is the 203 00:11:21,150 --> 00:11:23,910 directory that we created in slash that 204 00:11:23,910 --> 00:11:26,640 will always start with two slashes, then 205 00:11:26,640 --> 00:11:28,410 the third slash will local repo 206 00:11:28,410 --> 00:11:34,350 directory. Enable. And one two if you 207 00:11:34,350 --> 00:11:42,270 want to make it enable GPG check zero. 208 00:11:43,230 --> 00:11:45,420 These are some of the default values you 209 00:11:45,420 --> 00:11:49,830 have to put in to that file. Go ahead 210 00:11:49,830 --> 00:11:54,990 and save it once that is saved. Now 211 00:11:54,990 --> 00:11:59,220 we'll run the command create repo. And 212 00:11:59,220 --> 00:12:02,160 where is my repo local repo, you hit 213 00:12:02,190 --> 00:12:04,530 enter now it's actually what it's doing 214 00:12:04,530 --> 00:12:06,690 is it's actually going to that local 215 00:12:06,690 --> 00:12:09,900 repo directory and it's saying hey, I 216 00:12:09,900 --> 00:12:13,590 have 303,009 or 71 packages, I'm going 217 00:12:13,590 --> 00:12:15,510 to make them available to my local 218 00:12:15,510 --> 00:12:23,580 machine as a repository. The Create repo 219 00:12:23,580 --> 00:12:26,940 had created the database that will be 220 00:12:26,940 --> 00:12:29,610 available to our jump command. Now go 221 00:12:29,610 --> 00:12:32,910 ahead and create a jump clean, run this 222 00:12:32,910 --> 00:12:35,430 command jump clean all this is going to 223 00:12:35,460 --> 00:12:38,580 clear out any cash from the old 224 00:12:38,580 --> 00:12:45,150 repository. Go ahead and run jump repo 225 00:12:45,180 --> 00:12:51,300 list all this should tell me my full 226 00:12:51,300 --> 00:12:53,640 list of repositories. There you go. So 227 00:12:53,640 --> 00:12:55,590 we have a repo list that has a total 228 00:12:55,590 --> 00:12:59,640 package of 3971 these are the exact same 229 00:12:59,640 --> 00:13:02,460 number of RPMs Riad, remember and it 230 00:13:02,460 --> 00:13:05,460 telling you the size. The report ID the 231 00:13:05,460 --> 00:13:07,290 center was is the name that we picked 232 00:13:07,350 --> 00:13:12,240 and that RPM dot d directory file. Now 233 00:13:12,240 --> 00:13:14,340 you could test it by running the command 234 00:13:14,340 --> 00:13:17,460 yum install. Now what do we want to 235 00:13:17,460 --> 00:13:25,650 install? Just for test type Tomcat. It's 236 00:13:25,650 --> 00:13:27,840 going to go into their repository and 237 00:13:27,840 --> 00:13:29,880 check if it has a packages that matches 238 00:13:29,880 --> 00:13:33,480 Tomcat. Okay, perfect. It did find that 239 00:13:33,480 --> 00:13:36,240 package and this is basically how you 240 00:13:36,240 --> 00:13:38,550 create a local repository. Now the 241 00:13:38,550 --> 00:13:40,710 system is not going out on the internet 242 00:13:40,860 --> 00:13:43,140 or to your Red Hat Satellite. It is 243 00:13:43,140 --> 00:13:45,660 actually going to your local repository 244 00:13:45,660 --> 00:13:48,240 which is sitting within your Linux 245 00:13:48,240 --> 00:13:51,780 machine. So if you are following this, 246 00:13:51,990 --> 00:13:56,670 then go ahead and delete the local repo 247 00:13:56,790 --> 00:13:59,610 repo directory that we created and 248 00:13:59,640 --> 00:14:03,360 revert back to our snapshot. Good luck. 249 00:14:03,360 --> 00:14:04,459 [No audio]