Skip to content

Instantly share code, notes, and snippets.

@janbiasi
Last active August 29, 2015 14:09
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 janbiasi/611e6a5dd7765f66ca8f to your computer and use it in GitHub Desktop.
Save janbiasi/611e6a5dd7765f66ca8f to your computer and use it in GitHub Desktop.
A tool for Raspian Micro Computers to optimize the Software on it
#!/bin/sh
ip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
echo "\nInstalling Apache WebServer accessible with $ip ..."
sudo apt-get install apache2 -y
echo "\nInstalling PHP 5.X on $HOSTNAME ..."
sudo apt-get install php5 libapache2-mod-php5 -y
echo "\nInstalling MySQL Database & tools on $HOSTNAME ..."
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install mysql-server --fix-missing
sudo apt-get install mysql-client php5-mysql
echo "\nOptimizing MySQL for low-ressource systems ..."
sudo mv /etc/mysql/my.cnf /etc/mysql/my.cnf.bak
sudo cp /usr/share/doc/mysql-server-5.5/examples/my-small.cnf /etc/mysql/my.cnf
echo "\nOpen /etc/mysql/my.cnf and navigate to [mysqlid] section and place"
echo "query_cache_size = 8M in it"
echo "\nDisabling IPv6 ..."
echo "net.ipv6.conf.all.disable_ipv6=1" > /etc/sysctl.d/disableipv6.conf
echo 'blacklist ipv6' >> /etc/modprobe.d/blacklist
sed -i '/::/s%^%#%g' /etc/hosts
echo "\nCleaning up your Machine ..."
rm /var/tmp/*
rm /tmp/*
rm /var/log/*
echo "Do you want to remove your GUI (Desktop)? (y/n)"
read rm_gui_rasp
if[$rm_gui_rasp = 'y']; then
apt-get remove xserver* x11-common x11-utils x11-xkb-utils x11-xserver-utils xarchiver xauth xkb-data console-setup xinit lightdm libx{composite,cb,cursor,damage,dmcp,ext,font,ft,i,inerama,kbfile,klavier,mu,pm,randr,render,res,t,xf86}* lxde* lx{input,menu-data,panel,polkit,randr,session,session-edit,shortcut,task,terminal} obconf openbox gtk* libgtk* scratch tsconf xdg-tools desktop-file-utils
apt-get --yes autoremove
apt-get --yes autoclean
apt-get --yes clean
fi
echo "Restart your pi? (y/n)"
read restart_ok
if[$restart_ok = 'y']; then
echo " ... Goodbye :)"
shutdown -r now
fi
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment