OpenProject installation on Ubuntu with Postgresql and Apache / Nginx

Written by rajkiran on Saturday June 23, 2018

In this note, let's do a quick review on the installation of the very popular open source OpenProject software with Postgresql database and Apache/Nginx webservers. Open Project software has plenty of features, needed for managing the entire project life cycle and is offered with the Community Edition and Enterprise licenses.

The openproject installer for ubuntu configures mysql database and apache webserver by default. We will need to do little bit customization in order to use postgresql as the database for the repository and also check the basic configuration needed to get access to the web UI with either apache or the nginx webserver.

Configuration Info

Operating System : Ubuntu 16.04 ( Xenial )
Database : Postgresql 9.15.2
Web Server : Apache / Nginx
Open Project :  Community Edition

Postgresql Setup

If you already have configured the postgresql database and users on your machine and ready for use with the openproject configuration, then you can skip this and go to the next step.

Install Postgresql

kiran@kiran-HPE$ sudo apt-get install postgresql

## Above command installs the latest version of postgresql
## To install specific version of postgresql, specify the version number as shown below

kiran@kiran-HPE$ sudo apt-get install postgresql-9.5

# check if the postgresql service is running
kiran@kiran-HPE:~$ sudo service postgresql status
[sudo] password for kiran:
● postgresql.service - PostgreSQL RDBMS
   Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
   Active: active (exited) since Sat 2018-06-09 18:26:46 EDT; 21h ago
 Main PID: 31796 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/postgresql.service

kiran@kiran-HPE:~$ ps -ef|grep postgresql
postgres 31779     1  0 Jun09 ?        00:00:03 /usr/lib/postgresql/9.5/bin/postgres -D /var/lib/postgresql/9.5/main -c config_file=/etc/postgresql/9.5/main/postgresql.conf

Create openproject database and user

kiran@kiran-HPE:~$ sudo -u postgres psql
psql (9.5.12)
Type "help" for help.

postgres=# create database openproject;

postgres=# create user openproject;

postgres=# grant all privileges on database "openproject" to openproject;

Test the Client Connectivity using the newly created openproject user. You may need to update pg_hba.conf file to add the entries for the open project user.

kiran@kiran-HPE:/etc/postgresql/9.5/main$ cat pg_hba.conf|grep openproject
local   all             openproject                             peer

kiran@kiran-HPE:/etc/postgresql/9.5/main$ sudo service postgresql stop
kiran@kiran-HPE:/etc/postgresql/9.5/main$ sudo service postgresql start

kiran@kiran-HPE:/etc/postgresql/9.5/main$ sudo -u openproject  psql -d openproject
psql (9.5.12)
Type "help" for help.

openproject=> select current_user;

(1 row) 

 Download & Install the OpenProject Software

The information about adding the key and resource repositories for downloading the latest openproject software can be obtained from the openproject website.

wget -qO- | sudo apt-key add -
sudo apt-get install apt-transport-https
sudo wget -O /etc/apt/sources.list.d/openproject-ce.list \
sudo apt-get update
sudo apt-get install openproject

kiran@kiran-HPE:~$ wget -qO- | sudo apt-key add -

kiran@kiran-HPE:~$ sudo apt-get install apt-transport-https
Reading package lists... Done
Building dependency tree
Reading state information... Done
apt-transport-https is already the newest version (1.2.26).
0 upgraded, 0 newly installed, 0 to remove and 100 not upgraded.

kiran@kiran-HPE:~$ sudo wget -O /etc/apt/sources.list.d/openproject-ce.list >
--2018-06-10 17:04:16--
Resolving (,
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/plain]
Saving to: ‘/etc/apt/sources.list.d/openproject-ce.list’

/etc/apt/sources.list.d/openproject-c     [ <=>                                                                    ]     126  --.-KB/s    in 0s

2018-06-10 17:04:16 (7.51 MB/s) - ‘/etc/apt/sources.list.d/openproject-ce.list’ saved [126]

kiran@kiran-HPE:~$ sudo apt-get update
kiran@kiran-HPE:~$ sudo apt-get install openproject
kiran@kiran-HPE:~$ which openproject

