Installing and integrating ONLYOFFICE Workspace Community components manually

Introduction

The easiest way to install ONLYOFFICE Workspace Community is to use our Docker script. If you prefer to have full control over the installation process, you can install all the components manually.

ONLYOFFICE Workspace Community includes the following components: ONLYOFFICE Community Server, ONLYOFFICE Control Panel, ONLYOFFICE Docs and ONLYOFFICE Mail. To install all of them and integrate with each other, follow the steps below.

System requirements
  • CPU
    at least 4-core (6-core recommended)
  • RAM
    at least 8 GB (12 GB recommended)
  • HDD
    at least 40 GB of free space
  • SWAP
    at least 4 GB, but depends on the host OS. More is better
  • OS
    amd64 Linux distribution with kernel version 3.10 or later
  • Additional requirements
    • Docker: any version supported by Docker team

Step 1. Installing prerequisites

"If Docker is not installed, refer to the Installation section on Docker website.

Docker uses Google DNS servers by default. If your ONLYOFFICE Workspace Community installation will not have access to the Internet, it is recommended to change the default Docker DNS address to that of your local DNS server. To do that, edit the /etc/default/docker file and change the IP address in the following line to the IP address of a DNS server in your local network:
docker_OPTS="--dns 8.8.8.8"

For the RPM based operating systems like CentOS:

  1. Create the /etc/docker/daemon.json configuration file with the following contents:
    { "dns" : [ "8.8.8.8" ] }
  2. Restart the Docker service:
    
    sudo systemctl restart docker.service

Before you start the installation, you need to create the following folders:

  1. For MySQL server
    sudo mkdir -p "/app/onlyoffice/mysql/conf.d";
    sudo mkdir -p "/app/onlyoffice/mysql/data";
    sudo mkdir -p "/app/onlyoffice/mysql/initdb";
  2. For ONLYOFFICE Community Server data and logs
    sudo mkdir -p "/app/onlyoffice/CommunityServer/data";
    sudo mkdir -p "/app/onlyoffice/CommunityServer/logs";
    sudo mkdir -p "/app/onlyoffice/CommunityServer/letsencrypt";
  3. For ONLYOFFICE Docs data and logs
    sudo mkdir -p "/app/onlyoffice/DocumentServer/data";
    sudo mkdir -p "/app/onlyoffice/DocumentServer/logs";
  4. And for ONLYOFFICE Mail data and logs
    sudo mkdir -p "/app/onlyoffice/MailServer/data/certs";
    sudo mkdir -p "/app/onlyoffice/MailServer/logs";
  5. For ONLYOFFICE Control Panel data and logs
    sudo mkdir -p "/app/onlyoffice/ControlPanel/data";
    sudo mkdir -p "/app/onlyoffice/ControlPanel/logs";

Then create the onlyoffice network:

sudo docker network create --driver bridge onlyoffice

Step 2. Installing MySQL

Next, create the MySQL server Docker container. Create the configuration file:

echo "[mysqld]
sql_mode = 'NO_ENGINE_SUBSTITUTION'
max_connections = 1000
max_allowed_packet = 1048576000
group_concat_max_len = 2048" > /app/onlyoffice/mysql/conf.d/onlyoffice.cnf

Create the SQL script which will generate the users and issue the rights to them. The onlyoffice_user is required for ONLYOFFICE Community Server, and the mail_admin is required for ONLYOFFICE Mail, in case it is going to be installed:

echo "ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'my-secret-pw';
CREATE USER IF NOT EXISTS 'onlyoffice_user'@'%' IDENTIFIED WITH mysql_native_password BY 'onlyoffice_pass';
CREATE USER IF NOT EXISTS 'mail_admin'@'%' IDENTIFIED WITH mysql_native_password BY 'Isadmin123';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
GRANT ALL PRIVILEGES ON *.* TO 'onlyoffice_user'@'%';
GRANT ALL PRIVILEGES ON *.* TO 'mail_admin'@'%';
FLUSH PRIVILEGES;" > /app/onlyoffice/mysql/initdb/setup.sql
Note, that the above script will set permissions to access the SQL server from any domain (%). If you want to limit the access, you can specify hosts which will have access to SQL server.

Create the MySQL container, with MySQL version 8.0.29:

sudo docker run --net onlyoffice -i -t -d --restart=always --name onlyoffice-mysql-server \
 -v /app/onlyoffice/mysql/conf.d:/etc/mysql/conf.d \
 -v /app/onlyoffice/mysql/data:/var/lib/mysql \
 -v /app/onlyoffice/mysql/initdb:/docker-entrypoint-initdb.d \
 -e MYSQL_ROOT_PASSWORD=my-secret-pw \
 -e MYSQL_DATABASE=onlyoffice \
 mysql:8.0.29

