Table of Contents
Was this article helpful?
Try Vultr Today with

$50 Free on Us!

Want to contribute?

You could earn up to $600 by adding new articles.

How to Install dotCMS on Ubuntu 16.04

Last Updated: Fri, Aug 3, 2018
CMS Linux Guides Server Apps Ubuntu
Archived content

This article is outdated and may not work correctly for current operating systems or software.

DotCMS is an open-source, enterprise-grade content management system written in Java. It contains nearly every feature required to create a website for your business. It provides a RESTful API to integrate with other services such as CRM, mobile applications and more. It uses Elasticsearch for real-time indexing of content and Redis for implementing a multi-tier cache.


  • A Vultr Ubuntu 16.04 server instance.

  • A sudo user.

  • A domain name pointed towards the server.

For this tutorial, we will use as the public IP address and as the domain name pointed towards the Vultr instance. Please make sure to replace all occurrences of the example domain name and public IP address with the actual one.

Update your base system using the guide How to Update Ubuntu 16.04. Once your system has been updated, proceed to install Java.

Install Java

Add the Ubuntu repository for Oracle Java 8.

sudo add-apt-repository --yes ppa:webupd8team/java

sudo apt update

Install Java.

sudo apt -y install oracle-java8-installer

You will be able to verify Java's version.

java -version

You will see the following output.

user@vultr:~$ java -version

java version "1.8.0_161"

Java(TM) SE Runtime Environment (build 1.8.0_161-b12)

Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

Set the default path for Java by installing the following package.

sudo apt -y install oracle-java8-set-default

You can verify that JAVA_HOME is set.


You should see the following.

user@vultr:~$ echo $JAVA_HOME


If you see no output at all, you will need to log out from the current shell and log back in.

Install PostgreSQL

By default, dotCMS is configured to use the H2 database engine. The H2 database engine is a flat file based database engine. It is not recommended to use in production. In this tutorial, we will use PostgreSQL server to store the dotCMS database.

PostgreSQL is an object-relational database system, known for its stability and speed.

The default Ubuntu repository contains an old version of PostgreSQL, so add the PostgreSQL repository.

echo "deb xenial-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list

wget --quiet -O - | sudo apt-key add -

sudo apt update

Install the PostgreSQL database server.

sudo apt -y install postgresql

Start the PostgreSQL server and enable it to start automatically at boot time.

sudo systemctl start postgresql

sudo systemctl enable postgresql

Change the password for the default PostgreSQL user.

sudo passwd postgres

Log in as the PostgreSQL user.

sudo su - postgres

Create a new PostgreSQL user for dotCMS.

createuser dotcms 

PostgreSQL provides the psql shell to run queries on the database server. Switch to the PostgreSQL shell.


Set a password for the newly created user for the dotCMS database.

ALTER USER dotcms WITH ENCRYPTED password 'DBPassword';

Replace the database user password DBPassword with a secure password.

Create a new database for the dotCMS installation.


Exit from the psql shell.


Switch to the sudo user.


Install dotCMS

Download the dotCMS archive.


You can always find the link to the latest version of the application on the dotCMS download page.

Create a new directory to store the dotCMS files and extract them into it.

sudo mkdir /opt/dotcms

sudo tar -zxf dotcms*.tar.gz -C /opt/dotcms

Open the database configuration file.

cd /opt/dotcms

sudo nano dotserver/tomcat-*/webapps/ROOT/META-INF/context.xml

Find the H2 block.

<!-- H2 -->

<Resource name="jdbc/dotCMSPool" auth="Container"


 validationQuery="SELECT 1" testOnBorrow="true" testWhileIdle="true" />

Comment out the whole H2 section by moving the comment delimiter --> from the start of the section to the end of the section. It should look like the following.

<!-- H2

<Resource name="jdbc/dotCMSPool" auth="Container"


 validationQuery="SELECT 1" testOnBorrow="true" testWhileIdle="true" />


Uncomment the PostgreSQL section by removing the comment delimiter --> from the end of section and placing it on the top wrapping POSTGRESQL. Also, find username= and password= and replace the existing values with the username and password of your PostgreSQL database user. If you have used a database name other than dotcms, then you will need to change the database name in url=. Once configured, the PostgreSQL block in the file will look like the following.


<Resource name="jdbc/dotCMSPool" auth="Container"





      username="dotcms" password="DBPassword" maxTotal="60" maxIdle="10" maxWaitMillis="60000"

      removeAbandonedOnBorrow="true" removeAbandonedOnMaintenance="true" removeAbandonedTimeout="60" logAbandoned="true"

      timeBetweenEvictionRunsMillis="30000" validationQuery="SELECT 1" testOnBorrow="true" testWhileIdle="true" />

Provide the execution permission for all the executable files.

