DotCms manual setup

  1. Setup Java

Using option 2

One option for installing Java is to use the version packaged with Ubuntu. By default, Ubuntu 22.04 includes Open JDK 11, which is an open-source variant of the JRE and JDK.

To install the OpenJDK version of Java, first update your apt package index:

sudo apt update

Copy

Next, check if Java is already installed:

java -version

Copy

If Java is not currently installed, you’ll get the following output:

OutputCommand 'java' not found, but can be installed with:

sudo apt install default-jre              # version 2:1.11-72build1, or
sudo apt install openjdk-11-jre-headless  # version 11.0.14+9-0ubuntu2
sudo apt install openjdk-17-jre-headless  # version 17.0.2+8-1
sudo apt install openjdk-18-jre-headless  # version 18~36ea-1
sudo apt install openjdk-8-jre-headless   # version 8u312-b07-0ubuntu1

Execute the following command to install the JRE from OpenJDK 11:

Copy

The JRE will allow you to run almost all Java software.

Verify the installation with:

Copy

You’ll receive output similar to the following:

You may need the JDK in addition to the JRE in order to compile and run some specific Java-based software. To install the JDK, execute the following command, which will also install the JRE:

Copy

Verify that the JDK is installed by checking the version of javac, the Java compiler:

Copy

You’ll see the following output:

Next, you’ll learn how to install Oracle’s official JDK and JRE.

Oracle’s licensing agreement for Java doesn’t allow automatic installation through package managers. To install the Oracle JDK, which is the official version distributed by Oracle, you must create an Oracle account and manually download the JDK to add a new package repository for the version you’d like to use. Then you can use apt to install it with help from a third party installation script. Oracle JDK comes with the JRE included, so you don’t need to install that separately.

The version of Oracle’s JDK you’ll need to download must match the version of the installer script. To find out which version you need, visit the oracle-java11-installer page.

Locate the package for Jammy, as shown in the following figure:

Installer package for Ubuntu 22.04

In this image, the version of the script is 11.0.13. In this case, you would need Oracle JDK 11.0.13. Your version number may vary depending on when you’re installing the software.

You don’t need to download anything from this page; you’ll download the installation script through apt shortly.

Next, visit the Archive Downloads and locate the version that matches the one you need.

The Oracle Java archive downloads web page where you can find versions of Java that are not the latest release.

From this list, choose the Linux x64 compressed archive .tar.gz package:

Linux download

You’ll be presented with a screen asking you to accept the Oracle license agreement. Select the checkbox to accept the license agreement and press the Download button. Your download will begin. You may need to log in to your Oracle account one more time before the download starts.

Once the file has downloaded, you’ll need to transfer it to your server. On your local machine, upload the file to your server. On macOS, Linux, or Windows using the Windows Subsystem for Linux, use the scp command to transfer the file to the home directory of your sammy user. The following command assumes you’ve saved the Oracle JDK file to your local machine’s Downloads folder:

Copy

Once the file upload has completed, return to your server and add the third-party repository that will help you install Oracle’s Java.

First, import the signing key used to verify the software you’re about to install:

Copy

You’ll see this output:

Next, add the repository to your list of package sources:

Copy

Update your package list to make the new software available for installation:

Copy

The installer will look for the Oracle JDK you downloaded in /var/cache/oracle-jdk11-installer-local. Create this directory and move the Oracle JDK archive there:

Copy

Finally, install the package:

Copy

The installer will first ask you to accept the Oracle license agreement. Accept the agreement, then the installer will extract the Java package and install it.

Now you’ll look at how to select the version of Java you want to use.

You can have multiple Java installations on one server. You can configure which version is the default for use on the command line by using the update-alternatives command.

Copy

This is what the output would look like if you’ve installed both versions of Java in this tutorial:

Choose the number associated with the Java version to use it as the default, or press ENTER to leave the current settings in place.

You can do this for other Java commands, such as the compiler (javac):

Copy

Other commands for which this command can be run include, but are not limited to: keytool, javadoc, and jarsigner.

Many programs written using Java use the JAVA_HOME environment variable to determine the Java installation location.

To set this environment variable, first determine where Java is installed. Use the update-alternatives command:

Copy

This command shows each installation of Java along with its installation path:

In this case the installation paths are as follows:

  1. OpenJDK 11 is located at /usr/lib/jvm/java-11-openjdk-amd64/bin/java.

  2. Oracle Java is located at /usr/lib/jvm/java-11-oracle/jre/bin/java.

Copy the path from your preferred installation. Then open /etc/environment using nano or your favorite text editor:

Copy

At the end of this file, add the following line, making sure to replace the highlighted path with your own copied path, and to not include the bin/ portion of the path:

/etc/environment

Modifying this file will set the JAVA_HOME path for all users on your system.

Save the file and exit the editor.

Now reload this file to apply the changes to your current session:

Copy

Verify that the environment variable is set:

Copy

You’ll see the path you just set:

Other users will need to execute the command source /etc/environment or log out and log back in to apply this setting.

2. Download and build dotCms

2.1 Build dotCms

go to and download taz file: https://github.com/dotCMS/core/releases/tag/v23.05

After gradle is done, you will find your newly built dotCMS distros (both tar and .zip) under the /core/dist-output folder. This is the complete dotCMS package, including a Tomcat app server needed to run dotCMS.

has two file build:

2.2 Install postgresql

follow the page

https://www.digitalocean.com/community/tutorials/how-to-install-postgresql-on-ubuntu-20-04-quickstart#step-4-creating-a-new-database and

Since the default “postgres” user does not have a password, you should set it yourself.

\password postgres

Add or edit the following line in your postgresql.conf :

Add the following line as the first line of pg_hba.conf. It allows access to all databases for all users with an encrypted password:

from user login: ssh_remote1

Restart Postgresql after adding this with service postgresql restart or the equivalent command for your setup. For brew, brew services restart postgresql

Create new user database

Follow the instruction

2.2 ElasticSearch

2.3 Setup dotCms

2.3.1. create database postgre called dotcms

Edit the database connection properties in the db.properties file $DOTCMS_HOME/dotserver/tomcat_X.X/webapps/ROOT/WEB-INF/classes/db.properties

DOTCMS_HOME = /home/ssh_remote1/dotcms/run

the full path:

2.3.2. Config ElasticSearch

2.3.3 run the dotCMS

edit server.xml

Last updated

Was this helpful?