New Mirror Installation

From CSLabsWiki

This is the installation guide for Mirror as done in April 2016.

Initial Setup

  • Install Debian from netinst, 64 bits obviously.
  • Make sure all of the drives are recognized.

Install the following:

apt install sudo vim git resolvconf

Remove the following to fix resolv.conf only filling with IPv6 addresses for nameservers.

apt remove rdnssd

Edit /etc/sysctl.conf to disable IPv6 (derpyness)

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
net.ipv6.conf.eth0.disable_ipv6 = 1
net.ipv6.conf.eth1.disable_ipv6 = 1

Edit /etc/hosts.allow to only permit logon from inside of COSI ..

sshd: 128.153.145. 128.153.144.

.. and /etc/hosts.deny to prohibit outside logon.

sshd: ALL

Edit /etc/default/grub to fix graphics, so that we do the resolution of the KVM after bios.


Install debian-zfs:

apt install lsb-release
dpkg -i zfsonlinux_6_all.deb
apt update
apt install debian-zfs

ZFS Config

After installing zfsonlinux, to create a zpool named "zoodle" with a RAID10-like configuration, run the following command:

zpool create -f -m /storage zoodle mirror <2tbdrive1> <2tbdrive2> mirror <4tbdrive1> <4tbdrive2> ... 

This should be done using /dev/disk/by-path nodes, but this may fail. If it fails, use /dev/sdX devices. Then, run the following two commands to reassign the pool to use by-path:

zpool export zoodle
zpool import -d /dev/disk/by-path zoodle

Apache Webserver

Install apache

apt install apache2

Bump up the MaxKeepAliveRequests in apache2.conf:

MaxKeepAliveRequests 1000

Add webmasters to the www-data group

sudo adduser <USER> www-data

Allow read and write access of /var/www to the www-data group

sudo chown -R www-data:www-data /var/www
sudo chmod -R g+rwX /var/www

Download the COSI-Lab/Mirror2016 repository into your home directory and run the script. It will create a dist/ directory and you will want to copy the contents into /var/www

git clone
cd Mirror2016
cp -r dist/* /var/www/

Then whenever you want to link a distro into the site through HTTP, symlink the directory to /var/www as shown below

sudo ln -s /storage/<dir> /var/www

Network Traffic Graphs

copy from the Mirror2016/ repository into /usr/local/mirrorscripts/ and create a systemd-timer and service that will run that script every 3 hours starting at midnight. put the two scripts below into /etc/systemd/system/


Description=Generate graphs for stats page



Description=Generate graphs for stats page every 3 hours starting at 00:00

OnCalendar=*-*-* 0/3:00:00


Then reload the daemons, enable the timer, and start the timer

# systemctl daemon-reload
# systemctl enable creategraphs.timer
# systemctl start creategraphs.timer