Skip to content

Instantly share code, notes, and snippets.

@pensierinmusica
Last active December 20, 2015 08:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pensierinmusica/6101869 to your computer and use it in GitHub Desktop.
Save pensierinmusica/6101869 to your computer and use it in GitHub Desktop.
My debian server set-up script
# Execute this script as root user #
#--- Check that system is up to date ---#
apt-get update
apt-get upgrade
#--- Install desired software ---#
apt-get install sudo
apt-get install fail2ban
wget http://www.inetbase.com/scripts/ddos/install.sh
chmod 0700 install.sh && ./install.sh && rm ./install.sh
apt-get install mysql-server
mysql_secure_installation
apt-get install nginx
apt-get install monit
apt-get install build-essential
# add necessary statements here #
#--- Create daemons with monitoring, logging and automated notifications ---#
# add necessary statements here #
#--- Add cron jobs ---#
#Write out current crontab
crontab -l > cron.temp
#Add desired cron jobs, unless they already exist
if grep -q 'apt-get update' cron.temp; then
printf '\nA cron job for "apt-get update" already exists, please check manually\n\n'
else
printf "\n\n0 22 * * 7 apt-get update; apt-get upgrade" >> cron.temp
fi
#Install new cron file and remove temp
crontab cron.temp
rm cron.temp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment