Install & Configure Confluence on EC2 Amazon Linux

Confluence Installation

  1. Login as ec2-user
  2. Download the Linux Confluence installation
    cd
    wget http://www.atlassian.com/software/confluence/downloads/binary/confluence-3.3.3-std.tar.gz
    

    Check out the latest stable version

  3. Extract the file to ec2-user home directory
    tar -zxvf confluence-3.3.3-std.tar.gz
    
  4. Install confluence
    sudo mv confluence-3.3.3-std /opt
    
  5. Create confluence home
    sudo mkdir /data/confluence
    sudo chown ec2-user.ec2-user /data/confluence
    
  6. Change confluence home (Confluence data directory)
    vi /opt/confluence-3.3.3-std/confluence/WEB-INF/classes/confluence-init.properties
    

    Set Confluence Home

    confluence-init.properties
    confluence.home=/data/confluence
    
  7. Change Confluence listening port
    vi /opt/confluence-3.3.3-std/conf/server.xml
    
    1. Change the port 8000 to 5101
    2. Change the port 8080 to 5100
    3. Change the port 8443 to 5102
  8. Set JAVA_HOME
    vi /opt/confluence-3.3.3-std/bin/setenv.sh
    
    JAVA_HOME=/usr/lib/jvm/java
    export JAVA_HOME
    

Configure Virtual Host

  1. Edit the virtual host file
    sudo vi /etc/httpd/conf.d/vhosts.conf
    
  2. Add the virtual host configuration
    <VirtualHost *:80>
            ServerName conf.yourdomain.com
            ServerAlias conf.yourdomain.com
            ProxyRequests Off
            ProxyPass / http://127.0.0.1:5100/
            ProxyPassReverse / http://127.0.0.1:5100/
            ProxyTimeout 60
    </VirtualHost>
    
  3. Restart Apache
    sudo service httpd restart
    

Start

cd /opt/confluence-3.3.3-std/bin
./startup.sh

Confluence Configuration

Access

http://conf.yourdomain.com
  1. Enter the license key and click the 'Custom Installation'
  2. Under 'External Database' heading, select 'MySQL' and 'External Database'
  3. Select 'Direct JDBC'.
  4. Enter confluenceuser for user

Stop

% cd /opt/confluence-3.3.3-std/bin
% ./shutdown.sh

Trouble shoot

Check the log files in

% cd /opt/confluence-3.3.3-std/logs

Access

Browser Access

http://conf.yourdomain.com/

Auto-start Confluence

  1. sudo vi /etc/init.d/confluence
    #!/bin/bash
    #
    # Startup script for Tomcat/Confluence
    #
    # chkconfig: 345 84 16
    # description: Tomcat/Confluence server
    # processname: confluence
    
    #Necessary environment variables
    export CATALINA_HOME="/opt/confluence-3.3.3-std"
    if [ ! -f $CATALINA_HOME/bin/catalina.sh ]
    then
    echo "Tomcat not available..."
    exit
    fi
    
    start() {
    echo -n -e '\E[0;0m'"\033[1;32mStarting Tomcat: \033[0m \n"
    su -l ec2-user -c $CATALINA_HOME/bin/startup.sh
    echo
    }
    
    stop() {
    echo -n -e '\E[0;0m'"\033[1;31mShutting down Tomcat: \033[m \n"
    su -l ec2-user -c $CATALINA_HOME/bin/shutdown.sh
    rm -f /var/lock/subsys/confluenced
    echo
    }
    
    status() {
    ps ax --width=1000 | grep "[o]rg.apache.catalina.startup.Bootstrap start" | awk '{printf $1 " "}' | wc | awk '{print $2}' > /tmp/tomcat_process_count.txt
    read line < /tmp/tomcat_process_count.txt
    if [ $line -gt 0 ]; then
    echo -n "confluenced ( pid "
    ps ax --width=1000 | grep "[o]rg.apache.catalina.startup.Bootstrap start" | awk '{printf $1 " "}'
    echo -n ") is running..."
    echo
    else
    echo "Tomcat is stopped"
    fi
    }
    
    case "$1" in
    start)
    start
    ;;
    stop)
    stop
    ;;
    restart)
    stop
    sleep 3
    start
    ;;
    status)
    status
    ;;
    *)
    echo "Usage: confluenced {start|stop|restart|status}"
    exit 1
    esac
    
  2. Add as a service
    sudo chmod +x /etc/init.d/confluence
    sudo chkconfig --add confluence
    sudo chkconfig confluence on
    

Start/stop Confluence

Use the following command to start/stop Confluence when it is enabled as a service

sudo service confluence start
sudo service confluence stop

Tuning

  1. Set Java Heap size
    sudo vi /opt/confluence-3.3.3-std/bin/setenv.sh
    
    JAVA_OPTS="-Xms256m -Xmx256m ...
    

    Adjust the memory size according to the available physical memory