How to install Confluence on CentOS 7

In this tutorial I will show you how to install Confluence on CentOS 7.

Confluence is a team collaboration software. Written in Java and mainly used in corporate environments, it is developed and marketed by Atlassian. Confluence is sold as either on-premises software or as software as a service.

Prerequisites

  • CentOS 7 must be installed
  • Java 8 must be installed

Install MariaDB

First of all we need MariaDB.

Use the following link to install MariaDB.

How to install MariaDB 10 on CentOS 7

Read Also: How to install PostgreSQL 10 on Ubuntu

Create Database

After installing Mariadb we will create a user and password for confluence.

 

Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.56-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> CREATE DATABASE confluence CHARACTER SET utf8 COLLATE utf8_bin;
Query OK, 1 row affected (0.01 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON confluence.* TO 'confluence'@'localhost' 
IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit
Bye

Download the Confluence

For downloading latest confluence we need to go to the Atlasssian Official website or use wget to download the

wget https://www.atlassian.com/software/confluence/downloads/binary/atlassian-confluence-6.5.1-x64.bin

Make file executable

chmod +x atlassian-confluence-6.5.1-x64.bin

Install Confluence

[root@installvirtual ~]# ./atlassian-confluence-6.5.1-x64.bin
Unpacking JRE ...
Starting Installer ...
Nov 20, 2017 3:58:23 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
Nov 20, 2017 3:58:23 PM java.util.prefs.FileSystemPreferences$2 run
INFO: Created system preferences directory in java.home.

This will install Confluence 6.5.1 on your computer.
OK [o, Enter], Cancel [c]
o
Choose the appropriate installation or upgrade option.
Please choose one of the following:
Express Install (uses default settings) [1],
Custom Install (recommended for advanced users) [2, Enter],
Upgrade an existing Confluence installation [3]
1
See where Confluence will be installed and the settings that will be used.
Installation Directory: /opt/atlassian/confluence
Home Directory: /var/atlassian/application-data/confluence
HTTP Port: 8090
RMI Port: 8000
Install as service: Yes
Install [i, Enter], Exit [e]
i

Extracting files ...

 

Please wait a few moments while we configure Confluence.
Installation of Confluence 6.5.1 is complete
Start Confluence now?
Yes [y, Enter], No [n]
n
Installation of Confluence 6.5.1 is complete
Finishing installation ...

Download MySQL JDBC Driver

We also need MySQL JDBC driver for confluence so execute the following commands to download, extract and mv the driver to the required directory

wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.44.tar.gz
tar -xvf mysql-connector-java-5.1.44.tar.gz
cd mysql-connector-java-5.1.44
mv mysql-connector-java-5.1.44-bin.jar /opt/atlassian/confluence/confluence/WEB-INF/lib/

Configure the datasource in Tomcat

Next, add the datasource configuration to Tomcat.

Edit /opt/atlassian/confluence/conf/server.xml and find the following lines.

<Context path="" docBase="../confluence" debug="0" reloadable="true">
<!-- Logger is deprecated in Tomcat 5.5. Logging configuration for Confluence is
specified in confluence/WEB-INF/classes/log4j.properties -->

Insert the following DataSource  Resource  element for your specific database directly before  <!-- Logger is deprecated in Tomcat 5.5.

<Resource name="jdbc/confluence" auth="Container" type="javax.sql.DataSource"
username="confluence"
password="password"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/confluence?useUnicode=true&amp;characterEncoding=utf8"
maxTotal="60"
maxIdle="20"
defaultTransactionIsolation="READ_COMMITTED"
validationQuery="Select 1"/>

Replace user and password with yours.

Configure the Confluence web application

Configure Confluence to use this datasource. Edit  /opt/atlassian/confluence/confluence/WEB-INF/web.xml and add the following in the second last line just before  </web-app>

<resource-ref>
<description>Connection Pool</description>
<res-ref-name>jdbc/confluence</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

Start Confluence

Now after adding all the configuration now we will start confluence.

sh /opt/atlassian/confluence/bin/start-confluence.sh

Consider sharing this article: