server-scripts/jessie-server-common.sh

54 lines
1.8 KiB
Bash
Raw Normal View History

2016-03-15 21:51:50 +01:00
#!/bin/bash
set -e
function main {
echo "Setup best practice default repositories, see http://httpredir.debian.org/"
tee /etc/apt/sources.list <<EOF
deb http://httpredir.debian.org/debian jessie main contrib
deb http://httpredir.debian.org/debian jessie-updates main contrib
deb http://httpredir.debian.org/debian jessie-backports main contrib
deb http://security.debian.org/ jessie/updates main
2016-03-15 21:53:21 +01:00
EOF
2016-03-15 21:51:50 +01:00
apt update
echo "Install important system tools."
2016-03-15 22:03:21 +01:00
apt install -y htop ne iotop curl wget zsh figlet iptraf
2016-03-15 21:51:50 +01:00
echo "Use zsh!"
2016-03-15 22:03:21 +01:00
wget -O /root/.zshrc http://git.grml.org/f/grml-etc-core/etc/zsh/zshrc
2016-03-18 21:48:13 +01:00
tee -a /root/.zshrc << EOF
export LS_COLORS="*=00;37:rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:"
RED="$(tput setaf 1)"
ORANGE="$(tput setaf 3)"
BLUE="$(tput setaf 4)"
BLACK="$(tput sgr0)"
alias ls='/bin/ls -h --color=auto'
alias l='/bin/ls -lh --color=yes | sed -e "s/ \([0-9,.]\+K\) / ${BLUE}\1${BLACK} /g" -e "s/ \([0-9.,]\+G\) / ${RED}\1${BLACK} /g" -e "s/ \([0-9.,]\+M\) / ${ORANGE}\1${BLACK} /g"'
alias ll='/bin/ls -Alh --color=yes | sed -e "s/ \([0-9,.]\+K\) / ${BLUE}\1${BLACK} /g" -e "s/ \([0-9.,]\+G\) / ${RED}\1${BLACK} /g" -e "s/ \([0-9.,]\+M\) / ${ORANGE}\1${BLACK} /g"'
EOF
2016-03-15 21:51:50 +01:00
chsh -s /bin/zsh
2016-03-15 23:26:31 +01:00
( exec ne /etc/hostname /etc/hosts )
hostname -F /etc/hostname
2016-03-15 23:10:04 +01:00
2016-03-15 21:51:50 +01:00
echo "Nice motd."
2016-03-15 23:26:31 +01:00
figlet `hostname -f | sed 's/\./ \. /'` > /etc/motd
2016-03-15 21:51:50 +01:00
echo "Install system and security utils."
2016-03-15 22:46:49 +01:00
apt install -y systemd-cron apticron ssmtp logwatch
2016-03-15 23:10:04 +01:00
2016-03-15 23:26:31 +01:00
( exec ne /etc/ssmtp/* )
2016-03-18 21:48:13 +01:00
echo "Disable unneeded getty"
2016-03-18 21:49:07 +01:00
for i in {4..6} do;
2016-03-18 21:48:13 +01:00
systemctl stop getty@tty$i.service
systemctl disable getty@tty$i.service
2016-03-18 21:49:07 +01:00
done
2016-03-18 21:48:13 +01:00
2016-03-15 21:51:50 +01:00
}
main