forked from a3020/vagrant-c57
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.sh
executable file
·111 lines (77 loc) · 2.55 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/env bash
cd /vagrant
mkdir public
chown vagrant:vagrant public
apt-get update
apt-get dist-upgrade
echo "## Install utilities"
apt-get -y install unzip
echo "## Install Apache"
# Assume yes, do not prompt
apt-get install -y apache2
if ! [ -L /var/www ]; then
rm -rf /var/www
ln -fs /vagrant /var/www
fi
# Enable mod_rewrite, allow .htaccess
a2enmod rewrite
# Allow overriding of the Apache config on a per directory basis.
rm -f /etc/apache2/sites-enabled/000-default.conf
cat > /etc/apache2/sites-enabled/000-default.conf <<EOL
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/public
<Directory /var/www/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
EOL
echo "## Run Apache as vagrant user"
sed -i 's/www-data/vagrant/g' /etc/apache2/envvars
echo "## Install PHP 5.6"
add-apt-repository ppa:ondrej/php5-5.6
sudo apt-get update
apt-get install -y php5 php5-gd libapache2-mod-php5 php5-mysql php5-mcrypt php5-curl
echo "## Install composer"
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin
echo "## Install MySQL and create database (password is 'root')"
debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
apt-get -q -y install mysql-server mysql-client
mysql -u root -proot -e "CREATE DATABASE c57"
echo "## Download C57"
wget -q -O concrete5.base.zip "https://concrete5.org/latest.zip"
echo "## Unpack C57"
su vagrant -c 'unzip -q concrete5.base.zip'
mv concrete5.*/* public
rm -rf concrete5.*/*
rm concrete5.base.zip
rmdir concrete5.*
cd public
echo "## Restart Apache"
/etc/init.d/apache2 restart
echo "## Make PHP session path writable"
chown vagrant:vagrant /var/lib/php5/sessions -R
echo "## Install concrete5"
chmod +x concrete/bin/concrete5
concrete/bin/concrete5 c5:install --db-server=localhost --db-username=root --db-password=root --db-database=c57 \
[email protected] --admin-password=admin \
--starting-point=elemental_blank
cat > .htaccess <<EOL
# -- concrete5 urls start --
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]
</IfModule>
# -- concrete5 urls end --
EOL
echo "## Done"