Info |
---|
See Confluence Setup Archive for older versions of Confluence. |
Table of Contents |
---|
Introduction
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 Development Kit (JDKRun-time Engine (JRE)
- PostgreSQL
- Apache Web Server (optional)
Warning |
---|
It is recommended that you finish reading the article before starting. |
Here is a logical diagram of how Confluence will be setup,
Gliffy Diagram | ||||
---|---|---|---|---|
|
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.
Code Block |
---|
sudo apt-get install fontconfig |
PostgreSQL
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.
Install Confluence
Core Package
Download the Go to the Confluence download page and get the most recent Linux tar.gz install package and decompress it,
Code Block | ||
---|---|---|
| ||
su - serveradmin # if you are not already wget http://www.atlassian.com/software/confluence/downloads/binary/atlassian-confluence-4.0.5.tar.gz gunzip atlassian-confluence-4.0.5.tar.gz tar -xvpf atlassian-confluence-4.0.5.tar su - bhitch # log in as a staff user that can run sudo # Use specific version numbers. This will make upgrade easier in the future. sudo mv /home/serveradmin/atlassian-confluence-4.0.5/ /opt/ |
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.
Code Block | ||
---|---|---|
| ||
su - bhitch # log in as a staff user that can run sudo cd /opt # make a symbolic link which scripts and commands can run against sudo ln -s ./atlassian-confluence-4.0.5 ./confluence |
Manually Setup
...
JRE
I use a manual Java setup with an instance of Java specifically for the application.
Note |
---|
Make sure you are install a JDK and not a JRE. This is a requirement of Confluenceto ensure that the version of Confluence supports the JRE. |
Include Page | ||||
---|---|---|---|---|
|
Log in as your staff account which has sudo access to perform the actual move to /opt/
Code Block | ||
---|---|---|
| ||
cd /home/serveradmin sudo mv ./jdk1.6.0_29java/ /opt/confluence/java # moves and renames the directory in one step |
Configure Confluence to Use
...
JRE
The downloaded Confluence package is powered by Tomcat. You can specify Tomcat use a specific java directory by .
modifying the Confluence confluence/bin/setenv.sh file and test with confluence/bin/version.sh as described at Running Tomcat with a specific JRE version.
Warning |
---|
This can be improved by moving "how to specify java for Tomcat" out of the Tomcat 6 setup instructions into a separate page and then using an "include" here. |
Follow the section of Portable Tomcat 6.x & Instances described in the table below. Also make sure to adjust the file paths as shown,
Section | Tomcat | Confluence |
---|---|---|
Run Tomcat with a Specific Java Version Using setenv.sh | opt/apache/tomcat.1/bin/setenv.sh | /opt/confluence/bin/setenv.sh |
opt/apache/tomcat.1/bin/version.sh | /opt/confluence/bin/bin/version.sh |
Your resulting Confluence setenv.sh file will look like this,
Code Block | ||
---|---|---|
| ||
# See the CATALINA_OPTS below for tuning the JVM arguments used to start Confluence.
# Bonsaiframework - Modification Start
# --------------------------------------
JRE_HOME="$CATALINA_HOME"/java
JAVA_HOME="$CATALINA_HOME"/java
# --------------------------------------
# Bonsaiframework - Modification End
echo "If you encounter issues starting up Confluence, please see the Installation guide at http://confluence.atlassian.com/display/DOC/Confluence+Installation+Guide"
# set the location of the pid file
if [ -z "$CATALINA_PID" ] ; then
if [ -n "$CATALINA_BASE" ] ; then
CATALINA_PID="$CATALINA_BASE"/work/catalina.pid
elif [ -n "$CATALINA_HOME" ] ; then
CATALINA_PID="$CATALINA_HOME"/work/catalina.pid
fi
fi
export CATALINA_PID |
Now test with version.sh and you'll see something along these lines,
Code Block | ||
---|---|---|
| ||
./version.sh
If you encounter issues starting up Confluence, please see the Installation guide at http://confluence.atlassian.com/display/DOC/Confluence+Installation+Guide
Server startup logs are located in /opt/confluence/logs/catalina.out
Using CATALINA_BASE: /opt/confluence
Using CATALINA_HOME: /opt/confluence
Using CATALINA_TMPDIR: /opt/confluence/temp
Using JRE_HOME: /opt/confluence/java
Using CLASSPATH: /opt/confluence/bin/bootstrap.jar:/opt/confluence/bin/tomcat-juli.jar
Using CATALINA_PID: /opt/confluence/work/catalina.pid
Server version: Apache Tomcat/8.0.36
Server built: Jun 9 2016 13:55:50 UTC
Server number: 8.0.36.0
OS Name: Linux
OS Version: 4.15.0-54-generic
Architecture: amd64
JVM Version: 12.0.2+10
JVM Vendor: Oracle Corporation |
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.
Modify /opt/confluence/bin/startup.sh and /opt/confluence/bin/shutdown.sh as instructed in "Only Allow serveradmin to Run Tomcat" at Portable Tomcat 6.x & Instances.
Info |
---|
Confluence 4.x also introduced their own script files which 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. |
Follow the section of Portable Tomcat 6.x & Instances described in the table below. Also make sure to adjust the file paths as shown,
Section | Tomcat | Confluence |
---|---|---|
Only Allow serveradmin to Run Tomcat | /opt/apache/tomcat.1/bin/startup.sh | /opt/confluence/bin/startup.sh |
/opt/apache/tomcat.1/bin/shutdown.sh | /opt/confluence/bin/shutdown.sh |
Modify user.sh
As of Confluence 4.x, new start up scripts added,
...
Code Block | ||
---|---|---|
| ||
# START INSTALLER MAGIC ! DO NOT EDIT ! CONF_USER="serveradmin" ## # Only this user may run start-confluence.sh or stop-confluence.sh # END INSTALLER MAGIC ! DO NOT EDIT ! export CONF_USER |
Configure Data Directory
Also we need to create the home directory,
...
Panel |
---|
# confluence.home=c:/confluence/data |
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,
...
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,
Code Block | ||
---|---|---|
| ||
cd /opt
sudo find ./confluence/ -type d | sudo xargs -I{} chmod g+s {}
sudo find ./confluence-data/ -type d | sudo xargs -I{} chmod g+s {}
|
Configure PostgreSQL
Setup Database
These are the command line version of the instructions from Confluences wiki on setting up an external database.
...
First log into the PostgreSQL prompt as explain explained in PostgreSQL on Ubuntu.
Create the confluence database admin account.
Note |
---|
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.
Code Block | ||
---|---|---|
| ||
CREATE ROLE confluencedbuser LOGIN ENCRYPTED PASSWORD 'putYourPasswordHere' NOINHERIT VALID UNTIL 'infinity'; COMMENT ON ROLE confluencedbuser IS 'Account used by the Confluence application.'; |
The servers will respond to each respective command,
Code Block | ||
---|---|---|
| ||
CREATE ROLE
COMMENT |
Create the database.
Code Block | ||
---|---|---|
| ||
CREATE DATABASE confluencedb WITH ENCODING='UTF8' OWNER=confluencedbuser CONNECTION LIMIT=-1; |
...
Finally quit the PostgreSQL prompt,
Code Block | ||
---|---|---|
| ||
\qquit |
Note |
---|
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
Note |
---|
As of Confluence 4.x the PostgreSQL JDBC4 driver is up to date to match JDBC4. Originally there was a mismatch. This section is useful as a reference for future version mismatches or manual upgrades of the driver. |
You can download the most recent JDBC4 driver from the PostgreSQL website and place the jar file into 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,
Code Block | ||
---|---|---|
| ||
psql --version # this will return the version
psql (PostgreSQL) 9.3.9 |
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. Then delete the old JDBC4 driver.,
Code Block | ||
---|---|---|
| ||
su - serveradmin wgetcd http:/opt/jdbc.postgresql.org/download/confluence/confluence/WEB-INF/lib/ # delete the existing jar ls postgres* postgresql-9.12-9011002.jdbc4.jar rm /opt/confluence/confluence/WEB-INF/lib/postgresql-9.2-1002.jdbc4.jar # Delete the old jar file # In this case the version of Java and Postgres calls for using a newer jdbc41 driver, wget https://jdbc.postgresql.org/download/postgresql-9.03-8011103.jdbc4jdbc41.jar |
Starting the Confluence Service
We will now start Starting Confluence for the first time to initialize everythinginvolves going starting the process and using a wizard to build the initial database.
Tip |
---|
If using virtual machine technology, now would be a good time to take a snapshot of the system. |
Confluence 4.x introduces a new script to To start confluence,
Code Block | ||
---|---|---|
| ||
cd /opt/confluence/bin/ ./start-confluence.sh |
Next, hit visit the website with a browser, http://krypton:8090/ to start the first time configuration wizard.
Tip |
---|
If you have been following these notes on how to setup Ubuntu, your firewall may be enabled. Make sure to enable access to port 8090. |
Step through the configuration wizard and make the following selections,
...
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.
...
Code Block | ||
---|---|---|
| ||
kill 2364 # Note change 2364, to the process ID that you see on your screen. |
Initial Administrator Tasks
Warning |
---|
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. |
Optimize Confluence
Warning |
---|
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,
Warning |
---|
These instructions should be written with more detail. Particularly, "Setup email". |
- Disable automatic backup
- Setup email
- Update Confluence plugins
...
- 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.
Warning |
---|
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,
Code Block |
---|
User-agent: *
Disallow: /wiki/
|
Enable User Activity Logging
This is optional, but in an environment with sensitive data you may want to see what users are doing what,
https://confluence.atlassian.com/display/CONFKB/How+to+Enable+User+Access+Logging
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.
Warning |
---|
As of Confluence 6. or later, it is no longer endorsed to use only mod_jk to proxy. This is because Synchrony, which is required for collaborative editing, cannot accept AJP connections. The preferred configuration is Using Apache with mod_proxy. |
Enable Tomcat AJP Connector
First we must enable the the Connector. In this example we will use the standard port 9009 8009 in the Confluence Tomcat. Edit /opt/confluence/conf/server.xml.
...
Info |
---|
The UTF-8 is important as Confluence is developed to post using UTF-8. Without this setting errors occur when working with attachments containing special characters. Further details are covered in the Bonsai Tomcat Connector article. |
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 and change the 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
Warning |
---|
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
Warning |
---|
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 Confluece 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)
Database Password
Make sure you know the admin password for your database.
Java
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,
Code Block | ||
---|---|---|
| ||
su - serveradmin
cp -R /opt/confluence/java /opt/atlassian-confluence-4.3.2/java
exit
sudo ln -s ./atlassian-confluence-4.0.5 ./confluence |
Upgrade 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).
Key Files
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,
Tip |
---|
Verification of identified upgrade files history,
|
Merge the following key files,
- /opt/confluence/bin/setenv.sh
- /opt/confluence/conf/server.xml
- /opt/confluence/confluence/WEB-INF/classes/confluence-init.properties
- /opt/confluence/bin/shutdown.sh
- /opt/confluence/bin/startup.sh
- /opt/confluence/bin/user.sh (new to Confluence 4.x)
If you had enabled logging of user activity,
- /opt/confluence/confluence/WEB-INF/classes/log4j.properties
- opt/confluence/confluence/WEB-INF/web.xml
- /confluence/WEB-INF/classes/log4j.properties
If you use Araxis Merge and Expand Drive, I have developed a comparison script to quickly load all required files.
Panel | ||
---|---|---|
| ||
Note that for Solaris the file /opt/confluence/bin/start-confluence.sh, the call to the 'id' binary needs to be updated to point to '/usr/xpg4/bin/id' |
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
Special Modifications
You may choose to modify special files. For example, I modify the footer,
- /opt/confluence/confluence/decorators/includes/footer-content.vm
Update Symbolic Link
If you used a symbolic link as described in this article, make sure to update your symbolic link,
Code Block | ||
---|---|---|
| ||
cd /opt/
sudo rm confluence
sudo ln -s ./atlassian-confluence-4.3.2 ./confluence |
Plug-Ins
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
Info |
---|
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".
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.
Warning |
---|
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,
Code Block |
---|
User-agent: *
Disallow: /wiki/
|
Confluence Customizations
Ensure any customization done are carried over.
Enable Logging
... done up above list files...
Change favicon.ico
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.
Enable mod_rewrite
Code Block |
---|
sudo a2enmod rewrite
sudo /etc/init.d/apache2 restart |
Edit your virtual host file adding the following after the JKMount points,
Code Block |
---|
...
JkMount /wiki tomcat_confluence_a_worker
# Rewrite for favicon.ico
RewriteRule ^/wiki/favicon.ico$ /favicon.ico |
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/
System Profile
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.
Code Block | ||
---|---|---|
| ||
<property name="confluence.setup.server.id">XXXX-XXXX-XXXX-XXXX</property> |
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.
Code Block | ||
---|---|---|
| ||
sudo -u postgres psql postgres
\connect DBNAME |
Now check the server ID and then change it if needed.
Code Block | ||
---|---|---|
| ||
select * from BANDANA where bandanakey = 'confluence.server.id';
bandanaid | bandanacontext | bandanakey | bandanavalue
-----------+----------------+----------------------+--------------------------------------
4 | _GLOBAL | confluence.server.id | <string>BBP9-O5SW-YSZW-GWLR</string>
(1 row) |
Update the ID if it does not match the ID in confluence.cfg.xml.
Code Block | ||
---|---|---|
| ||
update BANDANA set bandanavalue = '<string>XXXX-XXXX-XXXX-XXXX</string>' where bandanakey = 'confluence.server.id'; |
Now start confluence and check the License Details for your changes and update your License key accordingly.