How to Install OnlyOffice on Ubuntu 20.04 Server with Docker (2023)

In this tutorial, we will be looking at installing OnlyOffice on Ubuntu 20.04 server. OnlyOffice is a web application that provides online office suite, email server, document management, project management, and CRM system all in one place.

OnlyOffice is formerly known as Teamlab Office. Some features are as follows:

  • It combines the best of Microsoft Office and Google Docs.
  • Offers more collaborative capabilities than Google Docs, fast real-time co-editing
  • More feature-rich than MS Office Online
  • It offers better support for MS Office formats than any other open-source office suite and is fully compatible with OpenDocument formats.
  • Integration with Box, OneDrive, Dropbox, Google Apps, Twitter, Facebook, LinkedIn.
  • Mail and calendar integration, mail autoreply, address book.
  • CRM (Customer Relationship Management)
  • Invoicing system
  • Project Management
  • Instant Messenger
  • Support more than 20 languages

OnlyOffice offers all basic tools for online businesses: email, document management, CRM, projects, calendar, a corporate social network with blogs, forums, and wiki, chat.

Open Source Community Edition vs Enterprise Edition

You can sign up for the OnlyOffice hosted service or you can set up a self-hosted OnlyOffice server which means you install OnlyOffice on your own server. The open-source community edition is for free whereas the enterprise edition lifetime license costs $1900 per server with 30 days free trial.

The free edition includes a full-featured web office suite and the following features.

  • Online Document Editors
  • Document Management
  • Mail
  • Projects
  • CRM
  • Calendar
  • Community

For more comparisons between free and enterprise editions, visit the OnlyOffice official website.

This tutorial will show you how to install the free OnlyOffice Community Edition with the official Docker images.


OnlyOffice consumes a whole lot of RAM. Your server needs to have at least 6GB of RAM to run OnlyOffice.

Step 1: Install Docker on Ubuntu 20.04 Server

Docker is included in the Ubuntu software repository. However, to ensure that we have the latest version, we will have to install it from Docker’s APT repository. Fire up a terminal window (CTRL+ALT+T), then run the following command to add Docker repository to your Ubuntu system.

echo "deb [arch=amd64] $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list

Next, run the following command to import the Docker GPG key to Ubuntu system so that APT can verify package integrity during installation.

curl -fsSL | sudo apt-key add -

And because this repository uses HTTPS connection, which I recommend all software repositories should be using, we also need to install apt-transport-https and ca-certificates package.

sudo apt install apt-transport-https ca-certificates

Finally, update the package index on your Ubuntu system and install docker-ce (Docker Community Edition).

sudo apt updatesudo apt install docker-ce

Once Docker is installed, the Docker daemon should be automatically started. You can check its status with:

systemctl status docker
How to Install OnlyOffice on Ubuntu 20.04 Server with Docker (1)

If it’s not running, then start the daemon with this command:

sudo systemctl start docker

And enable autostart at boot time:

sudo systemctl enable docker

Check Docker version.

docker -v

Sample output:

Docker version 20.10.6, build 370c289

Step 2: Install OnlyOffice Community Edition Using Docker

OnlyOffice Community edition comprises the following 3 components.

  • OnlyOffice Groups: aka OnlyOffice community server
  • OnlyOffice Docs (document server): Online Office Suite
  • OnlyOffice mail server

To install all of them, follow these steps.

First create a Docker network called onlyoffice.

sudo docker network create --driver bridge onlyoffice

Then install OnlyOffice document server with the below command. Simply copy and paste.

sudo docker run --net onlyoffice -i -t -d --restart=always --name onlyoffice-document-server \ -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data \ -v /app/onlyoffice/DocumentServer/logs:/var/log/onlyoffice \ onlyoffice/documentserver

Next, execute the following command to install OnlyOffice mail server. Replace with red-colored text with your own domain name. Don’t use any sub-domain. So you will have an email address like [emailprotected].

