Mint repo server setup
Recently I successfully created a Linux Mint local repo server. Below are the steps to create and sync the repo server.
Step 1
Create a Linux mint server with Static IP / DNS and with at least 150 GB disk space. There are lots of tutorials on that, I won’t go through the steps.
Step 2
Install apache webserver and apt mirror packages
sudo apt install apache2 apt-mirror
Step 3
Now, create a directory to save all packages. I’m calling it “/repo”.
sudo mkdir /repo
Step 4
Edit the apt-mirrors configuration file . The ones highlighted in bold are changed. If you want you can replace the complete file with the one below.
Since this repo will serve both 32bit and 64bit machines, I’ve explicitly mentioned the repos for both.
sudo 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 base_path /repo set nthreads 20 set _tilde 0 # ############# end config ############## deb-amd64 http://archive.ubuntu.com/ubuntu xenial main restricted universe multiverse deb-amd64 http://archive.ubuntu.com/ubuntu xenial-security main restricted universe multiverse deb-amd64 http://archive.ubuntu.com/ubuntu xenial-updates main restricted universe multiverse deb-i386 http://archive.ubuntu.com/ubuntu xenial main restricted universe multiverse deb-i386 http://archive.ubuntu.com/ubuntu xenial-security main restricted universe multiverse deb-i386 http://archive.ubuntu.com/ubuntu xenial-updates main restricted universe multiverse clean http://archive.ubuntu.com/ubuntu deb-i386 http://packages.linuxmint.com/ sonya main upstream import deb-amd64 http://packages.linuxmint.com/ sonya main upstream import
Step 5
Sync the repo. Download time will depend on the internet speed.
sudo apt-mirror
The output will be like this
Downloading 354 index files using 20 threads...
Begin time: Wed Nov 29 13:25:21 2017
[20]... [19]... [18]... [17]... [16]... [15]... [14]... [13]... [12]... [11]... [10]... [9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]... [1]... [0]...
End time: Wed Nov 29 13:29:27 2017
Step 6
To automatically sync in the background, enable the cronjob. To do so, edit the file below.
sudo nano /etc/cron.d/apt-mirror
Remove # from the line in bold, save and exit.
# # Regular cron jobs for the apt-mirror package # 0 4 * * * apt-mirror /usr/bin/apt-mirror > /var/spool/apt-mirror/var/cron.log
Step 7
This step is very important. Make sure you do this change. Change the Document Root to /var/www in apache config file.
/etc/apache2/sites-enabled/000-default.conf
Once done, restart the apache server and check the status
service apache2 restart
service apache2 status
service apache2 status ● apache2.service - LSB: Apache2 web server Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled) Drop-In: /lib/systemd/system/apache2.service.d └─apache2-systemd.conf Active: active (running) since Wed 2017-11-29 13:03:48 IST; 3s ago Docs: man:systemd-sysv-generator(8) Process: 24829 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS) Process: 20682 ExecReload=/etc/init.d/apache2 reload (code=exited, status=0/SUCCESS) Process: 24852 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS) CGroup: /system.slice/apache2.service ├─24869 /usr/sbin/apache2 -k start ├─24872 /usr/sbin/apache2 -k start └─24873 /usr/sbin/apache2 -k start
Step 8
Once all the packages are downloaded link the repo folders to apache webserver. Use simple names so that its easy to remember when troubleshooting.
cd /var/www
ln -s /repo/mirror/archive.ubuntu.com/ubuntu/ ubuntu
ln -s /repo/mirror/packages.linuxmint.com/ mint
ln -s /repo/mirror/security.ubuntu.com/ubuntu/ security
ln -s /repo/mirror/archive.canonical.com/ubuntu/ archives
You should be able to view the repos from the web browser if you do http://ip.of.web.server/ubuntu.
That’s all. Server is setup. Now, lets add the files to the mint client.
Client side setup
Edit the file /etc/apt/sources.list.d/official-package-repositories.list
sudo nano /etc/apt/sources.list.d/official-package-repositories.list
Comment out the existing lines and add the following
deb http://ip.of.web.server/mint sonya main upstream import backport deb http://ip.of.web.server/ubuntu xenial main restricted universe multiverse deb http://ip.of.web.server/security xenial-security main restricted universe multiverse deb http://ip.of.web.server/archives xenial partner
Save the file and then run the update.
apt clean && apt update
Leave a Reply