Skip to content

Instantly share code, notes, and snippets.

@AbsoluteBreeze
Last active June 2, 2016 15:55
Show Gist options
  • Save AbsoluteBreeze/8bae7ec97df88223976525598d79a958 to your computer and use it in GitHub Desktop.
Save AbsoluteBreeze/8bae7ec97df88223976525598d79a958 to your computer and use it in GitHub Desktop.
A build script that I use for Vagrant/Parallels to install php7 (and the rest of the LAMP stack) on ubuntu 14.04 for webdev server.
#!/usr/bin/env bash
#PHP7/Mysql/Apache/Composer/GIT installer script used for parallels vagrant/ubuntu14.04
# For development on Laravel and other Modern frameworks.
PASSWORD='12345678'
PROJECTFOLDER='myproject'
sudo apt-get install -y software-properties-common python-software-properties
sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository -y ppa:ondrej/php
sudo apt-get update -y
#Grab Curl
sudo apt-get -y install curl
# create project folder
sudo mkdir "/var/www/html/${PROJECTFOLDER}"
apt-get install -y apache2
if ! [ -L /var/www/html ]; then
rm -rf /var/www/html
ln -fs /vagrant /var/www/html
fi
#install php7
sudo apt-get install -y php7.0 php7.0-cli php7.0-gd php7.0-json php7.0-mysql php7.0-readline php7.0-mbstring php7.0-xml
# install mysql and give password to installer
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password $PASSWORD"
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $PASSWORD"
sudo apt-get -y install mysql-server
# setup hosts file
VHOST=$(cat <<EOF
<VirtualHost *:80>
DocumentRoot "/var/www/html/${PROJECTFOLDER}/public"
<Directory "/var/www/html/${PROJECTFOLDER}">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
EOF
)
echo "${VHOST}" > /etc/apache2/sites-available/000-default.conf
# enable mod_rewrite
sudo a2enmod rewrite
# restart apache
service apache2 restart
# install git
sudo apt-get install -y git
# install Composer
curl -s https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
@AbsoluteBreeze
Copy link
Author

This script is intended for non public (off net) development, and I usually run it as 'sudo'.

Enjoy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment