See Confluence Setup Archive for older versions of Confluence.
Confluence is a knowledge management system. If you are not sure why you would want to use Confluence, you might want to read the Introduction to Knowledge Management.
This article takes you through a Confluence 4.x setup using the following software stack,
- Confluence Standalone (includes its own embedded Tomcat) for Linux
- Java Run-time Engine (JRE)
- Apache Web Server (optional)
Here is a logical diagram of how Confluence will be setup,
Ideally your system should have about 3 GB of memory set aside for Confluence. If you stay below Confluence 6.0 (before Synchrony was introduced) you would get away with 2GB of Memory using Java 32-bit.
Install Required Dependent OS Packages
Confluence and in turn Java uses fonts to export to pdf and show powerpoint slides. According to Oracle for Solaris and Unix there is a requirement for valid X11 fonts.
Confluence comes with its own embedded database called hsqldb. However, for real production use you should use a full fledged database like PostgreSQL. It is recommended to install a supported version.
Install PostgreSQL on Ubuntu
Install PostgreSQL on Ubuntu.
Go to the Confluence download page and get the most recent Linux tar.gz install package and decompress it,
Next, we make the symbolic link directory. Scripts and anything else you do will use the symbolic link directory. When the new version of Confluence comes along you have various options for upgrading.
Manually Setup JRE
I use a manual Java setup with an instance of Java specifically for the application.
Make sure to ensure that the version of Confluence supports the JRE.
Use the account that will be launching the Java process. In this example it will be serveradmin,
The steps for JRE and JDK are both the same. Here is an example of a JRE setup,
The result will be an uncompressed jre directory using the same name as the package. In this example the folder name would be, jre-7u7-linux-x64.
If you plan to use multiple versions of Java, we recommend keeping the folder name with the version number information and using symbolic links. If you are only using one version of Java, then simply rename the folder.
For the server example, we will rename the folder,
You may be interested in how to Zero Footprint Java on Windows.
Log in as your staff account which has sudo access to perform the actual move to /opt/
Configure Confluence to Use JRE
The downloaded Confluence package is powered by Tomcat. You can specify Tomcat use a specific java directory.
modifying the Confluence /setenv.sh file and test with version.sh
Follow the section of Portable Tomcat 6.x & Instances described in the table below. Also make sure to adjust the file paths as shown,
|Run Tomcat with a Specific Java Version Using setenv.sh||opt/apache/tomcat.1/bin/setenv.sh||/opt/confluence/bin/setenv.sh|
Your resulting Confluence setenv.sh file will look like this,
Now test with version.sh and you'll see something along these lines,
Configure Confluence to Only Start and Stop with ServerAdmin
To prevent read errors and for security purposes we want Confluence to only run as with the operating account serveradmin.
Confluence 4.x introduced their own script files to also perform this check when running start-confluence.sh and stop-confluence.sh. However, admins can still accidentally run startup.sh or shutdown.sh.
|Only Allow serveradmin to Run Tomcat||/opt/apache/tomcat.1/bin/startup.sh||/opt/confluence/bin/startup.sh|
As of Confluence 4.x, new start up scripts added,
- /opt/confluence/bin/start-confluence.sh (which still calls startup.sh)
- /opt/confluence/bin/stop-confluence.sh (which still calls shutdown.sh)
These scripts also rely on the file /opt/confluence/bin/user.sh which sets what user is allowed to start and stop Confluence. Normally this file is populated by the installer script. Since we are doing a manual install modify user.sh as follows,
Configure Data Directory
Also we need to create the home directory,
As serveradmin, set the home (data) directory by adding confluence.home to the bottom of, /opt/confluence/confluence/WEB-INF/classes/confluence-init.properties,
Optional Restrict Access to Confluence Folders
In a multipurpose environment, you may want to restrict access to the Confluence folders. The BonsaiFramework uses the following approach,
serveradmin user = Start, Stop and install Confluence
serveradmin group = Created by default but not outright used.
staff group = Provided to trusted staff who administer the server. Staff users are granted read only access to monitor logs if they need to troubleshoot the system.
other = The other permission grants absolutely no access. For example, imagine another process using user appx is compromised. The userid appx will not be able to view any Confluence files.
As such the following additional permission are set,
Now only users belonging to staff or serveradmin can view the Confluence folders.
However, this is not enough. Any new files created in those directories will change to what the particular user has set in terms of that user's groups. This also includes the process user serveradmin. The log files created when Confluence start will belong to serveradmin user and serveradmin group - which we don't want. So to fix this we tell the Directories to set the setgid bit,
These are the command line version of the instructions from Confluences wiki on setting up an external database.
The commands were derived from the visual guide by Confluence.
First log into the PostgreSQL prompt as explained in PostgreSQL on Ubuntu.
Create the confluence database admin account.
Make sure to change putYourPasswordHere to a secure password.
If following the Bonsaiframework Server Standards, the password would use an algorithm based on the server name.
Create the database.
If all goes well the response will be,
Finally quit the PostgreSQL prompt,
The name of the database is different than in the confluence documentation. Rather than the database name confluence, we use confluencedb to clearly designate a database.
Check Updated JDBC Driver
Generally, Confluence is pretty good at packaging the most up to date JDBC driver or their supported databases and you can skip this step.
However, for enterprise class systems, it is a good idea to check if there is an important update available.
For example, we had one situation where the particular version of the PostgreSQL JDBC driver had a memory leak that would crash Confluence. Determine your version of PostgreSQL by logging into the server running the database and executing,
Downloading the matching JDBC driver from the PostgreSQL website. Review the chart showing version of Java with Postgres. Replacing the old jar the /opt/confluence/confluence/WEB-INF/lib/ directory,
Starting the Confluence Service
Starting Confluence for the first time involves going starting the process and using a wizard to build the initial database.
If using virtual machine technology, now would be a good time to take a snapshot of the system.
To start confluence,
Next, visit the website with a browser, http://krypton:8090/ to start the first time configuration wizard.
Step through the configuration wizard and make the following selections,
- Choose Product Installation
- Makes sure PostgreSQL is selected (it should be by default) click External Database.
- Click Direct JDBC
- Fill out the form,
- Database URL: Change the default line, jdbc:postgresql://localhost:5432/confluence to jdbc:postgresql://localhost:5432/confluencedb
- User: confluencedbuser
- Pass: the pasword you used earlier to create the confluencedb user
- Click Next
At this point if you happen to be monitoring your system you should see a spike in CPU and confluence slowly taking up more memory. Be patient as this step can take a few minutes as the tables and contents of the database are generated.
If all goes well the you will be prompted to Load Content. You can opt to load some default content, start with a blank slate or restore from backed up data if you are rebuilding from a previous installation of Confluence.
The intial user will be called "Server Admin" with user name serveradmin. Use a special email for this account and keep in mind that Confluence enforces that email addresses must be unique across all users.
Stopping the Service
There appears to be a problem with shutting down the Confluence server. According to Atlassian, this only happens on certain configuration and they are not able to determine yet why. I have personally experienced with every type of Virtualized Ubuntu system I have setup over the past few years. It seems to occur once there is 2-3 users worth of activity and data in the wiki.
This shutdown bug has been resolved with Confluence 4.x, however, it is good practice to verify that everything shut down properly.
Start by performing a normal shutdown,
Next ensure that Confluence actually shut down,
The resulting output shows all your java processes. Ensure that you Confluence java process does not exist. It should looks something similar to below,
If it does not exist then the shutdown occurred properly. If it does exist, wait a few minutes and run the above ps command again. The shutdown process can be slow.
If the Confluence process still exists after a few minutes you need to kill the process,
Initial Administrator Tasks
TBC - This section still needs to be written to take the user through setting up the base url, creating their first space with subsections to disabling automatic backup, how to do real backups and any other important activities.
These instructions should be written with more detail. Particularly, "Setup email".
There are some basic tasks we should do before getting other people on board.
Once logged in go to, Browser, Confluence Admin. There are tasks there that Confluence recommends, the most important to us being,
- Setup email
- Update Confluence plugins
Disable Search Engine Indexing
In the case of a private site, you may not want Google or any other search engine to crawl your wiki. Even in the case of a password protected site this will still happen and take up unnecessary bandwidth, processing and bump up the amount of memory consumed by Confluence.
This content needs to be refined and should in fact link to a detailed article on robots.txt and other ways of preventing crawling.
If you had been following the steps outline by the Bonsai Framework the Confluence configuration will be,
- Fronted by Apache
- The root of the website is located at /home/www.krypton.com/www
- The mapping from Apache to Confluence is /wiki/
As such, robots.txt will be placed in the root of the website and look like this,
Enable User Activity Logging
This is optional, but in an environment with sensitive data you may want to see what users are doing what,
Connect Apache to Confluence
As this install of Confluence is powered by Tomcat we can front Confluence with the Apache Web Server.
First start with setting up your Web Server.
Connect Apache to Confluence using mod_Proxy
Connect Apache to Confluence using mod_JK
Start by reviewing the generic instructions to configure Tomcat (the engine that Confluence uses) with Apache using mod_jk.
Enable Tomcat AJP Connector
First we must enable the the Connector. In this example we will use the standard port 8009 in the Confluence Tomcat. Edit /opt/confluence/conf/server.xml.
Add the Connector directive <Connector port="8009" protocol="AJP/1.3 "URIEncoding="UTF-8" /> just above the Engine directive,
Select and Enable Context Path
Often you want to use the Apache Web Server to front more than one web application. In order to do this you want each web application to work within it's own context. This is pretty standard in most java applications. As such, we will pick a context path, in this case "wiki". As such the original url, http://localhost:8090/ changes to http://localhost:8090/wiki
Modify the bundled Confluence Tomcat Context directive by modifying the file, /opt/confluence/conf/server.xml changing the attribute path="" to path="/wiki",
This change does not take effect until the Confluence service stopped and started again. We will do that in the the next section.
Configure Apache Tomcat Connector
Still need to fill in clearer instructions on this topic.
Once port 8009 is enabled, mod_jk can be enabled by following the Apache Tomcat Connector instructions.
Change Base URL in Confluence
Put instructions here about changing the base url if fronted by Apache.
Verify Internationalization Features
Even if you do not plan to have the wiki work for multiple languages, you should verify the internationalization is working properly just to handle special characters.
Visit the http://<host address>:<port>/admin/encodingtest.action url on your system and follow the instructions.
Future Upgrade Notes
As part of planning for future upgrades here is a checklist to keep in mind. As an example, we will be upgrading from Confluence 4.0.5 to 4.3.2.
Review the Upgrade and Release Notes
Take note of any significant changes, especially between larger release numbers.
Backup Your Data
It goes without saying, backup your data. With Cloud and Virtual computing take a snap shot. With manual backups you can use Confluence's built in backup utility through the web interface (to do: provide link to instructions) or manually make the following backups,
- TAR and Compress the Confluence data home folder for backup purposes
- Backup the database using your database management tools (will link to Roderick's articles on backing up of PostgreSQL here)
Make sure you know the admin password for your database.
Make sure to copy over the java folder or take this opportunity to install an updated version of Java.
Copy Existing Java
To copy the existing version of Java,
Follow the steps in this article about how to Manually Setup the JRE.
Check Database Driver
Check that the version of Java and the Postgres JDBC version match up and and update accordingly (see setup instructions in this same article for details).
Over time this may change, for example the user.sh file was added when moving between Confluece 3.x and 4.x. So, whoever does the upgrade please update the notes below,
Verification of identified upgrade files history,
- November 2012, Confluence 4.3 to 4.3.3 by Tin.
- October 2012, Confluence 4.2 to 4.3.2 by Dickson.
Merge the following key files,
- /opt/confluence/bin/user.sh (new to Confluence 4.x)
If you had enabled logging of user activity,
If you use Araxis Merge and Expand Drive, I have developed a comparison script to quickly load all required files.
Optionally, if there was a version mismatch with the jdbc driver,
- /opt/confluence/confluence/WEB-INF/lib/postgresql-8.4-701.jdbc4.jar - add
- /opt/confluence/confluence/WEB-INF/lib/postgresql-8.4-701.jdbc3.jar - remove
You may choose to modify special files. For example, I modify the footer,
Update Symbolic Link
If you used a symbolic link as described in this article, make sure to update your symbolic link,
Also, keep a page listing any plug-ins you install. Upgrades generally do not require you to reinstall the plugins but they might be deprecated. After the upgrade is done, login as Administrator on Confluence and ensure plug-ins are up to date.
Our recommended list of plugins,
- Gliffy - Draw Visio like diagrams right in the browser
Check out the Confluence Plugins page for more details.
Check Administration Console
The Administration Console may also have messages for you to run specific tasks with instructions. For example when upgrading from 3.5.4 to 4.1, "Update content with incompatible upgraded macros".
Ensure any customization done are carried over.
... done up above list files...
Currently, Confluence does not provide an easy way to change the favicon.ico that will persist after an upgrade. If you want this feature, vote for this request on Jira. Otherwise, a good solution may be implemented using Apache's mod_rewrite.
Edit your virtual host file adding the following after the JKMount points,
Make sure to change /wiki/ if you decided to deviate from this tutorial.
Finally drop a favicon.ico into your virtual host's root directory. In this example, /home/www.krypton.com/www/
Using htop, initial setup without any spaces created is 396MB. The process itself uses VIRT=913M and RES=338M.
Changing the Server ID
If you are migrating a Confluence instance to a new server and the Server ID was not changed after a full restore.
Check the confluence.cfg.xml located in the confluence-data directory there will be a line listed.
Stop Confluence and make sure to do a back up of this server ID as it can make your confluence unusable if you make a mistake.
Change the Server ID in this line and save it. Now you will need to make sure it is also in the confluence database.
Login to your confluence database, here is how it can be done with postgres user.
Now check the server ID and then change it if needed.
Update the ID if it does not match the ID in confluence.cfg.xml.
Now start confluence and check the License Details for your changes and update your License key accordingly.