sudo chmod 755 ./bin/*.sh

sudo chmod 755 dotserver/tomcat-*/bin/*.sh

DotCMS is now installed on your server. To immediately run the application, execute the following.

cd /opt/dotcms

sudo bin/

You will see the following output when the server has started successfully.

user@vultr:/opt/dotcms$ sudo bin/

Using DOTCMS_HOME = /opt/dotcms/dotserver/tomcat-8.0.18/webapps/ROOT

Using DOTSERVER = dotcms

Using CATALINA_PID = /tmp/

Using JAVA_OPTS =  -Djava.awt.headless=true -Xverify:none -Dfile.encoding=UTF8 -server -XX:+DisableExplicitGC -XX:MaxMetaspaceSize=512m -Xmx1G -XX:+UseG1GC -javaagent:/opt/dotcms/dotserver/tomcat-8.0.18/webapps/ROOT/WEB-INF/lib/byte-buddy-agent-1.6.12.jar -Ddotserver=dotcms

Using CATALINA_BASE:   /opt/dotcms/dotserver/tomcat-8.0.18

Using CATALINA_HOME:   /opt/dotcms/dotserver/tomcat-8.0.18

Using CATALINA_TMPDIR: /opt/dotcms/dotserver/tomcat-8.0.18/temp

Using JRE_HOME:        /usr

Using CLASSPATH:       /opt/dotcms/dotserver/tomcat-8.0.18/bin/bootstrap.jar:/opt/dotcms/dotserver/tomcat-8.0.18/bin/tomcat-juli.jar

Using CATALINA_PID:    /tmp/

Tomcat started.

The above command will start the Tomcat web server to serve the application on port 8080.

Open your favorite browser and browse to You will see that the application is running a demo website. If you do not see your website, please wait as the first startup of the dotCMS server takes five to ten minutes as it writes data into the PostgreSQL database and builds the cache. You can also check the startup logs.

tail -n 1000 -f /opt/dotcms/dotserver/tomcat-*/webapps/ROOT/dotsecure/logs/dotcms.log

Configure Systemd

The dotCMS server can be started directly using the startup script provided in the installer package. As a matter of convenience, you should set up a Systemd unit file for the dotCMS server. This will ensure that the application server is automatically started on system restart and failures.

Stop the running dotCMS server using the shutdown script.

sudo bin/

Create an unprivileged user for running the dotCMS server, for security reasons.

sudo adduser --home /opt/dotcms -gecos "dotCMS User" --disabled-password --disabled-login dotcms

Provide ownership of the files to the dotCMS user.

sudo chown -R dotcms:dotcms /opt/dotcms

Create a new Systemd service.

sudo nano /etc/systemd/system/dotcms.service

Populate the file.


Description=dotCMS service









Start the application and enable it to automatically start at boot time.

sudo systemctl start dotcms

sudo systemctl enable dotcms

Ensure that the service is running.

sudo systemctl status dotcms

Configure the Reverse Proxy

By default, the dotCMS server listens on port 8080. We will configure Nginx as the reverse proxy so that the application can be accessed via the standard HTTP and HTTPS ports. We will also configure Nginx to use the SSL generated with Let's Encrypt.

Install Nginx.

sudo apt -y install nginx

Start Nginx and enable it to automatically start at boot time.

sudo systemctl start nginx

sudo systemctl enable nginx

Add the Certbot repository.

sudo add-apt-repository --yes ppa:certbot/certbot

sudo apt-get update

Install Certbot, which is the client application for Let's Encrypt CA.

sudo apt -y install certbot

Note: To obtain certificates from Let's Encrypt CA, the domain for which the certificates are to be generated must be pointed towards the server. If not, make the necessary changes to the DNS records of the domain and wait for the DNS to propagate before making the certificate request again. Certbot checks the domain authority before providing the certificates.

Generate the SSL certificates.

sudo certbot certonly --webroot -w /var/www/html -d

The generated certificates are likely to be stored in /etc/letsencrypt/live/ Let's Encrypt certificates expire in 90 days, hence it is recommended to set up auto-renewal of the certificates using Cron jobs.

Open the cron job file.

sudo crontab -e

Add the following line at the end of the file.

30 5 * * * /usr/bin/certbot renew --quiet

The above cron job will run every day at 5:30 AM. If the certificate is due for expiration, it will automatically be renewed.

Create a new server block file for the dotCMS site.

sudo nano /etc/nginx/sites-available/dotcms

Populate the file.

server {

    listen 80;


    return 301 https://$host$request_uri;


server {

    listen 443;


    ssl_certificate           /etc/letsencrypt/live/;

    ssl_certificate_key       /etc/letsencrypt/live/;

    ssl on;

    ssl_session_cache  builtin:1000  shared:SSL:10m;

    ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;

    ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;

    ssl_prefer_server_ciphers on;

    access_log            /var/log/nginx/dotcms.access.log;

    location / {

      proxy_set_header        Host $host;

      proxy_set_header        X-Real-IP $remote_addr;

      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;

      proxy_set_header        X-Forwarded-Proto $scheme;

      proxy_pass          http://localhost:8080;

      proxy_read_timeout  90;

      proxy_redirect      http://localhost:8080;



Activate the configuration.

sudo ln -s /etc/nginx/sites-available/dotcms /etc/nginx/sites-enabled/dotcms

Restart the Nginx web server so that the changes can take effect.

sudo systemctl restart nginx

The dotCMS application is now installed on your server for production use. Access the administrative dashboard on the following address.

Log in using the initial administrator account, and the password admin. Change the default password immediately after login.

Congratulations, the dotCMS content management system is now installed on your server. You can modify the demo site or you can start building your site from scratch.

Want to contribute?

You could earn up to $600 by adding new articles.