A failed ONLYOFFICE Document Server removal can leave the service files, configuration, data directories, Docker volumes, or a package manager’s dependency packages behind. The safe way to remove it completely is to identify how it was installed, let ONLYOFFICE close active sessions, remove the matching package or container, and then inspect persistent data and shared services before deleting anything else.
Start with a backup if the server still contains documents, cache files you may need, certificates, or custom configuration. Uninstalling Document Server can disrupt Nextcloud, ownCloud, or another application that connects to it. Also, “remove ONLYOFFICE” does not automatically mean “remove PostgreSQL, Nginx, RabbitMQ, Redis, or shared fonts”: those may serve other software.
Before uninstalling, identify the installation type
Check the package database and Snap first:
dpkg -l | grep -i onlyoffice
rpm -qa | grep -i onlyoffice
snap list | grep -i onlyoffice
These commands are read-only; a blank result from one package manager does not prove the software is absent if it was installed another way. For Docker, list containers and images:
docker ps -a --format 'table {{.ID}}\t{{.Image}}\t{{.Names}}'
docker image ls | grep -i onlyoffice
If the Linux host runs Docker Compose, locate the compose project and its volume declarations before proceeding. If ONLYOFFICE Docs was installed with Helm on Kubernetes, use the chart’s uninstall instructions instead of the Linux package commands.
How do you remove a DEB or RPM installation?
1. Save work and disconnect users cleanly
For the package installation covered by ONLYOFFICE’s Linux removal guide, run its shutdown preparation script before removing the package:
sudo documentserver-prepare4shutdown.sh
The script closes active sessions and helps ensure documents are saved. ONLYOFFICE says it may take up to five minutes. Schedule this step during a maintenance window and notify connected users first. If the command is not found, confirm the installed package and consult the matching edition’s official removal page rather than substituting an unrelated script.
2. Purge the package on Ubuntu or Debian
For Community Edition, the official package name is onlyoffice-documentserver:
sudo apt purge onlyoffice-documentserver
Package names differ by edition. The official Developer Edition removal guide uses onlyoffice-documentserver-de. Check the exact name shown by dpkg -l and use the matching vendor instructions; do not remove a similarly named package by guesswork.
APT purge removes the package binaries and package configuration, but ONLYOFFICE states that dependencies installed with the package remain. Review what APT proposes before confirming. Avoid running apt autoremove automatically: read the package list first and keep anything used by another service.
3. Remove the RPM package on CentOS or compatible systems
The Community Edition removal page gives this command for CentOS:
sudo yum remove onlyoffice-documentserver
On systems that use DNF, use the package name reported by RPM and review the proposed transaction before confirming:
sudo dnf remove onlyoffice-documentserver
Edition and repository differences can change the package name. ONLYOFFICE’s official instructions specifically document the CentOS yum command; verify the equivalent package name for your distribution before removing an Enterprise or Developer build.
What should you do with remaining files and dependencies?
If package removal reports that directories are not empty, ONLYOFFICE lists /etc/onlyoffice and /var/www/onlyoffice as directories that may be removed manually. First inspect them and copy any configuration, certificates, or files you want to keep. Then, only if the server is being retired and the directories contain no other application’s data, remove those exact paths:
sudo rm -rv /etc/onlyoffice /var/www/onlyoffice
Do not replace this targeted command with a wildcard such as rm -rf /var/*/onlyoffice*. Check the remaining service and package state:
systemctl list-units --type=service | grep -Ei 'onlyoffice|documentserver'
dpkg -l | grep -i onlyoffice
rpm -qa | grep -i onlyoffice
The package manager may leave Nginx, PostgreSQL, RabbitMQ, Redis, and font packages installed because they are dependencies or prerequisites. Remove them only after confirming they are not used by another application. On Debian or Ubuntu, inspect reverse dependencies before considering a package removal; on RPM-based systems, inspect the services and packages that depend on them. If the ONLYOFFICE repository was added solely for this server, you can separately remove its repository entry and signing key after checking the configured files. Do not remove a shared repository or key used by another ONLYOFFICE product.
Also review your reverse proxy and firewall configuration. Search Nginx site files for ONLYOFFICE hostnames or proxy destinations, then edit only the server block dedicated to Document Server. Preserve unrelated virtual hosts. TLS certificates are managed separately and may still be needed by other sites.
How do you remove a Docker installation?
First identify the exact Compose project or container. For a Compose installation, change to the directory containing the relevant Compose file and stop the project:
docker compose down
This removes the project’s containers and network, but named volumes are normally retained. That is useful when you may reinstall or need the stored data. If your intention is permanent deletion, inspect the Compose file and list volumes before removing anything:
docker volume ls
docker inspect <container_name> --format '{{json .Mounts}}'
The official ONLYOFFICE Docker image documents persistent paths including /var/log/onlyoffice, /var/www/onlyoffice/Data, and /var/lib/onlyoffice; PostgreSQL data may also be stored separately. Compose setups can map these paths to named volumes or host directories. Back up any certificates or data you need. Remove only volumes and bind-mounted directories that you have positively identified as belonging exclusively to this Document Server deployment.
After review, a Compose project can remove its declared named volumes with:
docker compose down --volumes
Use this only when you intend to delete that project’s persistent data. Do not run docker volume prune as a shortcut; it can delete unrelated unused volumes. For a container started with docker run, stop and remove the specific container, then separately inspect its mounts and remove only the data paths or volumes you chose to discard:
docker stop <container_name>
docker rm <container_name>
Finally, remove the ONLYOFFICE image only if no remaining container needs it. Use the exact image and tag reported by docker image ls:
docker image rm onlyoffice/documentserver:<tag>
The official Docker repository explains the image’s data paths and volume use. A running container’s actual mounts may differ from the defaults, so trust docker inspect and your Compose file over assumptions.
How do you uninstall the Snap package?
If snap list shows the ONLYOFFICE Docs snap, the official snap repository documents removal with:
sudo snap remove onlyoffice-ds
Then check snap list again. Snap removal and deletion of retained snapshots or user data are distinct operations; inspect saved snapshots with snap saved and remove only an ONLYOFFICE snapshot you intend to discard. Do not delete shared Snap data or snapshots indiscriminately.
Final checks after uninstalling
- Confirm the package, Snap, or container you targeted is no longer installed or running.
- Check that the old Document Server URL no longer responds from a trusted network or from the host itself.
- Verify that any connected application has been pointed to a replacement Document Server or has had its connector disabled.
- Review Nginx, firewall, DNS, and TLS settings for ONLYOFFICE-specific entries, removing only those that are no longer used.
- Check disk usage and the package manager’s remaining dependency list. Keep shared databases, proxies, message brokers, and fonts if another service needs them.
If package removal fails, read the full error and inspect the package state before trying force options. A broken maintainer script or interrupted upgrade can require repair specific to that OS and package version; forcing removal without diagnosis may leave package-manager state inconsistent. The standard removal procedure is preferable whenever it works.
Official references