Skip to content

Instantly share code, notes, and snippets.

@kaluabentes
Created June 12, 2017 13:15
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 kaluabentes/299bc83ec27bca00400a13fb63e7adb8 to your computer and use it in GitHub Desktop.
Save kaluabentes/299bc83ec27bca00400a13fb63e7adb8 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "--------- Updating repository ---------"
sudo apt-get -y update
echo "--------- Installing Apache2 ---------"
sudo apt-get -y install apache2
echo "--------- Installing PHP ---------"
sudo apt-get -y install php7.0 php7.0-*
sudo apt-get -y install libapache2-mod-php7.0
echo "--------- Installing MYSQL ---------"
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password 1234"
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password 1234"
sudo apt-get -y install mysql-server
echo "--------- Installing PHPMyAdmin ---------"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/dbconfig-install boolean false"
sudo apt-get -y install phpmyadmin
echo "--------- Configuring Server ---------"
VHOST=$(cat <<EOF
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/www
<Directory /var/www/www>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
EOF
)
echo "${VHOST}" > /etc/apache2/sites-available/000-default.conf
sudo a2enmod rewrite
sudo service apache2 reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment