How to Install ONLYOFFICE Docs on Ubuntu 24.04
Complete tutorial to install ONLYOFFICE Docs on Ubuntu 24.04 LTS with PostgreSQL, RabbitMQ, Redis, Nginx web server, and JWT security authentication.

6 min read
Complete tutorial to install ONLYOFFICE Docs on Ubuntu 24.04 LTS with PostgreSQL, RabbitMQ, Redis, Nginx web server, and JWT security authentication.
- Prerequisites and Supported Releases
- Step 1: Installing Database, Message Broker, and Cache Dependencies
- Step 2: Configuring PostgreSQL Database for ONLYOFFICE
Interactive Builder for this Guide
Build your custom nginx syntax (How to Install ONLYOFFICE Docs on Ubuntu 24.04)
server {
listen 80;
listen [::]:80;
server_name app.example.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name app.example.com;
ssl_certificate /etc/letsencrypt/live/app.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/app.example.com/privkey.pem;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
gzip on;
gzip_types text/plain text/css application/json application/javascript application/xml;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Host $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;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}server_nameBinds this virtual host to app.example.comreturn 301 https://...Redirects all plain HTTP requests permanently to TLS/HTTPSproxy_pass http://127.0.0.1:3000Forwards HTTP + WebSocket requests to local application serverX-Content-Type-Options / X-Frame-OptionsProtects users against MIME sniffing and clickjackingSelf-hosted enterprise collaboration demands high document fidelity, multi-user real-time co-authoring, and rigorous data sovereignty. When you install onlyoffice docs on ubuntu 24.04, you deploy an on-premises Document Server capable of rendering Microsoft Office formats (DOCX, XLSX, PPTX) natively with complete formatting accuracy.
ONLYOFFICE Docs operates on a modern microservices architecture powered by Node.js. It offloads asynchronous background tasks and document conversion pipelines to RabbitMQ, caches live editing sessions and cursor locks in Redis, and manages relational document states inside PostgreSQL. Integrating Nginx ensures lightning-fast static asset caching and TLS encryption.
This technical guide provides step-by-step instructions to deploy ONLYOFFICE Docs on Ubuntu 24.04 LTS. You will configure the database backend, install messaging and caching daemons, register official signed ONLYOFFICE repositories with modernized GPG keyrings, configure JWT signature security, and test the integrated document editor.
ONLYOFFICE Docs (Document Server) is a powerful self-hosted office suite that provides collaborative web-based editing for text documents, spreadsheets, presentations, and PDF forms. Designed for seamless integration with Nextcloud, ownCloud, Seafile, and custom applications, this guide explains how to install ONLYOFFICE Docs on Ubuntu 24.04 LTS using PostgreSQL, RabbitMQ, Redis, Nginx web server, and JSON Web Token (JWT) signature authentication.
Prerequisites and Supported Releases
This guide is thoroughly verified on Ubuntu 24.04 LTS (Noble Numbat). The instructions apply cleanly to cloud instances (AWS EC2, Google Compute Engine, DigitalOcean, Hetzner), bare-metal servers, and local virtual machines.
Before proceeding, ensure you have the following requirements satisfied:
- A 64-bit server running Ubuntu 24.04 LTS with at least 4 GB RAM (8 GB recommended for enterprise teams).
- A user account with active sudo administrative privileges.
- A dedicated domain name (e.g.,
office.example.com) pointing to your server's public IP. - Inbound ports 80 (HTTP) and 443 (HTTPS) open on your firewall.
Step 1: Installing Database, Message Broker, and Cache Dependencies
ONLYOFFICE Docs requires three foundational backend infrastructure services:
1. PostgreSQL: Stores document metadata, user access records, and server configurations.
2. RabbitMQ: Manages message queues for asynchronous file conversions and rendering tasks.
3. Redis: Provides ultra-low-latency in-memory caching for real-time collaborative editing sessions.
Update your local package lists and install these prerequisite daemons using APT.
# Refresh package repositories
sudo apt update && sudo apt upgrade -y
# Install PostgreSQL, RabbitMQ, Redis, and supporting utilities
sudo apt install -y postgresql rabbitmq-server redis-server curl gnupg ca-certificates
Step 2: Configuring PostgreSQL Database for ONLYOFFICE
Create a dedicated database user named onlyoffice and a database named onlyoffice. Grant full administrative permissions on the database to the newly created user.
Replace StrongOnlyOfficeDBPass123! with a high-entropy secret password.
# Provision the ONLYOFFICE database and user in PostgreSQL
sudo -i -u postgres psql -c "CREATE USER onlyoffice WITH PASSWORD 'StrongOnlyOfficeDBPass123!';"
sudo -i -u postgres psql -c "CREATE DATABASE onlyoffice OWNER onlyoffice;"
sudo -i -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE onlyoffice TO onlyoffice;"
Step 3: Verifying RabbitMQ and Redis Services
Ensure that both RabbitMQ and Redis services are enabled and running properly. ONLYOFFICE Docs will connect to these services locally on standard default ports (RabbitMQ on 5672, Redis on 6379).
Check service statuses using systemctl.
# Ensure RabbitMQ and Redis are enabled and running
sudo systemctl enable --now rabbitmq-server
sudo systemctl enable --now redis-server
# Verify service statuses
sudo systemctl is-active rabbitmq-server redis-server
Step 4: Configuring Official ONLYOFFICE GPG Key and APT Repository
In alignment with Ubuntu 24.04 security standards, store ONLYOFFICE's official public GPG key in /etc/apt/keyrings/onlyoffice.gpg. Then, create an isolated repository entry in /etc/apt/sources.list.d/onlyoffice.list referencing the key via the signed-by attribute.
Execute the following commands to configure the repository securely:
# Create keyrings directory if needed
sudo install -m 0755 -d /etc/apt/keyrings
# Download and de-armor ONLYOFFICE public key
curl -fsSL https://download.onlyoffice.com/GPG-KEY-ONLYOFFICE | sudo gpg --dearmor -o /etc/apt/keyrings/onlyoffice.gpg
sudo chmod a+r /etc/apt/keyrings/onlyoffice.gpg
# Add the official ONLYOFFICE Debian repository
echo "deb [signed-by=/etc/apt/keyrings/onlyoffice.gpg] https://download.onlyoffice.com/repo/debian squeeze main" | sudo tee /etc/apt/sources.list.d/onlyoffice.list
# Update package cache
sudo apt update
Step 5: Installing ONLYOFFICE Document Server
Install the onlyoffice-documentserver package via APT. During installation, debconf prompts will appear requesting PostgreSQL database connection credentials.
Supply the database host (localhost), database name (onlyoffice), database username (onlyoffice), and the password configured in Step 2.
# Install ONLYOFFICE Document Server
sudo apt install -y onlyoffice-documentserver
Step 6: Configuring JSON Web Token (JWT) Security
ONLYOFFICE Docs uses JSON Web Tokens (JWT) to secure document exchange between your storage backend (e.g., Nextcloud) and the Document Server, preventing unauthorized document access or man-in-the-middle tampering.
To view the automatically generated JWT secret or specify your own custom secret, inspect or edit /etc/onlyoffice/documentserver/local.json.
# Display the active JWT secret token
sudo cat /etc/onlyoffice/documentserver/local.json | grep -A 5 "token"
Step 7: Enabling and Verifying the Integrated Test Example
ONLYOFFICE Docs includes an interactive test example that allows you to verify editor functionality and file conversion capabilities in your browser before connecting enterprise clouds.
Enable the example service using supervisorctl and enable the service unit.
# Start the test example service
sudo systemctl enable --now ds-example
sudo supervisorctl start ds:example
Step 8: Testing ONLYOFFICE Docs in Your Web Browser
Open your web browser and navigate to http://office.example.com/example/. Click Create Document, Create Spreadsheet, or Create Presentation.
The ONLYOFFICE online editor opens immediately, confirming that the Node.js backend, Redis cursor tracking, RabbitMQ converter queues, and Nginx reverse proxy are operating in perfect synchronization.
Step 9: Securing ONLYOFFICE Docs with Let's Encrypt TLS
Production document servers must be secured with TLS encryption to ensure end-to-end data privacy during document transmission.
Install Certbot and configure an automated HTTPS certificate for your domain.
# Install Certbot Nginx plugin
sudo apt install -y certbot python3-certbot-nginx
# Obtain and install TLS certificate automatically
sudo certbot --nginx -d office.example.com
Troubleshooting and Common Errors
When configuring Ubuntu servers, unexpected permission errors, network timeouts, or lock contention can occur. Review these common issues and verified resolutions:
Document conversion fails or documents hang on 'Loading...'
Resolution: Check the status of RabbitMQ and Redis: sudo systemctl status rabbitmq-server redis-server. Inspect the conversion logs at /var/log/onlyoffice/documentserver/converter/out.log for error traces.
Error: 'ONLYOFFICE cannot be reached' when connecting from Nextcloud
Resolution: Verify that the Nextcloud server can resolve and connect to ONLYOFFICE over HTTPS without certificate warnings. Ensure the JWT secret in Nextcloud matches the secret in /etc/onlyoffice/documentserver/local.json.
Nginx default port 80 conflicts with another installed web server
Resolution: If Apache is running on port 80, either reconfigure Apache to listen on another port, stop Apache (sudo systemctl disable --now apache2), or configure ONLYOFFICE to listen on a custom port via debconf: echo onlyoffice-documentserver onlyoffice/docservice-port select 8080 | sudo debconf-set-selections.
Security Best Practices and Hardening
Always enforce JWT authentication (token.enable.browser = true) in /etc/onlyoffice/documentserver/local.json to prevent unauthorized document generation.
Deploy trusted SSL/TLS certificates via Let's Encrypt to ensure all in-transit editing sessions and file data streams are encrypted.
Once initial setup and validation are complete, disable the public test example service (sudo systemctl disable --now ds-example) to eliminate unnecessary attack surfaces.
Restrict database access in /etc/postgresql/ so the PostgreSQL database only accepts local socket or localhost connections.
Related Ubuntu Tutorials and Documentation
Deepen your Linux system administration skills with our related production-tested guides:
- How to Install and Configure PostgreSQL on Ubuntu 24.04 — Configure and optimize the PostgreSQL database powering your ONLYOFFICE Document Server.
- Initial Server Setup on Ubuntu 24.04 — Essential server security, user accounts, and firewall setup for Ubuntu 24.04.
- How to Install Docker on Ubuntu 24.04 — Explore containerized Document Server alternatives and companion storage apps.
Authoritative References and Official Documentation

