===== Staging nouveau serveur Debian Jessie =====
=== Fichier /etc/ssh/sshd_config ===
vi /etc/ssh/sshd_config
change "Port 22" if needed
add "PermitRootLogin yes"
service sshd stop
service sshd start
apt-get update
apt-get upgrade
apt-get dist-upgrade
==== un peu de couleurs et d'alias pour ls ====
cp -a /root/.bashrc /root/.bashrc_
sed -i "s/# export LS_OPTIONS/export LS_OPTIONS/g" /root/.bashrc
sed -i "s/# eval \"\`dircolors\`\"/eval \"\`dircolors\`\"/g" /root/.bashrc
sed -i "s/# alias ls=/alias ls=/g" /root/.bashrc
sed -i "s/# alias ll=/alias ll=/g" /root/.bashrc
sed -i "s/# alias l=/alias l=/g" /root/.bashrc
. /root/.bashrc
==== installation des outils de base ====
apt-get update
apt-get install vim sysstat atop jnettop htop less iotop screen bootlogd
==== tuning vim pour coloration syntaxique ====
cp -a /etc/vim/vimrc /etc/vim/vimrc_
sed -i "s/\"syntax on/syntax on/g" /etc/vim/vimrc
update-alternatives --set 'editor' "$(command -v 'vim.basic')"
==== tuning stack IP ====
cp -a /etc/sysctl.conf /etc/sysctl.conf_
cat << 'EOF' >> /etc/sysctl.conf
==== increase TCP max buffer size ====
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 ===
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
EOF
sysctl -p
==== Si serveur avec disques SSD ====
cat << 'EOF' >> /etc/sysctl.conf
=== Limit swap usage to strict necessary cases ===
vm.swappiness = 1
EOF
sysctl -p
==== Si besoin, si système physique, désactiver le cache disque ====
cp -a /etc/hdparm.conf /etc/hdparm.conf_
cat << 'EOF' >> /etc/hdparm.conf
/dev/sda {
write_cache = off
}
EOF
==== cfs scheduler ====
sed -i "s/^exit 0/for disk in \/sys\/block\/sd\?\/queue\/scheduler; do echo cfq > \$disk; done\n\nexit 0\n/g" /etc/rc.local
==== script de lecture bootlog ====
if [ ! -d "/opt/admin_scripts" ];then mkdir /opt/admin_scripts; fi
echo "sed $'s/\^\[/\E/g;s/\[1G\[/\[27G\[/' /var/log/boot" > /opt/admin_scripts/bootlogd_showlog.sh
chmod 750 /opt/admin_scripts/bootlogd_showlog.sh
[ /etc/default/grub ]
#GRUB_CMDLINE_LINUX_DEFAULT="quiet" <-- disable line
GRUB_CMDLINE_LINUX="systemd.log_target=kmsg systemd.log_level=debug" <-- add line
----
==== manuel ====
Tuning pour mount si ext3 :
vi /etc/fstab
Ajouter ",data=ordered,barrier=1" pour tous les filesystems sensibles
Voir : http://serverfault.com/questions/279571/lvm-dangers-and-caveats
Changer le mot de passe initial :
passwd
Enregistrer un mot de passe généré par keepass et mettre à jour le keepass.
Si ce serveur ne dois pas être éteint souvent, installer molly-guard :
apt-get install molly-guard
Si serveur avec IDRAC sur eth0 :
echo "NETDOWN=no" >> /etc/default/halt
**/!\ rebooter /!\**
reboot
Kernel samepage Merging
/sys/kernel/mm/ksm/run