/ Team Collaboration

Confluence on CentOS

Confluence is a remarkable wiki and collaboration system. This article describes a step-by-step procedure for installing Atlassian Confluence 5.3 on a CentOS 5 Linux server.

The following steps (and commands) assume root level SSH access to the CentOS server.

Install and Configure PostgreSQL

yum install postgresql
yum install postgresql-server

Enable and start PostgreSQL as a service.

checkconfig postgresql on
service postgresql start

Set the postgres super-user password. The postgres super-user account will be used for PostgreSQL related configurations.

sudo passwd postgres

Create a Confluence PostgreSQL database (confluence) and the associated account (atlassian):

# Login to PostgreSQL with super-user.
su - postgres
 
# Create the 'atlassian' user:
createuser -S -d -r -P -E atlassian
 
# Create the 'confluence' database:
createdb --owner atlassian --encoding utf8 confluence
exit

Assuming that PostgreSQL 9.x is being used, edit /var/lib/pgsql/data/pg_hba.conf and replace the following line:

host    all    all    127.0.0.1/32    ident    sameuser

with:

host    all    all    127.0.0.1/32    md5

With this change the local authentication to the PostgreSQL database server will support MD5-hash on user credentials. Without this change, the Confluence direct JDBC connection won’t authenticate successfully.

Restart the PostgreSQL service.

service postgresql restart

Install and Configure Confluence

Create a temporary location on your CentOS server for downloading the Confluence installer:

mkdir -p /software/confluence
cd /software/confluence

From the Confluence download page download the Confluence 5 installer package, depending on your platform (e.g. Confluence 5.3 32-bit Linux Installer).

wget http://www.atlassian.com/software/confluence/downloads/binary/atlassian-confluence-5.3-x32.bin

You may have to make the archive/installer executable, before running it.

chmod a+x atlassian-confluence-5.3-x32.bin
./atlassian-confluence-5.3-x32.bin

For default installation choose Express Install (uses default settings): [1] followed by Install as service: Yes. You should get an output similar to:

By default, Confluence 5.3 is listening on port 8090 (within the Tomcat web server). You can change this port by editing the /opt/atlassian/confluence/conf/server.xml file. Here you can also modify the URI path (i.e. context path) corresponding to Confluence. Assuming that eventually Confluence and JIRA will run on the same server, differentiating between the URI paths would be handy (e.g. https://<server>/confluence and https://<server>/jira), while being able to access them both through HTTP/S on the same target port (e.g. 443, or 80). In this case we’ll have to configure a virtual host and proxy for each application, Confluence and JIRA, in a front-end web-server.

<Connector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8090" minProcessors="5"
    ...
    <Context path="/confluence" docBase="../confluence" debug="0" reloadable="false" useHttpOnly="true">
        ...
        <Manager pathname="/confluence" />
        ...
    </Context>
    ...
</Connector>

Assuming Apache is used as the web-server endpoint serving Confluence (and JIRA) application requests, next we need to configure the virtual host corresponding to Confluence.

Configure Apache

Apache HTTP server (httpd) is typically installed on CentOS, by default. If Apache is not installed you can do so, running the following commands:

yum install httpd
chkconfig --levels 36 httpd on

Edit the /etc/httpd/conf/httpd.conf file and add the following configuration section at the very end (this block may already exist in the httpd.conf file, so you may only have to uncomment the relevant lines, as follows):

<IfModule mod_proxy.c>
    <Proxy *>
        Order allow,deny
        Allow from all
    </Proxy>
</IfModule>

Next, create a file named /etc/httpd/conf.d/vhost.conf with the following contents, replacing confluence.example.com with your actual domain name. Please note that you will need to add an “A” record to your DNS configuration to point the site to your public IP address. This example assumes that Confluence will be running on its default port (8090).

NameVirtualHost *:80

<VirtualHost *:80>
     ServerAdmin support@example.com
     ServerName confluence.example.com
     ProxyPass / http://localhost:8090/
     ProxyPassReverse / http://localhost:8090/
</VirtualHost>

(A similar virtual host would be required for JIRA as well, if you install it on the same server with Confluence). For the new changes to take effect, you need to restart Apache and Confluence:

service httpd start
service confluence start

Confluence Setup

If you followed the steps in configuring the virtual host for Confluence, you should be able to direct your browser to the Confluence URI: http://<your_server>/confluence (where <your_server> could be the fully qualified domain name that has been configured in the Confluence virtual host configuration section).

Follow the Confluence configuration wizard. Here are the relevant steps for completing the Confluence setup with the PostgreSQL database backend:

Enter License

Copy/paste the Server ID value show in the configuration wizard into your Atlassian Confluence account (available at https://my.atlassian.com) and get the corresponding license key.

Choose Installation Type

Select Production Installation (this will prompt you to configure your database connectivity next)

Choose a Database Configuration

Select External Database (this will prompt you to configure the PostgreSQL JDBC connectivity next)

Configure Database

Select Direct JDBC Connection
Driver Class Name: org.postgresql.Driver
Database URL: jdbc:postgresql://localhost:5432/confluence
User name: atlassian
Password: **********

The next steps in the Configuration setup wizard will prompt you for loading content, configuring the Confluence administrator account, etc.