Step 3. Installing ONLYOFFICE Docs

sudo docker run --net onlyoffice -i -t -d --restart=always --name onlyoffice-document-server \
	-v /app/onlyoffice/DocumentServer/logs:/var/log/onlyoffice  \
	-v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data  \
	-v /app/onlyoffice/DocumentServer/fonts:/usr/share/fonts/truetype/custom \
	-v /app/onlyoffice/DocumentServer/forgotten:/var/lib/onlyoffice/documentserver/App_Data/cache/files/forgotten \
	onlyoffice/documentserver

To learn more, refer to the ONLYOFFICE Docs documentation.

Step 4. Installing ONLYOFFICE Mail

sudo docker run --init --net onlyoffice --privileged -i -t -d --restart=always --name onlyoffice-mail-server -p 25:25 -p 143:143 -p 587:587 \
 -e MYSQL_SERVER=onlyoffice-mysql-server \
 -e MYSQL_SERVER_PORT=3306 \
 -e MYSQL_ROOT_USER=root \
 -e MYSQL_ROOT_PASSWD=my-secret-pw \
 -e MYSQL_SERVER_DB_NAME=onlyoffice_mailserver \
 -v /app/onlyoffice/MailServer/data:/var/vmail \
 -v /app/onlyoffice/MailServer/data/certs:/etc/pki/tls/mailserver \
 -v /app/onlyoffice/MailServer/logs:/var/log \
 -h yourdomain.com \
 onlyoffice/mailserver
The domain used for mail correspondence must be valid and configured for this server (i.e. it should have the appropriate A record in the DNS settings that points your domain name to the IP address of the machine where ONLYOFFICE Mail is installed).
In the command above, the "yourdomain.com" parameter must be understood as a service domain for ONLYOFFICE Mail. It is usually specified in the MX record of the domain that will be used for maintaining correspondence. As a rule, the "yourdomain.com" looks like mx1.onlyoffice.com

The additional parameters for mail server are available here.

Step 5. Installing ONLYOFFICE Control Panel

Use this command to install ONLYOFFICE Control Panel:

sudo docker run --net onlyoffice -i -t -d --restart=always --name onlyoffice-control-panel \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /app/onlyoffice/CommunityServer/data:/app/onlyoffice/CommunityServer/data \
-v /app/onlyoffice/ControlPanel/data:/var/www/onlyoffice/Data \
-v /app/onlyoffice/ControlPanel/logs:/var/log/onlyoffice onlyoffice/controlpanel

Step 6. Installing ONLYOFFICE Community Server

Finally, ONLYOFFICE Community Server can be installed:

sudo docker run --net onlyoffice -i -t -d --privileged --restart=always --name onlyoffice-community-server -p 80:80 -p 443:443 -p 5222:5222 --cgroupns=host \
 -e MYSQL_SERVER_ROOT_PASSWORD=my-secret-pw \
 -e MYSQL_SERVER_DB_NAME=onlyoffice \
 -e MYSQL_SERVER_HOST=onlyoffice-mysql-server \
 -e MYSQL_SERVER_USER=onlyoffice_user \
 -e MYSQL_SERVER_PASS=onlyoffice_pass \
 -e DOCUMENT_SERVER_PORT_80_TCP_ADDR=onlyoffice-document-server \
 -e MAIL_SERVER_API_HOST=${MAIL_SERVER_IP} \
 -e MAIL_SERVER_DB_HOST=onlyoffice-mysql-server \
 -e MAIL_SERVER_DB_NAME=onlyoffice_mailserver \
 -e MAIL_SERVER_DB_PORT=3306 \
 -e MAIL_SERVER_DB_USER=root \
 -e MAIL_SERVER_DB_PASS=my-secret-pw \
 -e CONTROL_PANEL_PORT_80_TCP=80 \
 -e CONTROL_PANEL_PORT_80_TCP_ADDR=onlyoffice-control-panel \
 -v /app/onlyoffice/CommunityServer/data:/var/www/onlyoffice/Data \
 -v /app/onlyoffice/CommunityServer/logs:/var/log/onlyoffice \
 -v /app/onlyoffice/CommunityServer/letsencrypt:/etc/letsencrypt \
 -v /sys/fs/cgroup:/sys/fs/cgroup:rw \
 onlyoffice/communityserver

Where ${MAIL_SERVER_IP} is the IP address of the ONLYOFFICE Mail container, obtained using the following command:

MAIL_SERVER_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' onlyoffice-mail-server)

Once the installation is complete, the solution will become available at http://localhost/ address.

Article with the tag:
Browse all tags