Files
ProxmoxVE/install/onlyoffice-install.sh
T

90 lines
3.1 KiB
Bash
Raw Normal View History

2025-06-24 15:35:24 +02:00
#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
2025-06-24 15:35:24 +02:00
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt install -y \
2025-06-24 15:35:24 +02:00
nginx \
rabbitmq-server \
ca-certificates
2025-06-24 15:35:24 +02:00
msg_ok "Installed Dependencies"
PG_VERSION="16" setup_postgresql
PG_DB_NAME="onlyoffice" PG_DB_USER="onlyoffice_user" setup_postgresql_db
2025-06-24 15:35:24 +02:00
msg_info "Adding ONLYOFFICE GPG Key"
GPG_TMP="/tmp/onlyoffice.gpg"
KEY_URL="https://download.onlyoffice.com/GPG-KEY-ONLYOFFICE"
TMP_KEY_CONTENT=$(mktemp)
if curl -fsSL "$KEY_URL" -o "$TMP_KEY_CONTENT" && grep -q "BEGIN PGP PUBLIC KEY BLOCK" "$TMP_KEY_CONTENT"; then
gpg --quiet --batch --yes --no-default-keyring --keyring "gnupg-ring:$GPG_TMP" --import "$TMP_KEY_CONTENT" >/dev/null 2>&1
chmod 644 "$GPG_TMP"
chown root:root "$GPG_TMP"
mv "$GPG_TMP" /usr/share/keyrings/onlyoffice.gpg
cat <<EOF >/etc/apt/sources.list.d/onlyoffice.sources
Types: deb
URIs: https://download.onlyoffice.com/repo/debian
Suites: squeeze
Components: main
Signed-By: /usr/share/keyrings/onlyoffice.gpg
EOF
apt_update_safe
2025-06-24 15:35:24 +02:00
msg_ok "GPG Key Added"
else
msg_error "Failed to download or verify GPG key from $KEY_URL"
[[ -f "$TMP_KEY_CONTENT" ]] && rm -f "$TMP_KEY_CONTENT"
exit 250
2025-06-24 15:35:24 +02:00
fi
rm -f "$TMP_KEY_CONTENT"
msg_info "Preconfiguring ONLYOFFICE Debconf Settings"
RMQ_USER=onlyoffice_rmq
2026-10-03 08:19:10 +02:00
RMQ_PASS=$(random_password 13)
2025-06-24 15:35:24 +02:00
JWT_SECRET=$(openssl rand -hex 16)
2025-06-28 12:21:22 +02:00
$STD rabbitmqctl add_user $RMQ_USER $RMQ_PASS
$STD rabbitmqctl set_permissions -p / $RMQ_USER ".*" ".*" ".*"
$STD rabbitmqctl set_user_tags $RMQ_USER administrator
2025-06-24 15:35:24 +02:00
echo onlyoffice-documentserver onlyoffice/db-host string localhost | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-user string onlyoffice_user | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-pwd password $PG_DB_PASS | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-name string onlyoffice | debconf-set-selections
2025-06-24 15:35:24 +02:00
echo onlyoffice-documentserver onlyoffice/rabbitmq-host string localhost | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/rabbitmq-user string $RMQ_USER | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/rabbitmq-pwd password $RMQ_PASS | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/jwt-enabled boolean true | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/jwt-secret password $JWT_SECRET | debconf-set-selections
cat <<EOF >>~/onlyoffice.creds
ONLYOFFICE RabbitMQ Credentials
User: $RMQ_USER
Password: $RMQ_PASS
Secret: $JWT_SECRET
EOF
2025-06-24 15:35:24 +02:00
msg_ok "Debconf Preconfiguration Done"
msg_info "Installing ttf-mscorefonts-installer"
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections
$STD apt install -y ttf-mscorefonts-installer
2025-06-24 15:35:24 +02:00
msg_ok "Installed Microsoft Core Fonts"
msg_info "Installing ONLYOFFICE Docs"
$STD apt install -y onlyoffice-documentserver
2025-06-24 15:35:24 +02:00
msg_ok "ONLYOFFICE Docs Installed"
motd_ssh
customize
cleanup_lxc