ONLYOFFICE Document Server is an online office suite that you can install on your local server. It allows collaborative editing of documents, spreadsheets, and presentations, supporting all popular formats like DOCX, XLSX, and PPTX. This guide will walk you through deploying ONLYOFFICE Document Server on Ubuntu 24.04, using PostgreSQL as the database and Nginx as a reverse proxy. We'll also secure ONLYOFFICE with HTTPS using Certbot and Letsencrypt.
Prerequisites
Ubuntu 24.04 Server: A running instance of Ubuntu 24.04.Non-root User with Administrator Privileges: A user account with administrative rights for your server.Domain Name: A domain name that resolves to your server's IP address.
Installing PostgreSQL and RabbitMQ
Update Package Indices: sudo apt update
Install PostgreSQL and RabbitMQ: sudo apt install postgresql rabbitmq-server
Confirm the installation by pressing 'Y'. Check PostgreSQL Status: sudo systemctl is-enabled postgresql sudo systemctl status postgresql
You should see PostgreSQL active and running. Check RabbitMQ Status: sudo systemctl is-enabled rabbitmq-server sudo systemctl status rabbitmq-server
Verify that RabbitMQ is also running.
Creating a PostgreSQL Database and User
Create a PostgreSQL User: sudo -i -u postgres psql -c "CREATE USER onlyoffice WITH PASSWORD 'onlyoffice';"
Create a PostgreSQL Database: sudo -i -u postgres psql -c "CREATE DATABASE onlyoffice OWNER onlyoffice;"
Verify Database and User Creation: sudo -i -u postgres psql -c "\du" # List users sudo -i -u postgres psql -c "\l" # List databases
You should see the 'onlyoffice' user and database listed.
Installing ONLYOFFICE Document Server
Download the GPG Key: curl -fsSL https://download.onlyoffice.com/GPG-KEY-ONLYOFFICE | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/onlyoffice.gpg
Add the ONLYOFFICE Repository: echo "deb [signed-by=/etc/apt/trusted.gpg.d/onlyoffice.gpg] https://download.onlyoffice.com/repo/debian squeeze main" | sudo tee /etc/apt/sources.list.d/onlyoffice.list
Update and Install ONLYOFFICE Document Server: sudo apt update && sudo apt install onlyoffice-documentserver
This command will update the package list, install ONLYOFFICE Document Server, and also install Nginx as the default webserver. Provide Credentials: Enter 'Y' to proceed with the installation. Enter the PostgreSQL database password ('onlyoffice'). Choose 'OK' to accept the TTF mscorefont license. Choose 'Yes' to accept the EULA.
Configuring UFW (Uncomplicated Firewall)
Add Firewall Profiles: sudo ufw allow OpenSSH sudo ufw allow 'Nginx Full'
This opens ports 22 for SSH and 80/443 for Nginx. Enable UFW: sudo ufw enable
Confirm by entering 'y'. Check UFW Status: sudo ufw status
You should see UFW active and the 'OpenSSH' and 'Nginx Full' profiles enabled.
Securing ONLYOFFICE with HTTPS
Stop Nginx: sudo systemctl stop nginx
Install Certbot: sudo apt install certbot -y
Generate SSL Certificate: sudo certbot certonly --standalone -m admin@yourdomain.com --agree-tos --no-eff-email -d yourdomain.com
Replace admin@yourdomain.com and yourdomain.com with your actual email address and domain name. Certbot will generate the SSL certificate and store it in /etc/letsencrypt/live/yourdomain.com. You'll find the public key in fullchain.pem and the private key in privkey.pem. Configure Nginx for HTTPS: Copy the Nginx template for ONLYOFFICE: sudo cp -f /etc/onlyoffice/documentserver/nginx/ds-ssl.conf.tmpl /etc/onlyoffice/documentserver/nginx/ds.conf
Edit the Nginx configuration: sudo nano /etc/onlyoffice/documentserver/nginx/ds.conf
Update the ssl_certificate and ssl_certificate_key paths: ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
Save and close the file.
Test Nginx Configuration and Restart: sudo nginx -t sudo systemctl start nginx
You should see "test successful - syntax OK" if the configuration is correct. Apply HTTPS to ONLYOFFICE: sudo bash /usr/bin/documentserver-update-securelink.sh
0 comments:
Post a Comment