envdev/lamp-trusty64/bootstrap.sh

130 lines
4.9 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
2015-02-06 10:10:04 +01:00
if [ -f /vagrant/action.upgrade ]
then
sudo apt-get update
sudo apt-get -y upgrade
fi
2014-12-12 13:43:26 +01:00
2015-01-15 15:55:08 +01:00
# --- Installation Wkhtmltopdf
if [ ! -f /usr/local/bin/wkhtmltopdf ]
then
2014-12-20 23:46:16 +01:00
sudo dpkg -i /vagrant/data/Apps/wkhtmltox-0.12.1_linux-trusty-amd64.deb
sudo apt-get -f install -y
fi
2015-01-15 15:55:08 +01:00
# --- Installation
2014-12-12 16:31:18 +01:00
if [ ! -f /usr/bin/php5 ]
then
sudo apt-get update
2014-12-22 14:05:06 +01:00
sudo apt-get -y install htop unzip apache2 mysql-client-5.5 php5 php5-apcu php5-curl php5-xmlrpc php5-xsl php5-mysqlnd php5-xdebug
2014-12-12 16:31:18 +01:00
sudo a2enmod autoindex deflate expires headers rewrite
2014-12-12 13:43:26 +01:00
fi
2015-01-15 15:55:08 +01:00
# --- Installation MariaDB
2015-01-19 20:26:12 +01:00
MARIADB_VERSION="10.0"
MYSQL_PASS=scores
if [ ! -f /etc/mysql/vagrant ]
then
sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
sudo add-apt-repository 'deb http://nwps.ws/pub/mariadb/repo/10.0/ubuntu trusty main'
sudo apt-get update
2014-12-20 23:46:16 +01:00
sudo debconf-set-selections <<< "mariadb-server-$MARIADB_VERSION mysql-server/root_password password $MYSQL_PASS"
sudo debconf-set-selections <<< "mariadb-server-$MARIADB_VERSION mysql-server/root_password_again password $MYSQL_PASS"
sudo apt-get -y --allow-unauthenticated install mariadb-server
#sudo sed -i -e 's/datadir = \/var\/lib\/mysql/datadir = \/home\/vhosts\/mysql/g' /etc/mysql/my.cnf
2014-12-20 23:46:16 +01:00
sudo sed -i -e 's/bind-address[ \t]*= 127.0.0.1/bind-address = 0.0.0.0/g' /etc/mysql/my.cnf
2014-12-22 14:05:06 +01:00
sudo sed -i -e 's/max_connections[ \t]*= 100/max_connections = 20/g' /etc/mysql/my.cnf
sudo touch /etc/mysql/vagrant
fi
2015-01-15 15:55:08 +01:00
# --- Installation phpMyAdmin
2015-01-19 20:26:12 +01:00
PHPMYADMIN_VERSION="4.3.7"
2015-01-19 20:39:14 +01:00
PHPMYADMIN_PATH="phpMyAdmin-$PHPMYADMIN_VERSION-all-languages"
if [ ! -d "/home/vhosts/$PHPMYADMIN_PATH" ]
2014-12-12 13:43:26 +01:00
then
2015-01-19 20:39:14 +01:00
if [ -f "/vagrant/data/Apps/$PHPMYADMIN_PATH.tar.xz" ]
2014-12-12 16:31:18 +01:00
then
2015-01-19 20:39:14 +01:00
tar xJvf "/vagrant/data/Apps/$PHPMYADMIN_PATH.tar.xz" --directory /home/vhosts/
2014-12-22 14:05:06 +01:00
mysql -hlocalhost -uroot -p$MYSQL_PASS < /vagrant/data/Apps/phpmyadmin.sql
2015-01-19 20:39:14 +01:00
mysql -hlocalhost -uroot -p$MYSQL_PASS < /home/vhosts/$PHPMYADMIN_PATH/examples/create_tables.sql
2014-12-22 14:05:06 +01:00
sudo service mysql restart
2015-01-19 20:39:14 +01:00
cp /vagrant/data/Apps/config.inc.php /home/vhosts/$PHPMYADMIN_PATH/
chmod 0444 /home/vhosts/$PHPMYADMIN_PATH/config.inc.php
2014-12-12 16:31:18 +01:00
fi
2014-12-12 13:43:26 +01:00
fi
2015-01-15 15:55:08 +01:00
# --- Configuration PHP / Apache
sudo sed -i -e 's/short_open_tag = Off/short_open_tag = On/g' /etc/php5/apache2/php.ini
sudo sed -i -e 's/;date.timezone =/date.timezone = Europe\/Paris/g' /etc/php5/apache2/php.ini
sudo sed -i -e 's/post_max_size = 8M/post_max_size = 50M/g' /etc/php5/apache2/php.ini
sudo sed -i -e 's/upload_max_filesize = 2M/upload_max_filesize = 50M/g' /etc/php5/apache2/php.ini
sudo sed -i -e 's/session.gc_maxlifetime = 1440/session.gc_maxlifetime = 86400/g' /etc/php5/apache2/php.ini
sudo sed -i -e 's/;opcache.enable=0/opcache.enable=1/g' /etc/php5/apache2/php.ini
2014-12-20 23:46:16 +01:00
sudo cp /vagrant/data/PHP/xdebug.ini /etc/php5/mods-available/xdebug.ini
2015-01-15 15:55:08 +01:00
# --- Browscap
2014-12-20 23:46:16 +01:00
sudo cp -f /vagrant/data/PHP/php_browscap.ini /etc/php5/apache2/
sudo sed -i -e 's/;browscap = extra\/browscap.ini/browscap = \/etc\/php5\/apache2\/php_browscap.ini/g' /etc/php5/apache2/php.ini
2014-12-17 16:00:07 +01:00
if [ ! -f /usr/lib/php5/20121212/chartdir.lic ]
then
sudo cp -R /vagrant/data/ChartDirector/lib/fonts /usr/lib/php5/20121212/
sudo cp /vagrant/data/ChartDirector/lib/libchartdir.so /usr/lib/php5/20121212/
sudo cp /vagrant/data/ChartDirector/lib/phpchartdir550.dll /usr/lib/php5/20121212/
sudo cp /vagrant/data/ChartDirector/chartdir.lic /usr/lib/php5/20121212/
sudo cp /vagrant/data/ChartDirector/chartdir.ini /etc/php5/mods-available/
sudo php5enmod chartdir
fi
2015-01-15 15:55:08 +01:00
# --- Configuration PHP / CLI
sudo sed -i -e 's/short_open_tag = Off/short_open_tag = On/g' /etc/php5/cli/php.ini
sudo sed -i -e 's/;date.timezone =/date.timezone = Europe\/Paris/g' /etc/php5/cli/php.ini
2015-01-15 15:55:08 +01:00
# --- Configuration Apache
if [ ! -f /etc/apache2/conf-available/httpd.conf ]
then
2014-12-20 23:46:16 +01:00
sudo cp /vagrant/data/Apache/httpd.conf /etc/apache2/conf-available/
sudo a2enconf httpd
2014-12-18 23:03:15 +01:00
if [ ! -d /home/vhosts/apachelog ]
then
sudo mkdir /home/vhosts/apachelog
fi
if [ ! -d /home/vhosts/test ]
then
sudo mkdir /home/vhosts/test
fi
fi
2014-12-16 15:38:40 +01:00
if [ ! -f /vagrant/vhosts/phpmyadmin.conf ]
then
2014-12-20 23:46:16 +01:00
cp /vagrant/data/Apache/phpmyadmin.conf /vagrant/vhosts/phpmyadmin.conf
fi
2014-12-16 15:38:40 +01:00
if [ ! -f /vagrant/vhosts/test.conf ]
then
2014-12-20 23:46:16 +01:00
cp /vagrant/data/Apache/test.conf /vagrant/vhosts/test.conf
fi
2015-01-15 15:55:08 +01:00
# --- Disable all website
cd /etc/apache2/sites-available/
DVHOSTS=''
for f in *.conf; do DVHOSTS+=" $f"; done;
2014-12-16 15:41:19 +01:00
sudo a2dissite $DVHOSTS
2015-01-15 15:55:08 +01:00
# --- Copy Vhosts files
VHOSTS='000-default.conf'
cd /vagrant/vhosts/
for f in *.conf; do
if [ -f $f ]
then
sudo cp -f $f /etc/apache2/sites-available/;
VHOSTS+=" $f"
fi
done;
sudo a2ensite $VHOSTS
2015-01-15 15:55:08 +01:00
# --- Restart apache
sudo service apache2 restart