The Linux Command Line, 2nd Edition: A Complete Introduction
Frequently Asked Questions
Quick answers to common questions and configurations
https://office.example.com), enter your JWT secret, and save settings./var/lib/onlyoffice/documentserver/App_Data/cache/files/ on your server filesystem.Editorial Disclosure: Website Vidya is supported by our readers. When you purchase hosting, tools, or software through our verified partner links, we may earn an affiliate commission at no extra cost to you. We only recommend solutions we trust and rigorously verify.
Rajesh Ray
I’m Rajesh Rai, a full-stack developer, Linux administrator, and technology enthusiast passionate about making complex technology easier to understand and use.
Most Read Guides
TrendingUbuntu Server Not Booting? 10 Simple Steps to Fix It Fast
How to Create a 3D Button in HTML and CSS: Easy Steps
How to Install Python and Pip on Ubuntu 24.04 LTS
How to Install Nginx on Ubuntu 24.04
How to Install Python on Ubuntu 24.04 LTS
Related Technical Guides
Tested runbooks, server administration walkthroughs, and troubleshooting guides


Join the Conversation & Perspective
Have thoughts, counterpoints, or reflections on this story? Engage directly with fellow readers and editorial contributors.
No comments on this guide yet. Be the first to share your thoughts or ask a question!