Skip to content

Instantly share code, notes, and snippets.

@roulette6
Last active November 12, 2015 19:02
Show Gist options
  • Save roulette6/11d39650c6907b7c3ccb to your computer and use it in GitHub Desktop.
Save roulette6/11d39650c6907b7c3ccb to your computer and use it in GitHub Desktop.
Bash script to set up a fresh install of Ubuntu or Mint
#!/bin/bash
echo "--- Installing applications and setting them up ---"
echo "--- Updating packages list ---"
sudo apt-get update > /dev/null 2>&1
echo "--- MySQL options ---"
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
echo "--- Installing base packages ---"
sudo apt-get install -y vim curl python-software-properties > /dev/null 2>&1
sudo add-apt-repository ppa:ondrej/php5-5.6 > /dev/null 2>&1
sudo apt-get update > /dev/null 2>&1
sudo apt-get install -y wget php5 apache2 php5-mcrypt mysql-server-5.5 php5-curl > /dev/null 2>&1
echo "--- Installing PHP-specific packages ---"
sudo apt-get install -y php5-xdebug > /dev/null 2>&1
cat << EOF | sudo tee -a /etc/php5/mods-available/xdebug.ini
xdebug.scream=1
xdebug.cli_colors=1
xdebug.show_local_vars=1
EOF
# Apache conf
# Apache conf files are in /etc/apache2/
echo "--- Enabling mod-rewrite ---"
sudo a2enmod rewrite > /dev/null 2>&1
echo "--- Setting up document root. ---"
ln -s /var/www ~/Sites
echo "--- Turn PHP errors on ---"
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php5/apache2/php.ini
sed -i "s/display_errors = .*/display_errors = On/" /etc/php5/apache2/php.ini
echo "--- Restart apache ---"
sudo service apache2 restart > /dev/null 2>&1
echo "--- Setup complete ---"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment