Skip to content

Instantly share code, notes, and snippets.

@tavinus
Last active November 6, 2024 12:17
Show Gist options
  • Save tavinus/64b89730e8deb5253e66cce3b5a6b21f to your computer and use it in GitHub Desktop.
Save tavinus/64b89730e8deb5253e66cce3b5a6b21f to your computer and use it in GitHub Desktop.
Install OnlyOffice 7.2.4 on Debian 11 Bullseye
#!/bin/bash
##########################################################################
# Tavinus Nov 2022
#
# https://gist.github.com/tavinus/64b89730e8deb5253e66cce3b5a6b21f
# This is a work in progress, use at your own risk
#
# The POSTGRES password is 'onlyoffice' and
# it will be asked during install
##########################################################################
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
# initial setup
apt update
apt upgrade -y
apt install -y sudo nano htop gnupg2
# postgresql
apt install -y postgresql
sudo -i -u postgres psql -c "CREATE DATABASE onlyoffice;"
sudo -i -u postgres psql -c "CREATE USER onlyoffice WITH password 'onlyoffice';"
sudo -i -u postgres psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;"
# rabbitmq
apt install -y rabbitmq-server
# nginx
apt install -y nginx-extras
# add gpg key
mkdir -p ~/.gnupg
chmod 700 ~/.gnupg
gpg --no-default-keyring --keyring gnupg-ring:/tmp/onlyoffice.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
chmod 644 /tmp/onlyoffice.gpg
chown root:root /tmp/onlyoffice.gpg
mv /tmp/onlyoffice.gpg /etc/apt/trusted.gpg.d/
# add repo
echo "deb https://download.onlyoffice.com/repo/debian squeeze main" | tee /etc/apt/sources.list.d/onlyoffice.list
apt update
# add ms fonts
apt install -y ttf-mscorefonts-installer
# install only office
apt install -y onlyoffice-documentserver
# Show JWT info
documentserver-jwt-status.sh
echo
echo "ALL DONE"
exit 0
@tavinus
Copy link
Author

tavinus commented Nov 7, 2022

About

Just tested into a Debian 11 Bullseye LXC and it worked fine. I enabled the ds:example and it had no problems to create/open/edit files.

I also tested into Nextcloud and all is fine.

I created this script after this failed tutorial

This script uses the default config and passwords for everything, which makes me suspicious about the debconf calls not being properly applied during install. It could be some other problem as well, since I could not isolate the issue. Another possibility is that my PostgreSQL install did not run well (I was getting DB errors from OO). I tried reinstalling PG and rebuilding the DB, but that didn't solve anything. It could also be that OO is not compatible with PostgreSQL 15.

When asked during the install, the postgres password is onlyoffice.

Note: OO 7.2 now has JWT enabled by default, and it also creates a random JWT token if you don't provide any. This makes it a bit safer even with the default config. I am calling documentserver-jwt-status.sh at the end to show the JWT token (you need to use this token into your nextcloud instance for example).

The initial version of this script is missing some steps that may or may not be desirable

  • Create a non-root user
  • Reconfigure timezone data
  • Reconfigure locales data
  • Install Windows Vista TTF fonts

Note: After installing fonts into the system, you need to tell onlyoffice about it

sudo /usr/bin/documentserver-generate-allfonts.sh

To reconfigure

# reconfigure timezone
sudo dpkg-reconfigure tzdata

# reconfigure locales
sudo dpkg-reconfigure locales
# NOTE: you will only get the default language in terminal after rebooting

For some reason the rabbitmq installation failed when I ran these dpkg-reconfigure calls before the installation script. Running afterwards was fine, but seems like the documentserver installs locales-all, which makes the locales step irrelevant

@tavinus
Copy link
Author

tavinus commented Nov 8, 2022

Troubleshooting

I was getting a weird error in Nextcloud when choosing fonts. Scrolling to the end would show 3 "empty" fonts and totally break the interface, even making the file not editable and displaying an error message. I noticed that this was not happening in the ds:example app, so I cleared my firefox cache and reloaded the Nextcloud page and document and all was fine.

@master-mcfly
Copy link

Its not possible to connect Office to Nextcloud. My Office is installing well with your script into Proxmox LXC container. But this container tell me 502 Bad Gateway nginx. I didnt touch nginx configs for now! The Welcome page is working!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment