ONLYOFFICE Docs is an open-source office suite package that can be deployed on Ubuntu and other distros to create a collaborative environment with a large number of cloud services and platforms, including WordPress, Strapi, Drupal, Odoo, Nextcloud, Seafile, Confluence, Alfresco, Jira, Redmine, Moodle, Chamilo, etc. Integration with ONLYOFFICE Docs is possible thanks to the ready-to-use connectors.
When installed, the ONLYOFFICE suite allows you to edit and collaborate on text documents, spreadsheets, and presentations in real time. It can also be used to create digital fillable forms and work with PDF files.
For offline use, there is a desktop application which offers the same functionality and allows working locally on any OS.
In this tutorial, you will learn how to install ONLYOFFICE Docs (Docker version) to your machine and enable the AI helper as the ChatGPT plugin.
System requirements and prerequisites
- CPU: dual core 2 GHz or better
- 4 GB RAM or more
- HDD: at least 40 GB of free space
- At least 4 GB of swap
- amd64 Linux distribution with kernel version 3.10 or later
- The latest Docker version
Installing ONLYOFFICE Docs
Run Docker and execute the following command to install ONLYOFFICE Docs and all the dependencies:
sudo docker run -i -t -d -p 80:80 --restart=always -e JWT_SECRET=my_jwt_secret onlyoffice/documentserver
JWT protects documents from unauthorized access. Specify your own value in -e JWT_SECRET=my_jwt_secret.
If you need to adjust the additional configuration parameters, refer to the Docker run command options for the –env-file flag where you can specify all required environment variables in a single file.
Changing the port
By default, ONLYOFFICE Docs listens to the port 80. You can change the port for ONLYOFFICE Docs if you’re planning to use it instead of the default one. Just change the mapping port during the installation:
sudo docker run -i -t -d -p <PORT_NUMBER>:80 --restart=always -e JWT_SECRET=my_jwt_secret onlyoffice/documentserver
Storing data outside containers
It’s strongly recommended to store logs, certificates, cache, and databases outside the Docker containers on the host machine as it allows easily updating ONLYOFFICE Docs once the new version is released without losing the data.
To get access to your data located outside the container, you need to mount the volumes. It can be done by specifying the -v option in the Docker run command:
sudo docker run -i -t -d -p 80:80 --restart=always \ -v /app/onlyoffice/DocumentServer/logs:/var/log/onlyoffice \ -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data \ -v /app/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice \ -v /app/onlyoffice/DocumentServer/db:/var/lib/postgresql -e JWT_SECRET=my_jwt_secret onlyoffice/documentserver
Switching to HTTPS
The easiest way to switch ONLYOFFICE Docs to HTTPS is to automatically get Let’s Encrypt SSL Certificates using certbot.
Run the ONLYOFFICE Docs Docker container specifying ports 80 and 443 and setting your own values for the variables:
sudo docker run -i -t -d -p 80:80 -p 443:443 --restart=always \ -e LETS_ENCRYPT_DOMAIN=yourdomain.com -e [email protected] -e JWT_SECRET=my_jwt_secret onlyoffice/documentserver
LETS_ENCRYPT_DOMAIN – a domain name to use for the certificate.
LETS_ENCRYPT_MAIL – an email used for registration and recovery contact.
Once done, ONLYOFFICE Docs becomes available at the https://yourdomain.com address.
Connecting to the cloud platform
Since ONLYOFFICE Docs doesn’t provide a document management system, you need to connect it to your cloud service or platform, for example, Nextcloud.
First, install the free integration app (connector) from the Nextcloud in-built application market: Apps -> Tools -> ONLYOFFICE -> Download and enable.
Once done, go to the ONLYOFFICE settings page in the Administration section and specify the address of the installed ONLYOFFICE Docs to connect both instances:
https://<your instance IP address>/
If you installed ONLYOFFICE Docs on a custom port, you must also specify the port, for example:
https://127.0. 0.1:8081/
To protect documents from unauthorized access, ONLYOFFICE uses the JSON Web Token. It is enabled by default and the secret key is generated automatically.
Find your secret key in the ONLYOFFICE Docs configuration file:
sudo docker exec <containerID> /var/www/onlyoffice/documentserver/npm/json -f /etc/onlyoffice/documentserver/local.json 'services.CoAuthoring.secret.session.string'
And specify the same secret key in the connector settings.
Enabling ChatGPT
You can add extra functionality to ONLYOFFICE Docs using plugins. The ChatGPT plugin is one of them.
To enable it, just launch the editors. Switch to the Plugins tab, launch the Plugin Manager located on the top toolbar, and click the Install button for ChatGPT.
Alternatively, you are able to install the ChatGPT plugin using the pluginsmanager utility. To do so, use the following commands:
cd /var/www/onlyoffice/documentserver/server/tools/ ./pluginsmanager --directory="/var/www/onlyoffice/documentserver/sdkjs-plugins" --install="chatgpt"
To start using the ChatGPT plugin, you need to obtain an API Key from OpenAI or use the existing one. Once you have it, launch the plugin settings via the text context menu, enter your API Key, and click the Save button.
The enabled the ChatGPT plugin allows you to use the ChatGPT chat making various requests in a free form, run word analysis, generate images and keywords, summarize and translate texts, find synonyms, etc.
Conclusion
In this article, we explained how you can install the collaborative ONLYOFFICE suite on Ubuntu and enable the ChatGPT plugin for running AI tasks directly in the editors.
We hope this guide was useful to you. Have you ever tried any AI helpers to boost your work with documents? Share your experience with us.