-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
81 lines (66 loc) · 2.84 KB
/
bootstrap.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
77
78
79
80
#!/usr/bin/env bash
# Use single quotes instead of double quotes to make it work with special-character passwords
PASSWORD='12345678'
# update / upgrade
echo updating os
sudo apt-get update > /dev/null
#sudo apt-get -y upgrade
# install apache 2.5 and php 5.5
echo installing apache
sudo apt-get install -y apache2 > /dev/null
echo installing php5
sudo apt-get install -y php5 > /dev/null
# 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"
echo installing mysql-server
sudo apt-get -y install mysql-server > /dev/null
echo installing php5-mysql
sudo apt-get install php5-mysql > /dev/null
# install phpmyadmin and give password(s) to installer
# for simplicity I'm using the same password for mysql and phpmyadmin
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/dbconfig-install boolean true"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/app-password-confirm password $PASSWORD"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/mysql/admin-pass password $PASSWORD"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/mysql/app-pass password $PASSWORD"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2"
echo installing phpmyadmin
sudo apt-get -y install phpmyadmin > /dev/null
# Setup database
echo creating database incident_accident
mysql -uroot -p12345678 -e "CREATE DATABASE incident_accident;"
# Make MySQL external accessible
echo `mysql -uroot -p$PASSWORD -e "GRANT ALL PRIVILEGES ON *.* TO 'iaf'@'%' IDENTIFIED BY 'iaf';"`
echo `mysql -uroot -p$PASSWORD -e "GRANT ALL PRIVILEGES ON *.* TO 'iaf'@'localhost' IDENTIFIED BY 'iaf';"`
echo `mysql -uroot -p$PASSWORD -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '$PASSWORD';"`
echo `mysql -uroot -p$PASSWORD -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '$PASSWORD';"`
sed -i 's/^bind-address/#bind-address/' /etc/mysql/my.cnf
sed -i 's/^skip-external-locking/#skip-external-locking/' /etc/mysql/my.cnf
sudo service mysql restart
# Import bootstrap SQL
echo importing database objects
mysql -uroot -p12345678 incident_accident < /vagrant/sql/create.sql
# setup hosts file
#VHOST=$(cat <<EOF
#<VirtualHost *:80>
# DocumentRoot "/var/www/html/${PROJECTFOLDER}"
# <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
#echo installing git
#sudo apt-get -y install git > /dev/null
# activate mcrypt
cd /etc/php5/mods-available
sudo php5enmod mcrypt
# restart apache
sudo service apache2 restart