Last active
January 18, 2018 21:01
-
-
Save jonathonsim/ac13a63a38ffdbe831246ab809d97158 to your computer and use it in GitHub Desktop.
Setup a php5 LAMP environment on ubuntu xenial. Used in various vagrant boxes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#To run this add something like this to your Vagrantfile: | |
# | |
# | |
# config.vm.provision "shell", inline: <<-SHELL | |
# #Install LAMP stack | |
# export VAGRANT_DIR=/vagrant | |
# curl https://gist.githubusercontent.com/jonathonsim/ac13a63a38ffdbe831246ab809d97158/raw/ | bash | |
# SHELL | |
# | |
# | |
export DEBIAN_FRONTEND=noninteractive | |
#Use local mirrors | |
echo "deb http://nz.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse" > /etc/apt/sources.list && \ | |
echo "deb http://nz.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse" >> /etc/apt/sources.list && \ | |
echo "deb http://nz.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse" >> /etc/apt/sources.list | |
#Install php5.6 | |
apt-get update | |
apt-get install -y software-properties-common | |
LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php | |
apt-get update | |
apt-get install -y \ | |
php5.6-fpm \ | |
php5.6-phpdbg \ | |
php5.6-bcmath \ | |
php5.6-bz2 \ | |
php5.6-common \ | |
php5.6-curl \ | |
php5.6-dba \ | |
php5.6-enchant \ | |
php5.6-gd \ | |
php5.6-gmp \ | |
php5.6-imap \ | |
php5.6-interbase \ | |
php5.6-intl \ | |
php5.6-json \ | |
php5.6-ldap \ | |
php5.6-mbstring \ | |
php5.6-mcrypt \ | |
php5.6-mysql \ | |
php5.6-odbc \ | |
php5.6-pgsql \ | |
php5.6-pspell \ | |
php5.6-readline \ | |
php5.6-recode \ | |
php5.6-snmp \ | |
php5.6-soap \ | |
php5.6-sqlite3 \ | |
php5.6-sybase \ | |
php5.6-tidy \ | |
php5.6-xml \ | |
php5.6-xmlrpc \ | |
php5.6-zip \ | |
php5.6-opcache \ | |
php5.6-xsl \ | |
php5.6-xdebug \ | |
unzip | |
#Enable xdebug | |
phpenmod xdebug | |
#Install composer | |
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | |
php composer-setup.php ; | |
php -r "unlink('composer-setup.php');" ; | |
mv composer.phar /usr/local/bin/composer | |
#Install nodejs | |
apt-get install -y g++ make | |
curl -sL curl -sL https://deb.nodesource.com/setup_8.x | bash | |
apt-get install -y nodejs | |
#Various handy node based dev tools | |
npm install -g gulp | |
npm install -g grunt | |
npm install -g bower | |
npm install -g webpack | |
#Setup apache, mysql and fastcgi | |
apt-get install -y apache2 libapache2-mod-fastcgi mysql-server | |
a2enmod fastcgi | |
cat >/etc/apache2/conf-available/php-fpm.conf <<EOF | |
AddHandler php5.6.fcgi .php | |
Action php5.6.fcgi /php5.6.fcgi | |
Alias /php5.6.fcgi /usr/lib/cgi-bin/php5.6.fcgi | |
FastCgiExternalServer /usr/lib/cgi-bin/php5.6.fcgi -socket /var/run/php/php5.6-fpm.sock -pass-header Authorization -idle-timeout 3600 | |
<Directory /usr/lib/cgi-bin> | |
Require all granted | |
</Directory> | |
EOF | |
a2enconf php-fpm | |
cat >> /etc/php/5.6/fpm/php.ini <<EOF | |
[XDebug] | |
zend_extension=xdebug.so | |
xdebug.remote_enable = 1 | |
xdebug.remote_connect_back = 1 | |
xdebug.remote_port = 9000 | |
xdebug.max_nesting_level = 512 | |
EOF | |
cat > /etc/apache2/sites-available/000-default.conf <<EOF | |
<VirtualHost *:80> | |
ServerAdmin webmaster@localhost | |
DocumentRoot $VAGRANT_DIR | |
ErrorLog \${APACHE_LOG_DIR}/error.log | |
CustomLog \${APACHE_LOG_DIR}/access.log combined | |
<Directory $VAGRANT_DIR> | |
Options Indexes FollowSymLinks | |
AllowOverride All | |
Require all granted | |
</Directory> | |
</VirtualHost> | |
EOF | |
a2enmod actions rewrite headers | |
service apache2 reload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment