-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·98 lines (79 loc) · 2.61 KB
/
install.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
#!/bin/bash
# NextCloudPi installation script
#
# Copyleft 2017 by Ignacio Nunez Hernanz <nacho _a_t_ ownyourbits _d_o_t_ com>
# GPL licensed (see end of file) * Use at your own risk!
#
# Usage: ./install.sh
#
# more details at https://ownyourbits.com
# put config file in place
rm -f /root/.nextpi.cnf
cp nextpi.cnf /root/.nextpi.cnf
chmod 600 /root/.nextpi.cnf
BRANCH=master
DISTRO_1=$( grep DISTRO_1 /root/.nextpi.cnf | sed 's|DISTRO_1=||' )
DISTRO_2=$( grep DISTRO_2 /root/.nextpi.cnf | sed 's|DISTRO_2=||' )
[[ ${EUID} -ne 0 ]] && {
printf "Must be run as root. Try 'sudo $0'\n"
exit 1
}
# check_distro
grep -q -e "${DISTRO_1}" -e "${DISTRO_2}" /etc/issue || {
echo "distro not supported";
exit 1;
}
# check installed software
type mysqld &>/dev/null && echo ">>> WARNING: existing mysqld configuration will be changed <<<"
# get install code
echo "Getting build code..."
apt-get update
apt-get install --no-install-recommends -y wget ca-certificates sudo jq
# put config file in place
rm -f /root/.nextpi.cnf
cp nextpi.cnf /root/.nextpi.cnf
chmod 600 /root/.nextpi.cnf
# install NCP
echo -e "\nInstalling NextPi"
source library.sh
install_script lamp.sh
install_script nc-nextcloud.sh
install_script unattended-upgrades.sh
# install_script fail2ban.sh
install_script ufw.sh
install_script crowdsec.sh
activate_script nc-nextcloud.sh
activate_script nc-init.sh
activate_script unattended-upgrades.sh
# activate_script fail2ban.sh
activate_script syscfg.sh
activate_script ufw.sh
activate_script crowdsec.sh
# post install
chmod +x ncp-provisioning.sh
./ncp-provisioning.sh
systemctl reload apache2
# get IP
IFACE="$( ip r | grep "default via" | awk '{ print $5 }' | head -1 )"
IP="$( ip a show dev "$IFACE" | grep global | grep -oP '\d{1,3}(.\d{1,3}){3}' | head -1 )"
echo "Done.
First: Visit https://$IP/ to activate your instance of NC.
For more information about installation check /var/log/ncp.log.
"
exit 0
# License
#
# This script is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this script; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307 USA