-
Notifications
You must be signed in to change notification settings - Fork 2
/
lamp.sh
76 lines (59 loc) · 2.81 KB
/
lamp.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
# ********************************
# Project: LAMP Setup Script
# Author: Sohel Amin
# URL: http://www.appzcoder.com
# ********************************
# Variables
DBNAME=devdb
DBUSER=root
DBPASSWD=1234
sudo apt-get update
sudo apt-get install python-software-properties
sudo add-apt-repository -y ppa:ondrej/php
# Installing curl, git apache2
sudo apt-get install -y curl git apache2
sudo apt-get update
# Installing MySQL with PhpMyAdmin
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password $DBPASSWD"
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $DBPASSWD"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/dbconfig-install boolean true"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/app-password-confirm password $DBPASSWD"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/mysql/admin-pass password $DBPASSWD"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/mysql/app-pass password $DBPASSWD"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/reconfigure-webserver multiselect none"
sudo apt-get install mysql-server phpmyadmin
mysql -uroot -p$DBPASSWD -e "CREATE DATABASE $DBNAME"
mysql -uroot -p$DBPASSWD -e "grant all privileges on $DBNAME.* to '$DBUSER'@'localhost' identified by '$DBPASSWD'"
# Installing php7.1 with mcrypt and other packages
sudo apt-get install php7.1 php7.1-mysql php7.1-gettext php7.1-mbstring php7.1-xdebug libapache2-mod-php7.1 php7.1-curl php7.1-gd php7.1-imap php7.1-mcrypt php7.1-readline php7.1-xml
# Configuring xdebug for php7.1
cat << EOF | sudo tee -a /etc/php/7.1/apache2/php.ini
# Added for xdebug
zend_extension="/usr/lib/php/20151012/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.max_nesting_level=300
EOF
# Configuring Apache with PhpMyAdmin
echo "Include /etc/phpmyadmin/apache.conf" | sudo tee -a /etc/apache2/apache2.conf
# Enabling rewrite module
sudo a2enmod rewrite
# Enabling all php errors on 7.1
sudo sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/7.1/apache2/php.ini
sudo sed -i "s/display_errors = .*/display_errors = On/" /etc/php/7.1/apache2/php.ini
sudo sed -i "s/display_startup_errors = .*/display_startup_errors = On/" /etc/php/7.1/apache2/php.ini
# Upload limit & memory
sudo sed -i "s/upload_max_filesize = .*/upload_max_filesize = 1024M/" /etc/php/7.1/apache2/php.ini
sudo sed -i "s/post_max_size = .*/post_max_size = 1024M/" /etc/php/7.1/apache2/php.ini
# Making info.php file for display phpinfo
# sudo chmod 777 -R /var/www/;
# sudo printf "<?php\nphpinfo();\n?>" > /var/www/html/info.php;
# Restarting apache2
sudo service apache2 restart
# Installing Composer
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer