Skip to content

Instantly share code, notes, and snippets.

@burakerdem
Created July 4, 2016 10:34
Show Gist options
  • Save burakerdem/3520dd85f8bc89e5e4717f26449ba5c2 to your computer and use it in GitHub Desktop.
Save burakerdem/3520dd85f8bc89e5e4717f26449ba5c2 to your computer and use it in GitHub Desktop.
Ubuntu installation
#!/usr/bin/env bash
echo "--- Good morning, master. Let's get to work. Installing now. ---"
echo "--- Upgrading and autocleaning system ---"
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y clean
sudo apt-get -y autoremove
sudo apt-get -y purge
echo "--- Setting timezone ---"
sudo timedatectl set-timezone Europe/Istanbul
echo "--- Enabling firewall ---"
sudo ufw allow OpenSSH
sudo ufw enable
echo "--- Installing base packages ---"
sudo apt-get install -y vim curl python-software-properties
echo "--- Installing Apache ---"
sudo apt-get -y install apache2
sudo ufw allow in "Apache Full"
echo "--- Directory permissions ---"
sudo adduser $USER www-data
sudo chown $USER:www-data -R /var/www
sudo chmod u=rwX,g=srX,o=rX -R /var/www
echo "--- MySQL time ---"
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'
sudo apt-get -y install mysql-server
echo "--- Installing PHP-specific packages ---"
sudo apt-get install -y php libapache2-mod-php php-curl php-gd php-mcrypt php-mysql php-json php-mbstring
echo "--- Enabling mod-rewrite ---"
sudo a2enmod rewrite
sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
sed -i 's/DirectoryIndex index.html index.cgi index.pl index.xhtml index.htm/DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm/' /etc/apache2/mods-enabled/dir.conf
echo "--- Restarting Apache ---"
sudo systemctl restart apache2
echo "--- All set to go! ---"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment