Every guide below will assume you have a fresh install of Debian x64 8.7.1 netinst.
Before starting If you want to mirror just the “main contrib non-free” you will need minimum 120GB of storage space.
apt-get install apt-mirror apache2 screen
Setup and Start Apt-Mirror
nano /etc/apt/mirror.list
############# config ##################
#
# set base_path /var/spool/apt-mirror
#
# set mirror_path $base_path/mirror
# set skel_path $base_path/skel
# set var_path $base_path/var
# set cleanscript $var_path/clean.sh
# set defaultarch <running host architecture>
# set postmirror_script $var_path/postmirror.sh
# set run_postmirror 0
set nthreads 20
set _tilde 0
#
############# end config ##############
deb http://deb.debian.org/debian stretch main contrib non-free
deb-src http://deb.debian.org/debian stretch main contrib non-free
clean http://ftp.us.debian.org/debian
At this point we will begin the mirror process this will download 100+ GB of data to your system. This will start in a screen window to see the progress run screen -r
screen -dmS downloadingmirror apt-mirror /etc/apt/mirror.list
Once the process is completed continue to the next part.
Setup Apache2
Now we have to edit Apache 2 to show the files properly.
We will disable the default apache2 website.
a2dissite 000-default.conf
service apache2 reload
Now we will add the new website pre configured for the mirror.
nano /etc/apache2/sites-available/apt-mirror.conf
<VirtualHost *:80>
DocumentRoot /var/www
</VirtualHost>
Start the new website.
a2ensite apt-mirror.conf
Reload apache2
service apache2 reload
Remove junk that we don’t need
cd /var/www
rm -r html
Setup Apache2 To Expose Mirror Files
ln -s /var/spool/apt-mirror/mirror/ftp.us.debian.org/debian /var/www/debian
Setup a Client to use our new Mirror
nano /etc/apt/sources.list
deb http://192.168.1.5/debian/ jessie main contrib non-free
deb-src http://192.168.1.5/debian/ jessie main contrib non-free
#security updates
deb http://security.debian.org/ jessie/updates main
deb-src http://security.debian.org/ jessie/updates main
Was this helpful?
0 / 0