raspi_installation/installation.sh

59 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
if ping -c 1 8.8.8.8
then
echo "Kein Internet"
exit 1
fi
#Installation von Systempaketen
sudo aptitude install git vim htop iftop ethtool nload
#Passwörter setzen
echo -e "\nPasswörter werden gesetzt"
echo "Passwort für $USER"
passwd
echo "Passwort für root"
sudo passwd
#ssh PermitRoot
echo -e "\nSSH wird geändert und aktiviert"
sudo sed -e 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' -i /etc/ssh/sshd_config
sudo systemctl enable ssh.service
sudo systemctl restart ssh.service
#vim mouse syntax
echo -e "\nvim wird eingerichtet"
echo -e "syntax on\nset mouse=v" | tee /home/$USER/.vimrc | sudo tee /root/.vimrc
#rasp_temp
#nrpe
echo -e "\nnrpe wird installiert"
sudo aptitude install -y nagios-nrpe-server monitoring-plugins
#cd /usr/lib/nagios/plugins/ && \
echo -e "\ncheck_rasp_temp wird installiert"
sudo wget -O /usr/lib/nagios/plugins/check_rasp_temp https://raw.githubusercontent.com/larsen0815/check_rasp_temp/master/check_rasp_temp
sudo chmod +x check_rasp_temp
cat <<EOF | sudo tee /etc/sudoers.d/nagios_rasp_temp
nagios ALL=(root) NOPASSWD: /usr/lib/nagios/plugins/check_rasp_temp
EOF
cat <<EOF | sudo tee /etc/nagios/nrpe.d/rasp_temp.cfg
command[check_rasp_temp]=sudo -u root /usr/lib/nagios/plugins/check_rasp_temp -w 60 -c 70
EOF
systemctl enable nagios-nrpe-server
systemctl restart nagios-nrpe-server
#crontab
echo -e "#Paketaktualisierungen\n$(shuf --input-range=32-59 -n 1) 3\t* * *\troot\t/usr/bin/aptitude update > /dev/null 2>&1" | sudo tee -a /etc/crontab
#apt-clone
#git mit gitignore
#user pi löschen
#Upgrade