sudo docker run --net onlyoffice --privileged -i -t -d --restart=always --name onlyoffice-mail-server \ -p 25:25 -p 143:143 -p 587:587 \ -v /app/onlyoffice/MailServer/data:/var/vmail \ -v /app/onlyoffice/MailServer/data/certs:/etc/pki/tls/mailserver \ -v /app/onlyoffice/MailServer/logs:/var/log \ -v /app/onlyoffice/MailServer/mysql:/var/lib/mysql \ -h \ onlyoffice/mailserver

After that, issue this command to install OnlyOffice community server.

sudo docker run --net onlyoffice -i -t -d --restart=always --name onlyoffice-community-server \ -p 80:80 -p 5222:5222 -p 443:443 \ -v /app/onlyoffice/CommunityServer/data:/var/www/onlyoffice/Data \ -v /app/onlyoffice/CommunityServer/mysql:/var/lib/mysql \ -v /app/onlyoffice/CommunityServer/logs:/var/log/onlyoffice \ -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/DocumentServerData \ -e DOCUMENT_SERVER_PORT_80_TCP_ADDR=onlyoffice-document-server \ -e MAIL_SERVER_DB_HOST=onlyoffice-mail-server \ onlyoffice/communityserver

Run the following command to check if the 3 Docker containers are running.

sudo docker ps

If everything went well, it should have the following output:

How to Install OnlyOffice on Ubuntu 20.04 Server with Docker (2)

Step 3: Finish the Installation in Browser

Enter your server’s IP address in the browser address bar,


OnlyOffice will start initializing as shown below.

How to Install OnlyOffice on Ubuntu 20.04 Server with Docker (3)

On the next page, enter a password and email address to secure the OnlyOffice Portal. This is the admin account. You will need to confirm this email address.

How to Install OnlyOffice on Ubuntu 20.04 Server with Docker (4)

After clicking the continue button, you will be redirected to the home page of your OnlyOffice server. Clicking the big documents icon will take you to the online office suite where you can create and edit word documents, spreadsheets, presentation files. The 5 small icons at the bottom will respectively take you to project management, CRM, Mail, People, and community page.

How to Install OnlyOffice on Ubuntu 20.04 Server with Docker (5)

To use a domain name instead of IP address, go to settings (gear icon) > DNS settings. And enter your domain name.

How to Install OnlyOffice on Ubuntu 20.04 Server with Docker (6)

Once you click the Save button, you can access your OnlyOffice server via your domain name, provided that a correct A record is set in DNS.

Editing Word Documents Online

How to Install OnlyOffice on Ubuntu 20.04 Server with Docker (7)

Project Management

How to Install OnlyOffice on Ubuntu 20.04 Server with Docker (8)

Managing Customer Relationships with CRM

How to Install OnlyOffice on Ubuntu 20.04 Server with Docker (9)

Email Server

Building an email server with OnlyOffice is really a piece of cake! No longer have to worry about esoteric configurations of Postfix and Dovecot. The Mail module can be used to host multiple email domains. It also provides a web-based mail client which can aggregate all your email accounts in one place.

How to Install OnlyOffice on Ubuntu 20.04 Server with Docker (10)

Setting Up Nginx Reverse Proxy

It’s highly possible that you want other HTTP servers (Apache or Nginx) to run on your server. So we recommend changing the port on which OnlyOffice listens and then set up Nginx reverse proxy. we can also conveniently enable HTTPS with Nginx later on.

First, stop and remove the community server container with the following command:

sudo docker stop onlyoffice-community-serversudo docker rm onlyoffice-community-server

Then start community server with a port other than 80 like below. The community server will be listening on port 8080.

