#!/bin/sh

wget -O - http://backports.org/debian/archive.key | apt-key add -
wget -O - http://kernel-archive.buildserver.net/key|apt-key add -

cat <<E_O_APT > /etc/apt/sources.list
# /etc/apt/sources.list - Package resource list for APT
#
deb http://cache:3142/debian etch main contrib non-free
deb http://cache:3142/debian-security stable/updates main contrib non-free
deb http://cache:3142/www.backports.org/debian etch-backports main contrib non-free
#debian kernels
deb http://cache:3142/kernel-archive.buildserver.net/debian-kernel trunk main

E_O_APT

apt-get update
apt-get -y install lftp less vim procinfo ssh links-ssl screen bzip2
apt-get -y dist-upgrade
> /etc/motd.tail

cat <<E_O_SYSCTL >> /etc/sysctl.conf
# TCP TUNING
# increase TCP max buffer size setable using setsockopt()
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
# increase Linux autotuning TCP buffer limits
# min, default, and max number of bytes to use
# set max to at least 4MB, or higher if you use very high BDP paths
net.ipv4.tcp_rmem = 4096 87380 16777216 
net.ipv4.tcp_wmem = 4096 65536 16777216

# don't cache ssthresh from previous connection
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.tcp_moderate_rcvbuf = 1
# recommended to increase this for 1000 BT or higher
net.core.netdev_max_backlog = 2500
# for 10 GigE, use this
# net.core.netdev_max_backlog = 30000 
# END TCP TUNING
E_O_SYSCTL

sysctl -p

#change default editor to vim
cd /etc/alternatives/
ln -sf /usr/bin/vim.basic editor
ln -sf /usr/share/man/man1/vim.1.gz editor.1.gz

