Wiki source code of Confluence Install Cookbook
Version 3.1 by Normann P. Nielsen on 2026/11/15 15:43
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | {{toc/}} | ||
| 2 | |||
| 3 | = Requirements = | ||
| 4 | |||
| 5 | === Atlassian === | ||
| 6 | See [[https://confluence.atlassian.com/display/DOC/System+Requirements]] for newest requirements | ||
| 7 | |||
| 8 | === OS and Hardware Settings === | ||
| 9 | **Virtual: **Why not - the benefits are huge | ||
| 10 | |||
| 11 | **Preferred OS:** Ubuntu LTS 64-bit (this Cookbook is 90% Linux orientated) | ||
| 12 | |||
| 13 | **Hardware:** At least 2 vCPU's and at least 3 GB Ram | ||
| 14 | |||
| 15 | === Mysql Settings === | ||
| 16 | **Preferred Database:** MySQL (or Postgres) | ||
| 17 | |||
| 18 | Settings for MySQL (ref: [[MySQL>>http://confluence.atlassian.com/display/DOC/Database+Setup+For+MySQL]]) | ||
| 19 | |||
| 20 | |||
| 21 | {{code language="my.cnf"}} | ||
| 22 | [mysqld] | ||
| 23 | transaction-isolation = READ-COMMITTED | ||
| 24 | log-bin=mysql-bin | ||
| 25 | binlog_format=row | ||
| 26 | default-storage-engine=innodb | ||
| 27 | max_allowed_packet=64M | ||
| 28 | |||
| 29 | [mysql] | ||
| 30 | default-character-set=utf8 | ||
| 31 | |||
| 32 | |||
| 33 | [mysqldump] | ||
| 34 | max_allowed_packet=64M | ||
| 35 | {{/code}} | ||
| 36 | |||
| 37 | Notice that max_allowed_packed=64M, where as [[this link>>https://confluence.atlassian.com/display/CONFKB/Exceeds+Max+Allowed+Packet+for+MySQL]] says 32M, I have seen Gliffy updates fail with 32M | ||
| 38 | |||
| 39 | On large installations or where indexes are huge, changing ##innodb_lock_wait_timeout## can be an option (Ref: [[JIRAKB>>https://confluence.atlassian.com/display/JIRAKB/Reindexing+JIRA+Results+in+Communications+Link+Failure+During+Commit]]) | ||
| 40 | |||
| 41 | |||
| 42 | {{code language="my.cnf"}} | ||
| 43 | [mysqld] | ||
| 44 | innodb_lock_wait_timeout = 300 | ||
| 45 | {{/code}} | ||
| 46 | |||
| 47 | |||
| 48 | |||
| 49 | === Mail === | ||
| 50 | SMTP Access for sending mail | ||
| 51 | |||
| 52 | IMAP Access for picking up mail | ||
| 53 | |||
| 54 | |||
| 55 | |||
| 56 | = Installation = | ||
| 57 | |||
| 58 | === Prepare database === | ||
| 59 | Create the Database | ||
| 60 | |||
| 61 | |||
| 62 | {{code}} | ||
| 63 | mysql> create database confluence CHARACTER SET utf8 COLLATE utf8_bin; | ||
| 64 | mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER,INDEX on confluence.* to confluence@localhost identified by '*******'; | ||
| 65 | Query OK, 0 rows affected (0.00 sec) | ||
| 66 | {{/code}} | ||
| 67 | |||
| 68 | |||
| 69 | |||
| 70 | === Install binaries === | ||
| 71 | Download Confluence from [[http://www.atlassian.com/software/confluence/download]] | ||
| 72 | |||
| 73 | Download the MySQL JDBC from [[http://dev.mysql.com/downloads/connector/j/]] | ||
| 74 | |||
| 75 | For the binary installer, JAVA is integrated, for EAR or WAR files this must be downloaded and installed separately. | ||
| 76 | |||
| 77 | |||
| 78 | {{code}} | ||
| 79 | sh ./atlassian-confluence-5.1.1-x64.bin | ||
| 80 | {{/code}} | ||
| 81 | |||
| 82 | Follow the required steps (remember path to Confluence_Install and Confluence_Home) and connect to the tomcat instance started; if the MySQL Driver can be found, restart the Tomcat. | ||
| 83 | |||
| 84 | |||
| 85 | |||
| 86 | = Postinstall = | ||
| 87 | |||
| 88 | This is where the tweaking comes into place, to avoid common problems: | ||
| 89 | |||
| 90 | === confluence.cfg.xml === | ||
| 91 | This file is found in Confluence_Home | ||
| 92 | |||
| 93 | Change the number of Database connections to higher than standard | ||
| 94 | |||
| 95 | |||
| 96 | {{code}} | ||
| 97 | <property name="hibernate.c3p0.max_size">50</property> | ||
| 98 | {{/code}} | ||
| 99 | |||
| 100 | Make sure that the //?autoReconnect=true// is on the jdbc connection | ||
| 101 | |||
| 102 | |||
| 103 | {{code}} | ||
| 104 | <property name="hibernate.connection.url">jdbc:mysql://localhost/confluence?autoReconnect=true&sessionVariables=storage_engine%3DInnoDB</property> | ||
| 105 | {{/code}} | ||
| 106 | |||
| 107 | === setenv.sh === | ||
| 108 | This file is found in the Confluence_Install/bin | ||
| 109 | |||
| 110 | Read [[Garbage Collector Performance Issues>>https://confluence.atlassian.com/display/DOC/Garbage+Collector+Performance+Issues]] for settings | ||
| 111 | |||
| 112 | Add support for UTF-8 File system by adding //-Dfile.encoding=UTF-8// to the JAVA_OPTS: | ||
| 113 | |||
| 114 | |||
| 115 | {{code}} | ||
| 116 | JAVA_OPTS="-Xms1024m -Xmx1024m -XX:MaxPermSize=512m $JAVA_OPTS -Djava.awt.headless=true -XX:NewSize=512m -Dfile.encoding=UTF-8" | ||
| 117 | export JAVA_OPTS | ||
| 118 | {{/code}} | ||
| 119 | |||
| 120 | Tweaking of memory and usage comes in play here, I prefer this for a 4 GB Server: | ||
| 121 | |||
| 122 | |||
| 123 | {{code}} | ||
| 124 | JAVA_OPTS="-Xms2048m -Xmx2048m -XX:MaxPermSize=512m -Djava.awt.headless=true -XX:NewSize=700m -XX:+UseParallelGC -Dsun.rmi.dgc.client.gcInterval=900000 -Dsun.rmi.dgc.server.gcInterval=900000 -XX:+DisableExplicitGC -Dfile.encoding=UTF-8" | ||
| 125 | export JAVA_OPTS | ||
| 126 | {{/code}} | ||
| 127 | |||
| 128 | For saving Garbage Collection in /pack/confluence/logs/gc.log for debugging | ||
| 129 | |||
| 130 | |||
| 131 | {{code}} | ||
| 132 | JAVA_OPTS="-Xms2048m -Xmx2048m -XX:MaxPermSize=512m -Djava.awt.headless=true -verbose:gc -Xloggc:/pack/confluence/logs/gc.log -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -XX:NewSize=700m -XX:+UseParallelGC -Dsun.rmi.dgc.client.gcInterval=900000 -Dsun.rmi.dgc.server.gcInterval=900000 -XX:+DisableExplicitGC -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/backup/hdump -Dfile.encoding=UTF-8" | ||
| 133 | export JAVA_OPTS | ||
| 134 | {{/code}} | ||
| 135 | |||
| 136 | If You are planning to run under the same Fully Qualified Domain - review [[https://jira.atlassian.com/browse/JRA-8726]] | ||
| 137 | |||
| 138 | === server.xml === | ||
| 139 | This file is found in Confluence_Install/conf | ||
| 140 | |||
| 141 | Binding to a fixed IP Address, add the //address=// to the connector. Also the //port=// can be changed (Under Linux only root can bond to 0-1023): | ||
| 142 | |||
| 143 | |||
| 144 | {{code}} | ||
| 145 | <Connector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8080" address="10.0.0.10" minProcessors="5" | ||
| 146 | maxProcessors="75" | ||
| 147 | enableLookups="false" redirectPort="8443" acceptCount="10" debug="0" connectionTimeout="20000" | ||
| 148 | useURIValidationHack="false" /> | ||
| 149 | {{/code}} | ||
| 150 | |||
| 151 | To secure correct UTF-8 Handling, add URIEncoding="UTF-8" to the connector: | ||
| 152 | |||
| 153 | |||
| 154 | {{code}} | ||
| 155 | <Connector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8080" address="10.0.0.10" minProcessors="5" | ||
| 156 | maxProcessors="75" | ||
| 157 | enableLookups="false" redirectPort="8443" acceptCount="10" debug="0" connectionTimeout="20000" | ||
| 158 | useURIValidationHack="false" URIEncoding="UTF-8" /> | ||
| 159 | {{/code}} | ||
| 160 | |||
| 161 | If behind a traffic Manager or Apache Proxy, add //scheme=, proxyName= and proxyPort// to the context t (See [[Apache2 Proxy Passing>>Main.information-technology.apache2-webserver.apache2-proxy-passing]] or Proxy Passing section belov):: | ||
| 162 | |||
| 163 | |||
| 164 | {{code}} | ||
| 165 | <Context path="" docBase="../confluence" debug="0" reloadable="false" useHttpOnly="true" scheme="https" proxyName="jira.example.com" proxyPort="443"> | ||
| 166 | {{/code}} | ||
| 167 | |||
| 168 | If the Tomcat needs to travel through symbolic links on the filesystem, add the //allowLinking="true"// to the context: | ||
| 169 | |||
| 170 | **Tomcat 7.X** - This is in server.xml | ||
| 171 | |||
| 172 | |||
| 173 | {{code}} | ||
| 174 | <Context path="" docBase="../confluence" debug="0" reloadable="false" useHttpOnly="true" allowLinking="true"> | ||
| 175 | {{/code}} | ||
| 176 | |||
| 177 | **Tomcat 8.X** - This is in context.xml | ||
| 178 | |||
| 179 | |||
| 180 | {{code}} | ||
| 181 | <Context> | ||
| 182 | <Resources allowLinking="true" /> | ||
| 183 | </Context> | ||
| 184 | {{/code}} | ||
| 185 | |||
| 186 | |||
| 187 | |||
| 188 | If the Confluence instance need to run below root /, change the //path=// parameter: | ||
| 189 | |||
| 190 | |||
| 191 | {{code}} | ||
| 192 | <Context path="/confluence" docBase="../confluence" debug="0" reloadable="false" useHttpOnly="true" allowLinking="true"> | ||
| 193 | {{/code}} | ||
| 194 | |||
| 195 | Its possible to increase maxPostSize for faster page rending - [[https://confluence.atlassian.com/display/CONFKB/Slow+Page+Rendering+of+Large+Pages+Due+to+HTTP+POST+Limitations]] | ||
| 196 | |||
| 197 | === Confluence running as Confluence user === | ||
| 198 | {{error}}Please notice that only root can bind to ports below 1024, so running as a normal user requires port usage above or stuff like a Apache Proxy, StingRay Manager or other port-switching tool{{/error}} | ||
| 199 | |||
| 200 | Make sure Confluence is not running as root (for security reasons); look at Confluence_Install/bin/user.sh for a username: | ||
| 201 | |||
| 202 | |||
| 203 | {{code}} | ||
| 204 | # START INSTALLER MAGIC ! DO NOT EDIT ! | ||
| 205 | CONF_USER="confluence" ## | ||
| 206 | # END INSTALLER MAGIC ! DO NOT EDIT ! | ||
| 207 | export CONF_USER ## | ||
| 208 | {{/code}} | ||
| 209 | |||
| 210 | |||
| 211 | |||
| 212 | And check the startup script /etc/init.d/confluence look like this (with the right path): | ||
| 213 | |||
| 214 | |||
| 215 | {{code}} | ||
| 216 | #!/bin/bash | ||
| 217 | # Confluence Linux service controller script | ||
| 218 | cd "/pack/confluence/bin" | ||
| 219 | case "$1" in | ||
| 220 | start) | ||
| 221 | ./start-confluence.sh | ||
| 222 | ;; | ||
| 223 | stop) | ||
| 224 | ./stop-confluence.sh | ||
| 225 | ;; | ||
| 226 | restart) | ||
| 227 | ./stop-confluence.sh | ||
| 228 | ./start-confluence.sh | ||
| 229 | ;; | ||
| 230 | *) | ||
| 231 | echo "Usage: $0 {start|stop|restart}" | ||
| 232 | exit 1 | ||
| 233 | ;; | ||
| 234 | esac | ||
| 235 | {{/code}} | ||
| 236 | |||
| 237 | Finally, make sure the confluence user has access: | ||
| 238 | |||
| 239 | |||
| 240 | {{code}} | ||
| 241 | cd Confluence_Install | ||
| 242 | sudo chown -R confluence:confluence confluence | ||
| 243 | |||
| 244 | cd Confluence_Home | ||
| 245 | sudo chown -R confluence:confluence confluence-data | ||
| 246 | {{/code}} | ||
| 247 | |||
| 248 | |||
| 249 | |||
| 250 | = Other = | ||
| 251 | |||
| 252 | === Proxy passing === | ||
| 253 | There are good reasons for using an Apache or Traffic Manager in front of the Confluence Installation, some are: | ||
| 254 | |||
| 255 | * No port changing (non-root users can assign to ports below 1024) | ||
| 256 | * Use of URL Rewrite | ||
| 257 | * Use of URL Blocking | ||
| 258 | * Use of Allow/Denial | ||
| 259 | * SSL offloading/handling outside the Confluence | ||
| 260 | Se my example in [[Apache2 Proxy Passing>>Main.information-technology.apache2-webserver.apache2-proxy-passing]] | ||
| 261 | |||
| 262 | === Time And Date Setup === | ||
| 263 | Time and Date should be set up according to | ||
| 264 | |||
| 265 | [[https://confluence.atlassian.com/display/DOC/Configuring+Time+and+Date+Formats]] | ||
| 266 | |||
| 267 | My formats for danish is: | ||
| 268 | |||
| 269 | |||
| 270 | {{code}} | ||
| 271 | Time Format HH:mm | ||
| 272 | Date Time Format dd-MM-yyyy HH:mm | ||
| 273 | Date Format dd-MM-yyyy | ||
| 274 | {{/code}} | ||
| 275 | |||
| 276 | |||
| 277 | |||
| 278 | = Logfiles = | ||
| 279 | |||
| 280 | === Logrotate === | ||
| 281 | Set up logrotate to avoid ever growing catalina.out log file. Here Confluence_Install is /opt/confluence, logs are rotated daily and keept for 7 days: | ||
| 282 | |||
| 283 | |||
| 284 | {{code language="/etc/logrotate.d/confluence"}} | ||
| 285 | /opt/confluence/logs/catalina.out { | ||
| 286 | daily | ||
| 287 | rotate 7 | ||
| 288 | compress | ||
| 289 | copytruncate | ||
| 290 | delaycompress | ||
| 291 | missingok | ||
| 292 | size 10M | ||
| 293 | notifempty | ||
| 294 | } | ||
| 295 | {{/code}} |