Skip to content

Commit 4dfeb97

Browse files
authored
Merge pull request #3 from acuparse/dev
Version to 1.2.0
2 parents 0343645 + fc16e65 commit 4dfeb97

File tree

6 files changed

+190
-78
lines changed

6 files changed

+190
-78
lines changed

CHANGELOG.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Acuparse Installer
1+
# Acuparse Installation Script
22

33
# Change Log
44
All notable changes to this project will be documented in this file.
@@ -8,14 +8,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
88

99
## [Unreleased]
1010

11+
## [1.2.0] - 2018-07-06
12+
### Changed
13+
- Removed Ubuntu 16.04 LTS support and replaced with 18.04 LTS.
14+
- Support for PHP 7.2.
15+
1116
## [1.1.0] - 2018-01-31
1217
### Added
13-
- SSL & Let's Encrypt Support
18+
- SSL & Let's Encrypt Support.
1419

1520
## [1.0.1] - 2017-08-08
1621
### Changed
1722
- Removed Debian Jessie(8) support and replaced with Stretch(9).
1823

1924
## [1.0.0] - 2017-03-13
2025
### Added
21-
- Initial open source release
26+
- Initial open source release.

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
# Acuparse Installer
2-
## Script to install Acuparse on a clean Debian based server.
3-
> **Info:** Installer currently supports Debian Stretch(9) and Ubuntu 16.04 LTS.
1+
# Acuparse Installation Script
2+
## Used when installing Acuparse on a clean Debian based server.
3+
### See the [Acuparse Repository](https://github.com/acuparse/acuparse) for more details.
4+
5+
> **Info:** Supports Debian Stretch(9), Ubuntu 18.04 LTS, and Raspbian Stretch(9).
46
57
# Usage:
6-
**Requires LAMP stack. Some PHP, Apache, and GNU/Linux experience recommended.**
8+
**Requires LAMP stack. Some PHP, Apache, and GNU/Linux experience is recommended.**
79

8-
## Quick Install:
10+
# Quick Install:
911
Install your base operating system and update. Then download and run the installer.
1012

11-
``` wget https://raw.githubusercontent.com/acuparse/installer/master/install.sh && sudo sh install.sh ```
13+
`wget https://raw.githubusercontent.com/acuparse/installer/master/install.sh && sudo sh install.sh | tee ~/acuparse.log`
1214

1315
# Licencing:
1416
This installer is licensed under the MIT license.

install.sh

Lines changed: 107 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
##
4-
# Acuparse Installer
4+
# Acuparse Installation Script
55
# @copyright Copyright (C) 2015-2018 Maxwell Power
66
# @author Maxwell Power <[email protected]>
77
# @license MIT
@@ -24,90 +24,119 @@
2424
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2525
# SOFTWARE.
2626
##
27-
printf "This script is designed to be run on a freshly installed Debian Stretch, Ubuntu 16.04 LTS, or Raspbian System\n\n"
27+
printf "Acuparse Installation Script v1.2.0\n\n"
2828

