The way it works is the server at Community Computer Center, goes out to the official package and release servers and downloads the latest updates, that way when I, or anyone else wants to download updates, our computers simply have to download from the CCC server over the lan, which makes the download about ten times faster.
(Editorial Note: If you haven't set up apt-cacher-ng yet, follow this post first.)
The only downside is whenever I want to download the updates and I'm not at CCC, I have to go and edit the hosts file in /etc, so I wrote a perl script to cut down on the steps.
Copy the code into a text file and save it as a .pl, then to use, type sudo perl yourfile.pl.
While this is not the most elegant solution, it was my first attempt at using perl, enjoy.
#!usr/bin/perl -w
#script by @robots_unix
{
print "Are you at CCC?";
$name =;
chomp ($name);
if ($name eq "yes"){ #When I'm at CCC
open(INFILE, '>/etc/hosts');
print INFILE "127.0.0.1 localhost
127.0.1.1 uname
apt-cacher_ip apt-cacher
#127.0.0.1 apt-cacher
apt-cacher_ip server name
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts\n";
close(INFILE);
}else{ #When I'm not at CCC
open(INFILE, '>/etc/hosts');
print INFILE "127.0.0.1 localhost
127.0.1.1 uname
#apt-cacher_ip apt-cacher
127.0.0.1 apt-cacher
apt-cacher_ip servername
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts\n";
close(INFILE);
}
}
Copy the code into a text file and save it as a .pl, then to use, type sudo perl yourfile.pl.
While this is not the most elegant solution, it was my first attempt at using perl, enjoy.
#!usr/bin/perl -w
#script by @robots_unix
{
print "Are you at CCC?";
$name =
chomp ($name);
if ($name eq "yes"){ #When I'm at CCC
open(INFILE, '>/etc/hosts');
print INFILE "127.0.0.1 localhost
127.0.1.1 uname
apt-cacher_ip apt-cacher
#127.0.0.1 apt-cacher
apt-cacher_ip server name
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts\n";
close(INFILE);
}else{ #When I'm not at CCC
open(INFILE, '>/etc/hosts');
print INFILE "127.0.0.1 localhost
127.0.1.1 uname
#apt-cacher_ip apt-cacher
127.0.0.1 apt-cacher
apt-cacher_ip servername
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts\n";
close(INFILE);
}
}