Hello in this video I'm going to be talking about apt-cacher-ng
Which is an apt caching system for ubuntu debian and other systems that use the apt
Package manager to get started I have I'm on a Synology Diskstation and I'm in the virtual machine manager
And I've set up a couple virtual machines in here. And if you're not familiar virtual machines that are sent you like
Actual computers, but they run inside of another computer and to have another video on setting up a virtual machine on this system
I'll put a link below to that I have for virtual machines here
But we can ignore the top one that top one is my day-to-day caching system, but for this demonstration
I'm setting one up from scratch
So that's the apt-cacher-ng server and then I have client 1 and client 2
so I'll switch over to my terminal here and
the top one is the server and the bottom tool will be that will be the clients and I'm logged into these servers and
I'll install the apt-cacher-ng saw I'll start by typing sudo space apt
space install space
apt-cacher-ng
and I'll hit enter
I'll type in my password and
Then it will install the packages
Ok, so that that's installed
Now we want to go to the IP address of this
Server and I have it up here in my terminal. You can also type IP space a and
see the IP address so we have it here and we'll take that and we'll go into a browser and
We'll paste that in and go to port 31 42
Which is the port that the apt-cacher-ng is running on so here we have some
Instructions on setting up apt-cacher-ng so I'll pull up terminal up
I'll move to this this to the side here
so I'll go into one of my clients here and
I want to to create a file that looks like this. It's /etc/apt/apt.conf.d
/00aptproxy. So I'll copy that I'll go into my first client. I'll say sudo nano
And then use that path and I'm going to do that on both servers
on both clients
Okay, so now I'm I have that file open and I want to paste in this
here and this already has the IP address of the
Caching system on here. So I'll paste that in both places and I will save that. So I'll type ctrl o
enter control X control
O enter control X. And now if we look at this page if you scroll down a little bit more
It has some other methods on how to connect
I like to use this method and then under related links that says statistics report and configuration page
So if you click on that, you'll see
Statistics on apt-cacher-ng server and there's nothing on there because I haven't used it yet
Now that we have this set up we have the server running on the server. We have the two clients set up
I will type sudo Act
update on each of those
sudo apt
update
Okay, and if we go to the server we can type in tale space - F space forward slash bar
forward slash log forward apt-cacher-ng with the dashes in there and
then let's see it be apt-cacher-ng
Log, if we type that in it will show us the log
So this is showing us the caching that it's doing here. If we go to client one we can say sudo
apt
Install and I'll say nodejs
And it will ask us if we want to download these packages and I'll say yes
So you'll see activity here on the
the apt-cacher
and
Then if we go into the statistics page, we should see some activity
It says, you know how much data was fetched and how much was served and then you can click on this
Here to look at the cache efficiency, you know, it just started this up. So it's not going to have anything
So if we go to the second client now and say sudo
apt install nodejs
And we say yes
then we'll see this on the
Log file, it's downloading those files from the cache as opposed to downloading them from the internet since it's the second time we're downloading
So where this could be useful is if you have a lab with say, you know
20 or 30 Linux machines that are doing updates on a regular basis
If you put a cache in there
It will pull the most of the updates from the cache and it'll cut down your bandwidth and it also be faster. So
You can also do this if you're testing a lot of things. That's when I've mostly used it
Say you're testing a build of a ubuntu machine you screw up. You want to start over
Well, you don't want to have to download all those updates again. You can use the cache
so when you start over it'll pull those updates locally if we go back to our
Page here, we can refresh and now we can see that the data fetched was
5.7 megabytes, and the data served is 11 because it
Installed it on two machines
You know it's essentially
Cut the bandwidth in half. So if you had a lot of machines you're gonna see this data served go up
That's where you see your efficiency. So that's the basics of installing and using the apt-cacher-ng
So if you have any questions, please leave them in the comments
If you like this video, please click like if you haven't subscribed my channel
I would appreciate if you could do that and thanks for watching until next time. Goodbye