2929
OS=$(cat /etc/*release | grep '^ID=' | awk -F= '{ print $2 }')
3030
if [ "$OS" = "debian" ] || [ "$OS" = "ubuntu" ] || [ "$OS" = "raspbian" ]; then
31-
31+
cd ~
3232
if [ `id -u` != "0" ]; then
33-
echo "Sorry, you are not root."
33+
printf "ERROR: Installer must be run as root!\n"
3434
exit 1
3535
fi
3636

37-
cd ~
38-
printf "Acuparse Installation Script\n\n"
39-
40-
printf "First we need some database credentials ...\n"
41-
42-
printf "Type your MySQL ROOT password, followed by [ENTER]:\n"
37+
printf "Pre Install\n\n"
38+
printf "Make a note of your Acuparse database password.\nYou will need it to complete your install!\n\n"
39+
40+
printf "When ready, Press [ENTER] to continue\n"
41+
read READY
42+
43+
printf "Enter MySQL ROOT password, followed by [ENTER]:\n"
4344
stty -echo
44-
read ROOTPW
45+
read MYSQL_ROOT_PASSWORD
4546
stty echo
4647

47-
printf "Choose a password for the Acuparse database, followed by [ENTER]:\n"
48+
printf "Enter ACUPARSE database password, followed by [ENTER]:\n"
4849
stty -echo
49-
read DBPW
50+
read ACUPARSE_DATABASE_PASSWORD
5051
stty echo
5152

52-
printf "Configure Mail?, y/N, followed by [ENTER]:\n"
53-
read MAIL
54-
55-
printf "Configure SSL with Let's Encrypt?, y/N, followed by [ENTER]:\n"
56-
read LESSL
57-
58-
if [ "$LESSL" = "y" ] || [ "$LESSL" = "Y" ]; then
59-
printf "Enter your domain for SSL cert, followed by [ENTER]:\n"
60-
read LE_DOMAIN
53+
printf "Install Exim mail server?, y/N, followed by [ENTER]:\n"
54+
read EXIM_ENABLED
55+
56+
printf "Install phpMyAdmin?, y/N, followed by [ENTER]:\n"
57+
read PHPMYADMIN_ENABLED
58+
59+
printf "Configure SSL using Let's Encrypt?, y/N, followed by [ENTER]:\n"
60+
read LE_SSL_ENABLED
61+
62+
if [ "$LE_SSL_ENABLED" = "y" ] || [ "$LE_SSL_ENABLED" = "Y" ]; then
63+
printf "\nConfiguring Let's Encrypt\n\n"
64+
65+
printf "Enter FQDN(example.com/hostname.example.com), followed by [ENTER]:\n"
66+
read LE_FQDN
67+
68+
printf "Also secure www.$LE_FQDN?, y/N, followed by [ENTER]:\n"
69+
read LE_SECURE_WWW
70+
71+
if [ "$LE_SECURE_WWW" = "y" ] || [ "$LE_SECURE_WWW" = "Y" ]; then
72+
LE_SECURE_DOMAINS="-d $LE_FQDN -d www.$LE_FQDN"
73+
else
74+
LE_SECURE_DOMAINS="-d $LE_FQDN"
75+
fi
6176

62-
printf "Enter your email for SSL cert, followed by [ENTER]:\n"
77+
printf "Certificate Email Address, followed by [ENTER]:\n"
6378
read LE_EMAIL
6479

6580
printf "Redirect HTTP to HTTPS?, y/N, followed by [ENTER]:\n"
66-
read REDIRECT
81+
read LE_REDIRECT_ENABLED
6782

68-
if [ "$REDIRECT" = "y" ] || [ "$REDIRECT" = "Y" ]; then
83+
if [ "$LE_REDIRECT_ENABLED" = "y" ] || [ "$LE_REDIRECT_ENABLED" = "Y" ]; then
6984
LE_REDIRECT="redirect"
7085
else
7186
LE_REDIRECT="no-redirect"
7287
fi
73-
printf "Also secure www.$LE_DOMAIN?, y/N, followed by [ENTER]:\n"
74-
read SECURE_WWW
75-
76-
if [ "$SECURE_WWW" = "y" ] || [ "$SECURE_WWW" = "Y" ]; then
77-
LE_SECURE_DOMAINS="-d $LE_DOMAIN -d www.$LE_DOMAIN"
78-
else
79-
LE_SECURE_DOMAINS="-d $LE_DOMAIN"
80-
fi
88+
fi
89+
90+
printf "\nInstallation Ready!\n\nThis process will install and configure packages.\nThis is your last chance to exit.\n\n"
91+
92+
printf "When ready, Press [ENTER] to continue\n"
93+
read READY
94+
95+
printf "Installing Packages\n\n"
96+
sleep 1
97+
echo "mysql-server mysql-server/root_password password $MYSQL_ROOT_PASSWORD" | debconf-set-selections
98+
echo "mysql-server mysql-server/root_password_again password $MYSQL_ROOT_PASSWORD" | debconf-set-selections
99+
100+
if [ "$OS" = "debian" ] || [ "$OS" = "raspbian" ]; then
101+
printf "DEBIAN DETECTED! Adding DEB.SURY.ORG repository.\n"
102+
apt-get install ca-certificates apt-transport-https -y
103+
wget -q https://packages.sury.org/php/apt.gpg -O- | apt-key add -
104+
echo "deb https://packages.sury.org/php/ stretch main" | tee /etc/apt/sources.list.d/php.list
81105
fi
82106

83-
printf "Install Packages\n"
84-
sleep 2
85-
echo "mysql-server mysql-server/root_password password $ROOTPW" | sudo debconf-set-selections
86-
echo "mysql-server mysql-server/root_password_again password $ROOTPW" | sudo debconf-set-selections
87-
88-
apt-get update && apt-get install git ntp imagemagick exim4 apache2 mysql-server php7.0 libapache2-mod-php7.0 php7.0-mysql php7.0-gd php7.0-curl php7.0-json php7.0-cli -y
107+
apt-get update
108+
apt-get upgrade -y
109+
apt-get install git ntp imagemagick exim4 apache2 mysql-server php7.2 libapache2-mod-php7.2 php7.2-mysql php7.2-gd php7.2-curl php7.2-json php7.2-cli php7.2-common -y
89110

90-
if [ "$MAIL" = "y" ] || [ "$MAIL" = "Y" ]; then
91-
printf "Configure Mail\n"
92-
sleep 2
111+
if [ "$PHPMYADMIN_ENABLED" = "y" ] || [ "$PHPMYADMIN_ENABLED" = "Y" ]; then
112+
printf "Installing phpMyAdmin\n"
113+
echo "phpmyadmin phpmyadmin/dbconfig-install boolean true" | debconf-set-selections
114+
echo "phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2" | debconf-set-selections
115+
echo "phpmyadmin phpmyadmin/mysql/app-pass password " | debconf-set-selections
116+
apt-get install phpmyadmin -y
117+
fi
118+
119+
if [ "$EXIM_ENABLED" = "y" ] || [ "$EXIM_ENABLED" = "Y" ]; then
120+
printf "Installing Exim mail server\n"
121+
sleep 1
93122
apt-get install exim4 -y
123+
printf "Launch exim configuration\n"
94124
dpkg-reconfigure exim4-config
95125
fi
126+
printf "END: Packages\n\n"
96127

97-
printf "Done Installing Packages\n\n"
98-
99-
printf "Getting source from Git repo\n"
100-
sleep 2
128+
printf "Install Acuparse from git\n"
129+
sleep 1
101130
git init /opt/acuparse
102131
cd /opt/acuparse
103132
if [ -z ${1+x} ]; then GITREPO="master"; else GITREPO=$1; fi
104133
git remote add -t ${GITREPO} -f origin https://github.com/acuparse/acuparse.git
105134
git checkout ${GITREPO}
106135
chown -R www-data:www-data /opt/acuparse/src
107-
printf "Done with Git Repo\n\n"
136+
printf "END: Acuparse\n\n"
108137

109-
printf "Configuring website\n"
110-
sleep 2
138+
printf "Configuring Apache\n"
139+
sleep 1
111140
a2dissite 000-default.conf > /dev/null 2>&1
112141
rm /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/default-ssl.conf
113142
cp /opt/acuparse/config/acuparse.conf /etc/apache2/sites-available/
@@ -116,41 +145,52 @@ if [ "$OS" = "debian" ] || [ "$OS" = "ubuntu" ] || [ "$OS" = "raspbian" ]; then
116145
a2enmod ssl > /dev/null 2>&1
117146
a2ensite acuparse.conf > /dev/null 2>&1
118147
a2ensite acuparse-ssl.conf > /dev/null 2>&1
119-
systemctl restart apache2.service
120-
if [ "$LESSL" = "y" ] || [ "$LESSL" = "Y" ]; then
148+
if [ "$LE_SSL_ENABLED" = "y" ] || [ "$LE_SSL_ENABLED" = "Y" ]; then
121149
printf "Deploying Let's Encrypt Certificate\n"
122-
sleep 2
150+
sleep 1
123151
systemctl stop apache2.service
124152
if [ "$OS" = "ubuntu" ]; then
153+
printf "UBUNTU DETECTED! Using certbot PPA\n"
125154
apt-get install software-properties-common -y
126155
add-apt-repository ppa:certbot/certbot -y
127156
apt-get update > /dev/null 2>&1
128157
fi
129158
apt-get install python-certbot-apache -y
130-
sed -i "s/#ServerName/ServerName $LE_DOMAIN\n ServerAlias www.$LE_DOMAIN/g" /etc/apache2/sites-available/acuparse-ssl.conf
159+
sed -i "s/#ServerName/ServerName $LE_FQDN\n ServerAlias www.$LE_FQDN/g" /etc/apache2/sites-available/acuparse-ssl.conf
131160
if [ "$GITREPO" != "master" ]; then
161+
printf "Requesting cert from STAGING server\n"
132162
certbot -n --authenticator standalone --installer apache --agree-tos --${LE_REDIRECT} --email ${LE_EMAIL} ${LE_SECURE_DOMAINS} --staging
133163
else
164+
printf "Requesting cert from PRODUCTION server\n"
134165
certbot -n --authenticator standalone --installer apache --agree-tos --${LE_REDIRECT} --email ${LE_EMAIL} ${LE_SECURE_DOMAINS}
135166
fi
136-
systemctl stop apache2.service
137167
fi
138-
printf "Done with Website Config\n\n"
168+
systemctl restart apache2.service
169+
printf "END: Apache Config\n\n"
139170

140-
printf "Setting up Acuparse database\n"
141-
sleep 2
142-
mysql -uroot -p${ROOTPW} -e "DELETE FROM mysql.user WHERE User='';DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');DROP DATABASE IF EXISTS test;DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';FLUSH PRIVILEGES;" > /dev/null 2>&1
143-
mysql -uroot -p${ROOTPW} -e "CREATE DATABASE acuparse; GRANT ALL PRIVILEGES ON acuparse.* TO acuparse@localhost IDENTIFIED BY '$DBPW'; GRANT SUPER, EVENT ON *.* TO acuparse@localhost" > /dev/null 2>&1
144-
printf "Done with Database\n\n"
171+
printf "Creating Acuparse database\n"
172+
sleep 1
173+
mysql -uroot -p${MYSQL_ROOT_PASSWORD} -e "DELETE FROM mysql.user WHERE User='';DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');DROP DATABASE IF EXISTS test;DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';FLUSH PRIVILEGES;" > /dev/null 2>&1
174+
mysql -uroot -p${MYSQL_ROOT_PASSWORD} -e "CREATE DATABASE acuparse; GRANT ALL PRIVILEGES ON acuparse.* TO acuparse@localhost IDENTIFIED BY '$ACUPARSE_DATABASE_PASSWORD'; GRANT SUPER, EVENT ON *.* TO acuparse@localhost" > /dev/null 2>&1
145175

146-
printf "Installing Cronjob\n"
147-
sleep 2
176+
printf "Installing Cron\n"
177+
sleep 1
148178
(crontab -l 2>/dev/null; echo "* * * * * php /opt/acuparse/cron/cron.php > /opt/acuparse/logs/cron.log 2>&1") | crontab -
149-
printf "Done with Cron\n\n"
150-
151-
printf "Setup Complete!\nConnect to your system using a browser to continue configuration.\n"
152179

180+
printf "Running Cleanup\n"
181+
apt-get autoremove -y
182+
apt-get clean -y
183+
apt-get purge -y
184+
systemctl restart apache2.service
185+
186+
printf "\nAcuparse Installation Complete!\n\n"
187+
188+
printf "Your system IP addresse(s):\n"
189+
hostname -I
190+
printf "\nYour system hostname(s):\n"
191+
hostname -A
192+
printf "\nConnect to your IP/Hostname with a browser to continue configuration.\n"
153193
else
154-
printf "NO Debian Based OS!"
194+
printf "ERROR: This script is designed to be run on a freshly installed Debian Stretch(9), Ubuntu 18.04 LTS, or Raspbian Stretch(9) based system\n"
155195
fi
156-
exit
196+
exit

resources/from2_1.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/bin/sh
22

33
##
4-
# Acuparse 2.1 Migration Script
4+
# Acuparse Installation Script
5+
# 2.1 Apache Migration Tasks
56
# @copyright Copyright (C) 2015-2018 Maxwell Power
67
# @author Maxwell Power <[email protected]>
78
# @license MIT

resources/le.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/bin/sh
22

33
##
4-
# Acuparse Let's Encrypt Installer
4+
# Acuparse Installation Script
5+
# Let's Encrypt Installer
56
# @copyright Copyright (C) 2015-2018 Maxwell Power
67
# @author Maxwell Power <[email protected]>
78
# @license MIT

resources/php7.2.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/sh
2+
3+
##
4+
# Acuparse Installation Script
5+
# PHP 7.0 to 7.2 Upgrader
6+
# @copyright Copyright (C) 2015-2018 Maxwell Power
7+
# @author Maxwell Power <[email protected]>
8+
# @license MIT
9+
#
10+
# Permission is hereby granted, free of charge, to any person obtaining a copy
11+
# of this software and associated documentation files (the "Software"), to deal
12+
# in the Software without restriction, including without limitation the rights
13+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14+
# copies of the Software, and to permit persons to whom the Software is
15+
# furnished to do so, subject to the following conditions:
16+
#
17+
# The above copyright notice and this permission notice shall be included in all
18+
# copies or substantial portions of the Software.
19+
#
20+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26+
# SOFTWARE.
27+
##
28+
29+
if [ `id -u` != "0" ]; then
30+
echo "Sorry, you are not root."
31+
exit 1
32+
fi
33+
34+
printf "Upgrading PHP to 7.2\n\n"
35+
36+
printf "Installation Ready!\n\nThis process will remove PHP 7.0 then reinstall PHP 7.2./nThis is your last chance to exit./n/n"
37+
38+
printf "When ready, Press [ENTER] to continue\n"
39+
read READY
40+
41+
OS=$(cat /etc/*release | grep '^ID=' | awk -F= '{ print $2 }')
42+
printf "Removing PHP 7.0\n\n"
43+
sleep 1
44+
apt-get remove php7.0 libapache2-mod-php7.0 php7.0-mysql php7.0-gd php7.0-curl php7.0-json php7.0-cli -y
45+
46+
if [ "$OS" = "debian" ] || [ "$OS" = "raspbian" ]; then
47+
printf "DEBIAN DETECTED!\nAdding DEB.SURY.ORG repository.\n\n"
48+
apt-get install ca-certificates apt-transport-https -y
49+
wget -q https://packages.sury.org/php/apt.gpg -O- | apt-key add -
50+
echo "deb https://packages.sury.org/php/ stretch main" | tee /etc/apt/sources.list.d/php.list
51+
fi
52+
apt-get update
53+
printf "\nInstalling PHP 7.2\n\n"
54+
sleep 1
55+
apt-get install php7.2 libapache2-mod-php7.2 php7.2-mysql php7.2-gd php7.2-curl php7.2-json php7.2-cli php7.2-common -y
56+
57+
printf "\nCleanup APT\n\n"
58+
sleep 1
59+
apt purge
60+
apt clean
61+
apt autoremove -y
62+
63+
printf "\nDONE!\n"

0 commit comments

Comments
 (0)