-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
78 lines (56 loc) · 1.75 KB
/
install.sh
File metadata and controls
78 lines (56 loc) · 1.75 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
# I ran this successfully on debian
set -e
set -u
set -o pipefail
set -x
if [ -z "${DB_PASS:-}" ]; then
echo "Error: Environment variable DB_PASS is not set"
exit 1
fi
# Set private IP to tell apache where it is listening or else a reverse proxy wont work
if [ -z "${PRIVATE_IP:-}" ]; then
echo "Error: Environment variable PRIVATE_IP is not set"
exit 1
fi
apt update
apt upgrade
apt install wget unzip imagemagick ffmpeg php8.3 php8.3-{fpm,cli,curl,gd,mbstring,xml,zip,bz2,intl,bcmath,gmp,imagick,mysql} -y
# Install this for ldap support, if not desired, feel free to comment this out
apt install php8.3-ldap
apt-get install apache2 apache2-utils -y
cd /etc/apache2/sites-available
cat << EOF > nextcloud.conf
<VirtualHost *:80>
DocumentRoot /var/www/nextcloud/
ServerName $PRIVATE_IP
<Directory /var/www/nextcloud/>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
<IfModule mod_dav.c>
Dav off
</IfModule>
</Directory>
</VirtualHost>
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php8.3-fpm.sock|fcgi://localhost"
</FilesMatch>
EOF
a2ensite nextcloud.conf
a2dissite 000-default.conf
a2enmod proxy_fcgi setenvif
a2enmod rewrite headers env dir mime
apt install redis-server php-redis -y
phpenmod redis
systemctl restart apache2
systemctl restart php8.3-fpm
apt install mariadb-server mariadb-client -y
mysql -e "CREATE DATABASE nextcloud;"
mysql -e "CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY '$DB_PASS';"
mysql -e "GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';"
mysql -e "FLUSH PRIVILEGES;"
cd /var/www/
wget https://download.nextcloud.com/server/releases/latest.zip
unzip latest.zip
chown -R www-data:www-data /var/www/nextcloud
chmod -R 755 /var/www/nextcloud