Parameter Configuration

After successfully installing the openproject software, let's do the customization needed for using postgresql as the repository database by setting  the DATABASE_URL parameter 

kiran@kiran-HPE:~$ sudo openproject config:set DATABASE_URL="postgresql://openproject:changeme@localhost/openproject"

You can check the values of various config parameters using the the config command

kiran@kiran-HPE:~$ sudo openproject config

Configure openproject

Now, launch the openproject configuration wizard and skip the mysql installation since we will be using the cusom parameter for the database configuration.


If everything goes well, we should be having a successful configuration as shown below.

kiran@kiran-HPE:~$ sudo openproject configure

 ↳ Creating demo project...
   -Creating/Resetting Demo project
   -Setting members.
   -Creating timeline.
   -Creating versions.
   -Creating board
    ↳ Creating custom fields...
    ↳ Creating work_packages.......
    ↳ Creating Queries.....
*** Loading action_cable_engine seed data
*** Loading openproject_webhooks seed data
*** Loading openproject_github_integration seed data
Nothing to do.
Nothing to do.

Connect to postgresql and check if the database openproject contains the newly created tables.

kiran@kiran-HPE:~$ sudo -u openproject psql
[sudo] password for kiran:
psql (9.5.12)
Type "help" for help.

openproject=> \l
                                    List of databases
    Name     |  Owner   | Encoding |   Collate   |    Ctype    |    Access privileges
 openproject | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres            +
             |          |          |             |             | postgres=CTc/postgres   +
             |          |          |             |             | openproject=CTc/postgres
 postgres    | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 template0   | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres             +
             |          |          |             |             | postgres=CTc/postgres
 template1   | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres             +
             |          |          |             |             | postgres=CTc/postgres
(4 rows)

openproject=> \d
                             List of relations
 Schema |                   Name                   |   Type   |    Owner
 public | announcements                            | table    | openproject
 public | announcements_id_seq                     | sequence | openproject
 public | ar_internal_metadata                     | table    | openproject
 public | attachable_journals                      | table    | openproject
 public | attachable_journals_id_seq               | sequence | openproject
 public | attachment_journals                      | table    | openproject
 public | attachment_journals_id_seq               | sequence | openproject
 public | attachments                              | table    | openproject
 public | attachments_id_seq                       | sequence | openproject
 public | attribute_help_texts                     | table    | openproject

Apache Configuration

The openproject installation wizard configures the openproject apache site by default. Here is the config file that we need to update if any customization is needed.

kiran@kiran-HPE:/etc/apache2/sites-enabled$ sudo cat /etc/apache2/sites-enabled/openproject.conf
Include /etc/openproject/addons/apache2/includes/server/*.conf
Listen 8770
<VirtualHost *:8770>
  ServerName kiran-HPE
  DocumentRoot /opt/openproject/public

  ProxyRequests off

  Include /etc/openproject/addons/apache2/includes/vhost/*.conf

  # Can't use Location block since it would overshadow all the other proxypass directives on CentOS
  ProxyPass / retry=0
  ProxyPassReverse /

kiran@kiran-HPE:/etc/apache2/sites-enabled$ sudo service apache2 stop

kiran@kiran-HPE:/etc/apache2/sites-enabled$ sudo service apache2 start

Nginx configuration

If nginx is the preferred web server in your environment, you can create a new site configuration for openproject. Here is an example of the needed basic configuration.

kiran@kiran-HPE:~$ sudo cat /etc/nginx/sites-enabled/openproject
server {
        listen 8787 default_server;
        listen [::]:8787 default_server;

        index index.html index.htm index.nginx-debian.html index.php;
        server_name kiran-HPE;
        root /opt/openproject/public;

        location / {
                autoindex on;


kiran@kiran-HPE:/etc/nginx/sites-enabled$ sudo service nginx stop

kiran@kiran-HPE:/etc/nginx/sites-enabled$ sudo service nginx start

Congratulations! Your openproject website is up and running now! You can now access the web UI (http://<hostname>:<portno>) with the ports configured for the openproject website.