Installing ONLYOFFICE Document Server + PostgreSQL + Nginx on CentOS 8

ONLYOFFICE is an open source office suite developed by Ascensio System SIA headquartered in Riga. The solution includes a system for document, project, customer relationship and email management.

Additional requirements:

  • PostgreSQL: version 9.1 or higher
  • NGINX: version 1.3.13 or higher
  • Redis
  • RabbitMQ

Training

We connect the EPEL repository and install the nano utility

$ sudo dnf -y install epel-release nano

Disable SeLinux

$ sudo setenforce 0
$ sudo sed -i "s%SELINUX=enforcing%SELINUX=disabled%g" /etc/sysconfig/selinux

Checking

$ sestatus
[...]
Current mode:                   permissive
[...]

Installing PostgreSQL 12

Checking which PostgreSQL version is in the base repositories and which is available by default

$ dnf module list postgresql
[...]
CentOS-8 - AppStream
Name         Stream   Profiles             Summary
postgresql   9.6      client, server [d]   PostgreSQL server and client module
postgresql   10 [d]   client, server [d]   PostgreSQL server and client module
postgresql   12       client, server [d]   PostgreSQL server and client module

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

PostgreSQL 9.6, 10 (default), and 12 are available in the AppStream repository

Switch to PostgreSQL 12 and install it

$ sudo dnf -y module enable postgresql:12
$ sudo dnf -y install postgresql-server

We initialize the database, start the PostgreSQL server and add it to startup

$ sudo postgresql-setup --initdb
 * Initializing database in '/var/lib/pgsql/data'
 * Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log

$ sudo systemctl enable --now postgresql

Checking

$ ss -nltup | grep 5432
tcp     LISTEN   0        128            127.0.0.1:5432          0.0.0.0:*
tcp     LISTEN   0        128                [::1]:5432             [::]:*

Setting up authorization in PostgreSQL

$ sudo nano /var/lib/pgsql/data/pg_hba.conf
[...]
host    all             all             127.0.0.1/32            trust
host    all             all             ::1/128                 trust

We restart the service

$ sudo systemctl restart postgresql

Create a database for ONLYOFFICE Document Server

Switch to the postgres user and run the psql console utility

$ sudo su – postgres
$ psql

Changing the password for the postgres user

=# password postgres
Enter new password: 
Enter it again:

Let’s create a new database “onlyoffice”, user “onlyoffice” with the password “password”

=# create database onlyoffice;
CREATE DATABASE
=# create user onlyoffice with password 'password';
CREATE ROLE
=# grant all privileges on database onlyoffice to onlyoffice;
GRANT
=# exit
$ exit

Installing Redis Server

Redis is an open source, resident NoSQL database management system that works with key-value data structures.

Install Redis Server and add it to startup

$ sudo dnf -y install redis
$ sudo systemctl enable --now redis

Checking

$ ss -nltup | grep 6379
tcp     LISTEN   0        128            127.0.0.1:6379          0.0.0.0:*

Installing and configuring RabbitMQ Server

RabbitMQ is a message-queue application, also called a message broker or a queue manager.

Add RabbitMQ repository

$ sudo nano /etc/yum.repos.d/rabbitmq_rabbitmq-server.repo
[rabbitmq_rabbitmq-server]
name=rabbitmq_rabbitmq-server
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/8/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[rabbitmq_rabbitmq-server-source]
name=rabbitmq_rabbitmq-server-source
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/8/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

Install RabbitMQ Server

$ sudo dnf -q makecache -y --disablerepo='*' --enablerepo='rabbitmq_rabbitmq-server'
$ sudo dnf -y install  rabbitmq-server

Let’s create and edit the configuration file

$ sudo nano /etc/rabbitmq/rabbitmq-env.conf
export [email protected]
export RABBITMQ_NODE_IP_ADDRESS=127.0.0.1
export ERL_EPMD_ADDRESS=127.0.0.1

Launch RabbitMQ Server and add it to startup

$ sudo systemctl enable --now rabbitmq-server

Checking

$ ss -nltup | grep 5672

Create a new user “onlyoffice” with the password “mypassword” using the rabbitmqctl console utility

$ sudo rabbitmqctl add_user onlyoffice mypassword
Adding user "onlyoffice" ...
$ sudo rabbitmqctl set_user_tags onlyoffice administrator
Setting tags for user "onlyoffice" to [administrator] ...
$ sudo rabbitmqctl set_permissions -p / onlyoffice ".*" ".*" ".*"
Setting permissions for user "onlyoffice" in vhost "/" ...

Check if our user has appeared

$ sudo rabbitmqctl list_users
Listing users ...
user    tags
onlyoffice      [administrator]
guest   [administrator]

Installing NGINX

Install dnf-utils utility

$ sudo dnf -y install dnf-utils

Add NGINX repository

$ sudo nano /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

The stable version will be used by default. If you need a mainline version, switch

$ sudo dnf config-manager --set-enabled nginx-mainline

Install NGINX

$ sudo dnf -y install nginx

Installing and configuring ONLYOFFICE Document Server

Add ONLYOFFICE Document Server repository

$ sudo dnf -y install https://download.onlyoffice.com/repo/centos/main/noarch/onlyoffice-repo.noarch.rpm

Install ONLYOFFICE Document Server

$ sudo dnf -y install onlyoffice-documentserver

Add supervisord and nginx services to autoload and start them

$ sudo systemctl enable --now supervisord
$ sudo systemctl enable --now nginx

ONLYOFFICE Document Server configuration

Run the configuration script documentserver-configure.sh

$ sudo bash documentserver-configure.sh

The script will offer to specify the connection parameters for PostgreSQL, Redis and RabbitMQ:

Configuring database access...
Host: localhost
Database name: onlyoffice
User: onlyoffice
Password: password
Trying to establish PostgreSQL connection... OK
Installing PostgreSQL database... OK
Configuring redis access...
Host: localhost

Trying to establish redis connection... OK
Configuring AMQP access...
Host: localhost
User: onlyoffice
Password: mypassword
Trying to establish AMQP connection... OK
Restarting services... OK

Firewall configuration

Open port 80 / tcp (http) and reload the rules

$ sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
$ sudo firewall-cmd --reload

Checking

$ sudo firewall-cmd --list-all

We launch the browser and go to the address: http: //% ip%

Sidebar