-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall-suite
More file actions
executable file
·94 lines (72 loc) · 2.31 KB
/
install-suite
File metadata and controls
executable file
·94 lines (72 loc) · 2.31 KB
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
#/bin/bash
set -x
SERVER="suite.stg.net"
#DOWNLOAD="https://suitecrm.com/download/144/suite85/563563/suitecrm-8-5-0.zip"
DOWNLOAD="https://suitecrm.com/download/165/suite88/565090/suitecrm-8-8-0.zip"
DEST="/var/www/$SERVER"
DBNAME=$(echo "$SERVER" |sed 's/\./_/g')
DBUSER="${DBNAME}_user"
DBPASS="bogus4321"
cat <<END
SERVER=$SERVER
DOWNLOAD=$DOWNLOAD
DEST=$DEST
DBNAME=$DBNAME
DBUSER=$DBUSER
DBPASS=$DBPASS
END
arraytest[0]='test' || (echo 'ERROR: arrays not supported by bash version'; exit 0)
[ `whoami` != 'root' ] && exec sudo env PATH=$PATH $0 $@
install-packages apache2 mariadb-server php php-cli php-mysql php-bcmath php-xml php-zip php-curl php-mbstring php-gd php-tidy php-intl php-opcache php-soap php-imap php-ldap php-common php-redis php-snmp php-json php-mysqli php-xml libapache2-mod-php unzip || exit
systemctl enable apache2
systemctl start apache2
systemctl enable mariadb
systemctl start mariadb
if [ -d "$DEST" ]
then
echo "Error: $DEST already exists"
exit 1
fi
mkdir -p "$DEST"
if [ ! -d "$DEST" ]
then
echo "Error: could not create $DEST"
exit 1
fi
cd "$DEST"
echo "Downloading..."
wget -O /tmp/suite-install.zip $DOWNLOAD
echo "Extracting..."
unzip /tmp/suite-install.zip >/tmp/unzip.log
find . -type d -not -perm 2755 -exec chmod 2755 {} \;
find . -type f -not -perm 0644 -exec chmod 0644 {} \;
find . ! -user www-data -exec chown www-data:www-data {} \;
chmod +x bin/console
mysql -u root <<END
CREATE DATABASE $DBNAME;
CREATE USER '$DBUSER'@'localhost' IDENTIFIED BY '$DBPASS';
GRANT ALL PRIVILEGES ON $DBNAME.* TO '$DBUSER'@'localhost';
FLUSH PRIVILEGES;
END
set -x
LOGDIR='${APACHE_LOG_DIR}'
cat >/etc/apache2/sites-available/$SERVER.conf <<END
<VirtualHost *:80>
ServerAdmin admin@$SERVER
ServerName $SERVER
DocumentRoot $DEST/public
<Directory $DEST>
AllowOverride All
Require all granted
</Directory>
ErrorLog $LOGDIR/${SERVER}_error.log
CustomLog $LOGDIR/${SERVER}_access.log combined
</VirtualHost>
END
sed -i 's/upload_max_filesize.*$/upload_max_filesize = 64M/' /etc/php/*/apache2/php.ini
a2enmod rewrite
a2ensite $SERVER.conf
a2dissite 000-default.conf
apachectl configtest || exit
systemctl restart apache2
$DEST/bin/console suitecrm:app:install -u "admin" -p "bogus1234" -U "$DBUSER" -P "$DBPASS" -H "localhost" -N "$DBNAME" -S "http://$SERVER/" -d "yes" -W true