Hello the beautiful people.
And welcome to this video where we're going to be talking about how you can download the source code
for packages.
So at the minute, all we've been able to do is download and install pre compiled binary packages,
but we're interested in how we might be able to go about getting source code so that we can exercise
the freedoms that free software gives us.
It's actually a very easy process.
In order to do so, all you've got to do is as an administrator.
So with the sudo command open up in nano, the slash etsy slash apt slash sources list file.
Now in here, when you enter your password, you're going to be opening up a configuration file that
your package manager uses to determine which repositories in which package files it downloads, in other
words, which sources it downloads.
Okay.
So what we're going to do in here is you'll notice that there are lines that start with Deb Source or
Deb Dash CRC, and those lines have a hash in front of them.
What I want you to do is I want you to just delete all those hashes on those appropriate lines.
And what this will do is it will activate the ability for your package manager to be able to download
source code, which is deactivated by default just to save efficiency, basically.
So there we are.
I've gone ahead and done that.
I'm going to press control on oh, to save the file.
I press x control at X to exit.
So now what we've done is we've said to the package manager, Hey, why don't you go ahead and download
the, the package lists that contains source code, okay?
But to be able to get those things in the cache, we've got to update our cache.
So all we've got to do now is do sudo apt get update and it's going to go ahead and start downloading
all the source packages here.
So you can see that this is is installing all the source packages into our cache.
This is a very useful thing because now we can we're almost ready to be able to download source code.
Okay.
So before we can download source code, we need to install one more package which is so if we do sudo
app get install, it's going to be the DX package, dash dev package.
So dpkg dash dev, you install that you type.
Yes.
When it asks you.
And there we are.
We've managed to now it's going to go ahead and download and unpack that package and now we can go ahead
and install source code.
It's literally that simple.
So we've been messing around with the X's package.
Let me head over to the desktop and we've been messing around with the X's package.
So how can we get the source code for the for the XYZ package or the XYZ program?
Well, it's contained in the X11 apps package.
So if we do sudo apt get and we used to do install, right.
We do install X11 apps.
Right.
And that's how you'd get the pre compiled binary version.
But if you want to get the source code instead of instead of install, just put source and you'll see
that it goes ahead and downloads these packages that contain source code.
Now we can actually go ahead and enter these using CD.
So if we seed into the package and take a look around, we can see that there's a folder here for X
ize.
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
code for the XYZ program.
So you can see we've got a config file that we can use to configure our new C compiler.
But what we're interested in right now is this XYZ C, which is actually the source code for the XYZ
program.
And we can take a look in here and read the source code for the XYZ program.
It's literally that simple.
Okay.
All we had to do was go ahead and change our slash slash app, slash sources, list, file, and in
here, just uncomment all the lines that had that had a hash in front of them for DB source.
And those are the repositories that allow you to actually download source code.
So if you uncomment all of those and that update your cache using pseudo app, get update, then once
you've downloaded all the new lists, all you've got to do is install the is, install the dpkg dev
package and then you're good to go from now on if you ever want to download any source code.
What you got to do is sudo apt get source and then a package name and that is all you need to know in
order to be able to download and play around with source code.
But one thing that you should bear in mind is that if you go into these source code packages and you
actually compile them, you'll lose the ability to install them.
That way you'll lose the ability to keep them updated with your package manager.
So therefore, if you have the choice to install a package through the package manager or install it
from source, make sure that you install it through the package manager and through the repositories
rather than compiling it yourself.
But this is a really cool way to be able to go ahead and take a look at how code works and maybe incorporate
it in your projects.