1 00:00:00,120 --> 00:00:01,440 Hello the beautiful people. 2 00:00:01,440 --> 00:00:05,250 And welcome to this video where we're going to be talking about how you can download the source code 3 00:00:05,250 --> 00:00:06,150 for packages. 4 00:00:06,150 --> 00:00:10,770 So at the minute, all we've been able to do is download and install pre compiled binary packages, 5 00:00:10,770 --> 00:00:14,760 but we're interested in how we might be able to go about getting source code so that we can exercise 6 00:00:14,760 --> 00:00:16,800 the freedoms that free software gives us. 7 00:00:16,890 --> 00:00:18,630 It's actually a very easy process. 8 00:00:18,630 --> 00:00:22,320 In order to do so, all you've got to do is as an administrator. 9 00:00:22,320 --> 00:00:29,640 So with the sudo command open up in nano, the slash etsy slash apt slash sources list file. 10 00:00:30,180 --> 00:00:34,410 Now in here, when you enter your password, you're going to be opening up a configuration file that 11 00:00:34,410 --> 00:00:39,960 your package manager uses to determine which repositories in which package files it downloads, in other 12 00:00:39,960 --> 00:00:42,330 words, which sources it downloads. 13 00:00:42,330 --> 00:00:42,710 Okay. 14 00:00:42,720 --> 00:00:48,300 So what we're going to do in here is you'll notice that there are lines that start with Deb Source or 15 00:00:48,300 --> 00:00:52,530 Deb Dash CRC, and those lines have a hash in front of them. 16 00:00:52,530 --> 00:00:56,640 What I want you to do is I want you to just delete all those hashes on those appropriate lines. 17 00:00:57,720 --> 00:01:03,060 And what this will do is it will activate the ability for your package manager to be able to download 18 00:01:03,060 --> 00:01:08,250 source code, which is deactivated by default just to save efficiency, basically. 19 00:01:08,250 --> 00:01:09,060 So there we are. 20 00:01:09,060 --> 00:01:09,810 I've gone ahead and done that. 21 00:01:09,810 --> 00:01:11,700 I'm going to press control on oh, to save the file. 22 00:01:12,060 --> 00:01:14,220 I press x control at X to exit. 23 00:01:15,210 --> 00:01:20,850 So now what we've done is we've said to the package manager, Hey, why don't you go ahead and download 24 00:01:20,850 --> 00:01:25,010 the, the package lists that contains source code, okay? 25 00:01:25,020 --> 00:01:29,160 But to be able to get those things in the cache, we've got to update our cache. 26 00:01:29,400 --> 00:01:35,220 So all we've got to do now is do sudo apt get update and it's going to go ahead and start downloading 27 00:01:35,220 --> 00:01:37,710 all the source packages here. 28 00:01:37,710 --> 00:01:42,810 So you can see that this is is installing all the source packages into our cache. 29 00:01:42,870 --> 00:01:48,540 This is a very useful thing because now we can we're almost ready to be able to download source code. 30 00:01:48,600 --> 00:01:48,870 Okay. 31 00:01:48,990 --> 00:01:54,570 So before we can download source code, we need to install one more package which is so if we do sudo 32 00:01:54,570 --> 00:01:57,420 app get install, it's going to be the DX package, dash dev package. 33 00:01:57,420 --> 00:02:01,470 So dpkg dash dev, you install that you type. 34 00:02:01,470 --> 00:02:01,770 Yes. 35 00:02:01,770 --> 00:02:02,760 When it asks you. 36 00:02:04,960 --> 00:02:05,540 And there we are. 37 00:02:05,560 --> 00:02:10,810 We've managed to now it's going to go ahead and download and unpack that package and now we can go ahead 38 00:02:10,810 --> 00:02:11,670 and install source code. 39 00:02:11,680 --> 00:02:12,730 It's literally that simple. 40 00:02:12,940 --> 00:02:15,040 So we've been messing around with the X's package. 41 00:02:15,070 --> 00:02:18,520 Let me head over to the desktop and we've been messing around with the X's package. 42 00:02:18,520 --> 00:02:22,490 So how can we get the source code for the for the XYZ package or the XYZ program? 43 00:02:22,510 --> 00:02:24,940 Well, it's contained in the X11 apps package. 44 00:02:24,940 --> 00:02:28,990 So if we do sudo apt get and we used to do install, right. 45 00:02:28,990 --> 00:02:31,270 We do install X11 apps. 46 00:02:31,270 --> 00:02:31,750 Right. 47 00:02:31,750 --> 00:02:34,060 And that's how you'd get the pre compiled binary version. 48 00:02:34,060 --> 00:02:38,590 But if you want to get the source code instead of instead of install, just put source and you'll see 49 00:02:38,590 --> 00:02:42,130 that it goes ahead and downloads these packages that contain source code. 50 00:02:42,220 --> 00:02:46,090 Now we can actually go ahead and enter these using CD. 51 00:02:46,120 --> 00:02:51,850 So if we seed into the package and take a look around, we can see that there's a folder here for X 52 00:02:51,850 --> 00:02:52,300 ize. 53 00:02:52,300 --> 00:02:59,500 And if we take a look in X ISE as a CD X EIS, we'll be able to see in here that we've got the source 54 00:02:59,500 --> 00:03:01,000 code for the XYZ program. 55 00:03:01,000 --> 00:03:05,560 So you can see we've got a config file that we can use to configure our new C compiler. 56 00:03:05,560 --> 00:03:12,190 But what we're interested in right now is this XYZ C, which is actually the source code for the XYZ 57 00:03:12,190 --> 00:03:12,580 program. 58 00:03:12,580 --> 00:03:16,330 And we can take a look in here and read the source code for the XYZ program. 59 00:03:16,330 --> 00:03:17,880 It's literally that simple. 60 00:03:17,890 --> 00:03:18,330 Okay. 61 00:03:18,340 --> 00:03:25,660 All we had to do was go ahead and change our slash slash app, slash sources, list, file, and in 62 00:03:25,660 --> 00:03:31,180 here, just uncomment all the lines that had that had a hash in front of them for DB source. 63 00:03:31,180 --> 00:03:35,080 And those are the repositories that allow you to actually download source code. 64 00:03:35,080 --> 00:03:41,170 So if you uncomment all of those and that update your cache using pseudo app, get update, then once 65 00:03:41,170 --> 00:03:48,340 you've downloaded all the new lists, all you've got to do is install the is, install the dpkg dev 66 00:03:48,340 --> 00:03:53,710 package and then you're good to go from now on if you ever want to download any source code. 67 00:03:54,010 --> 00:04:00,550 What you got to do is sudo apt get source and then a package name and that is all you need to know in 68 00:04:00,550 --> 00:04:02,500 order to be able to download and play around with source code. 69 00:04:02,500 --> 00:04:07,390 But one thing that you should bear in mind is that if you go into these source code packages and you 70 00:04:07,390 --> 00:04:09,820 actually compile them, you'll lose the ability to install them. 71 00:04:09,820 --> 00:04:12,940 That way you'll lose the ability to keep them updated with your package manager. 72 00:04:12,940 --> 00:04:19,269 So therefore, if you have the choice to install a package through the package manager or install it 73 00:04:19,269 --> 00:04:22,960 from source, make sure that you install it through the package manager and through the repositories 74 00:04:22,960 --> 00:04:24,430 rather than compiling it yourself. 75 00:04:24,430 --> 00:04:30,370 But this is a really cool way to be able to go ahead and take a look at how code works and maybe incorporate 76 00:04:30,370 --> 00:04:31,630 it in your projects.