Skip to content

Instantly share code, notes, and snippets.

@tavinus
Last active February 25, 2024 02:54
Show Gist options
  • Save tavinus/2699710b23b4da057d3696d15e7cd0ec to your computer and use it in GitHub Desktop.
Save tavinus/2699710b23b4da057d3696d15e7cd0ec to your computer and use it in GitHub Desktop.

OnlyOffice Docs into a Debian 11 LXC

FOR SOME REASON THIS DIDN'T WORK. IT INSTALLS AND RUNS, BUT GIVES AN ERROR MESSAGE ABOUT PERMISSIONS


Please use this script instead, it does the full install automated

https://gist.github.com/tavinus/64b89730e8deb5253e66cce3b5a6b21f


How I installed Onlyoffice Docs 7.2 (DocumentServer) into a Debian 11 Bullseye Proxmox LXC Container.

References

https://helpcenter.onlyoffice.com/installation/docs-community-install-ubuntu.aspx

System Requirements

  • CPU dual core 2 GHz or better
  • RAM 2 GB or more
  • HDD at least 40 GB of free space
  • Additional requirements at least 4 GB of swap
  • OS 64-bit Debian, Ubuntu or other compatible distribution with kernel version 3.13 or later
  • Additional requirements
    • PostgreSQL: version 12.9 or later
    • NGINX: version 1.3.13 or later
    • libstdc++6: version 4.8.4 or later
    • RabbitMQ

Prepare container

First update everything

# apt update && apt upgrade

Configure time zone

# dpkg-reconfigure tzdata

I like to install these

# apt install curl wget nano htop

You may want to have a local user to use instead of root
and also to add it to the sudo group

# apt install sudo
# adduser admin
# usermod -aG sudo admin

Let's add ssh capabilities

# apt install openssh-client openssh-server
# ssh admin@localhost  # test it

Configure Locales properly I used pt_BR.UTF-8 as the default, but added support to other languages and encodings as well

# dpkg-reconfigure locales
# reboot  # you may want to reboot to the new language

Install PostgreSQL

https://www.postgresql.org/download/linux/debian/

First we need lsb_release and gnupg2

# apt install lsb-release gnupg2

Install Postgres SQL

# Create the file repository configuration:
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

# Import the repository signing key:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

# Update the package lists:
sudo apt update

# Install the latest version of PostgreSQL.
# If you want a specific version, use 'postgresql-12' or similar instead of 'postgresql':
sudo apt-get -y install postgresql

Create a random password (take note of it)

$ POSTPASS="$( gpg --gen-random --armor 1 23 )"
$ echo $POSTPASS
VddqBxTOsYpeFj0iEVagq+4X/pn6jXA=

Create Database for Onlyoffice

sudo -i -u postgres psql -c "CREATE DATABASE onlyoffice;" ; sudo -i -u postgres psql -c "CREATE USER onlyoffice WITH password '$POSTPASS';" ; sudo -i -u postgres psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;"

Set PostgreSQL database user password on the installation config so it can persist on updates

echo onlyoffice-documentserver onlyoffice/db-pwd password "$POSTPASS" | sudo debconf-set-selections

Install Rabbitmq and Nginx

sudo apt install rabbitmq-server nginx-extras

Fonts

You will probably want to install some extra Fonts, including the Microsoft Fonts.

Core Microsoft Fonts

sudo apt install ttf-mscorefonts-installer

Vista Fonts are not so easy
You could try this installer with

sudo apt install wget cabextract fontforge
wget https://gist.githubusercontent.com/tavinus/1a92c79d790657d5b66546996dd006b9/raw/ttf-vista-fonts-installer.sh -q -O - | sudo bash

If you install fonts AFTER Onlyoffice, you need to refresh the OO font cache

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

Then you could refresh the browser to check the new fonts

Changing the default ONLYOFFICE Docs port

By default ONLYOFFICE Docs listens to the incoming connections using port 80. Starting with version 4.3 you can change the port for ONLYOFFICE Docs if you plan to use it instead of the default one.

I did not change this and I will also not run in HTTPS, because my CT will run through another nginx proxy.

echo onlyoffice-documentserver onlyoffice/ds-port select <PORT_NUMBER> | sudo debconf-set-selections

If you want to change the ONLYOFFICE Docs protocol to HTTPS, do not change the port to 443, but use this instruction instead.

Set custom JWT token

Make changes persist in local.json file after updating ONLYOFFICE Docs.

Enable JSON Web Tokens (JWT):

echo onlyoffice-documentserver onlyoffice/jwt-enabled boolean true | sudo debconf-set-selections

Create and take note of yout JWT Token

$ JWTTOKEN="$( gpg --gen-random --armor 1 30 )"
$ echo $JWTTOKEN
RtcVvK7svXAgUErOSC0RZOpgZznSu+q8L/v/FBvO

Set the JWT secret key

echo onlyoffice-documentserver onlyoffice/jwt-secret password "$JWTTOKEN" | sudo debconf-set-selections

Install OnlyOffice Docs

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
sudo chown root:root /tmp/onlyoffice.gpg
sudo mv /tmp/onlyoffice.gpg /etc/apt/trusted.gpg.d/

Add ONLYOFFICE Docs repository

echo "deb https://download.onlyoffice.com/repo/debian squeeze main" | sudo tee /etc/apt/sources.list.d/onlyoffice.list

Update lists

sudo apt update

Install

sudo apt install onlyoffice-documentserver

During the installation process, you will be asked to provide a password for the onlyoffice PostgreSQL user. Please enter the onlyoffice password that you have specified when configuring PostgreSQL.

After that ONLYOFFICE Docs will be run as a process.
At this point your DocumentServer instance is already usable

The package will be updated just like any other deb package.


EXCEPT

It didn't work. I got a message saying the use was not authorized.
I will retry this soon.

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