sudo docker run --net onlyoffice -i -t -d --restart=always --name onlyoffice-community-server \ -p 8080:80 -p 5222:5222 \ -v /app/onlyoffice/CommunityServer/data:/var/www/onlyoffice/Data \ -v /app/onlyoffice/CommunityServer/mysql:/var/lib/mysql \ -v /app/onlyoffice/CommunityServer/logs:/var/log/onlyoffice \ -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/DocumentServerData \ -e DOCUMENT_SERVER_PORT_80_TCP_ADDR=onlyoffice-document-server \ -e MAIL_SERVER_DB_HOST=onlyoffice-mail-server \ onlyoffice/communityserver

Now let’s install Nginx.

sudo apt install nginx

And create a virtual host file.

sudo nano /etc/nginx/conf.d/onlyoffice-proxy.conf

Put the following text into the file. Replace the domain name with your actual domain name. The proxy_pass directive will pass all requests to OnlyOffice community server.

server { listen 80; server_name; error_log /var/log/nginx/onlyoffice.error; access_log /var/log/nginx/onlyoffice.access; location / { proxy_pass; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; }}

Save and close the file. Then test Nginx config and reload.

sudo nginx -tsudo systemctl reload nginx

Now enter your domain name in the browser. You should see the OnlyOffice initialization page, which means you can access OnlyOffice via your domain name. Wait for it to finish initializing.

How to Enable HTTPS

Once the initialization is complete, we can obtain a free TLS certificate from Let’s Encrypt. Install Let’s Encrypt (certbot) client with:

sudo apt install certbot

You also need to install the Certbot Nginx plugin.

sudo apt install python3-certbot-nginx

Since we’re using Nginx, it’s best to utilize the webroot plugin to obtain the certificate. We need to add a little configuration to the virtual host file.

sudo nano /etc/nginx/conf.d/onlyoffice-proxy.conf

Add the following lines to the file.

location ~ /.well-known/acme-challenge { root /usr/share/nginx/onlyoffice/; allow all; }

Then create the /usr/share/nginx/onlyoffice/ directory.

sudo mkdir /usr/share/nginx/onlyofficesudo chown www-data:www-data /usr/share/nginx/onlyoffice -R

And reload Nginx.

sudo systemctl reload nginx

Next, run the following command to obtain a TLS certificate. Replace red text with your actual email address and domain name for OnlyOffice.

sudo certbot -a webroot -i nginx --agree-tos --redirect --hsts --staple-ocsp --email your-email-address -d -w /usr/share/nginx/onlyoffice/

You should see a congrats message indicating your TLS certificate is successfully obtained and installed. Your certificate and chain have been saved at /etc/letsencrypt/live/

Now you should be able to access OnlyOffice in HTTPS protocol!

Auto-Renew TLS Certificate

Simply edit the crontab file of the root user.

sudo crontab -e

Put the following line into the file which will try to renew your cert once per day.

@daily certbot renew --quiet

Save and close the file. That’s it!

Troubleshooting Tips

If your OnlyOffice is stuck at initialization (The portal start up process might take some time, please wait..), and you see the 502 bad gateway error when trying to access the /api/2.0/capabilities.json URL, it means the community server container has some problem.

You can log into the community server container with:

sudo docker exec -it onlyoffice-community-server /bin/bash

Then you can check the logs under /var/log/nginx/ directory.

As always, if you found this post useful, subscribe to our free newsletter or follow us on Twitter orlike our Facebook page.

Rate this tutorial

[Total: 13 Average: 4.6]

Top Articles
Latest Posts
Article information

Author: Catherine Tremblay

Last Updated: 12/29/2022

Views: 5594

Rating: 4.7 / 5 (67 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Catherine Tremblay

Birthday: 1999-09-23

Address: Suite 461 73643 Sherril Loaf, Dickinsonland, AZ 47941-2379

Phone: +2678139151039

Job: International Administration Supervisor

Hobby: Dowsing, Snowboarding, Rowing, Beekeeping, Calligraphy, Shooting, Air sports

Introduction: My name is Catherine Tremblay, I am a precious, perfect, tasty, enthusiastic, inexpensive, vast, kind person who loves writing and wants to share my knowledge and understanding with you.