I use confluence daily at work and thought it would be useful to have my own personal confluence site. So I got the free version and put it up on an AWS EC2 instance. This way I can track personal things like projects, phone numbers for family, doctors, recurring calendar events, etc. And here are the instructions to put Confluence up on EC2. Type fast and you can do this in 30 minutes.
Steps to creating your own Confluence page in Amazon’s cloud:
- Create and prepare your ubuntu EC2 instance
- Log into your new EC2 instance
- Install and configure JAVA
- Install Apache
- Install MySQL
- Install and configure Confluence
- Configure MySQL
- Install MySQL JDBC driver
- Run confluence for the first time
Step 1. Create your ubuntu EC2 instance
Go to your Amazon AWS console and launch your EC2 instance. If you’re new to Amazon then here are the basic steps:
- Create an account on http://aws.amazon.com
- Log into the AWS console at http://aws.amazon.com/console/
- Launch an instance. You should not use the free t1.micro instance because you will encounter out of memory issues.
- Create your PEM key and download your new pem file.
- Update AWS to open ports 80 and 8090. In AWS, find your security group and edit the Inbound Rules to allow ports 80 and 8090.
Step 2. Log into your new EC2 instance
In your AWS console page, find your new EC2 instance and look for your Public DNS. It will look something like this, ec2-1-2-3-4.compute-1.amazonaws.com. With this, use your pem file to log in:
ssh -i mypemfile.pem ec2-1-2-3-4.compute-1.amazonaws.com
Once logged in, install any remaining updates:
sudo apt-get update sudo apt-get upgrade
Step 3. Install and configure JAVA
sudo apt-get install default-jre
Check these directories to make sure they are correct then add them to your .bashrc file:
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/bin/java export PATH=$PATH:/usr/lib/jvm/java-7-openjdk-amd64/bin
Step 4. Install Apache
sudo apt-get install apache2
Step 5. Install MySQL
sudo apt-get install mysql-server
Step 6. Install and configure Confluence
Download the latest confluence. At the time of writing, the latest version is 5.7.1. If this link below doesn’t work then go to confluence to get the latest version.
wget https://www.atlassian.com/software/confluence/downloads/binary/atlassian-confluence-5.7.1-x64.bin chmod a+x atlassian-confluence-5.7.1-x64.bin
For the installation I used the default file paths and port numbers.
Installation Directory: /home/ubuntu/atlassian/confluence Home Directory: /home/ubuntu/atlassian/application-data/confluence HTTP Port: 8090 RMI Port: 8000
Step 7. Configure MySQL
Add the following to [mysqld]
character-set-server=utf8 collation-server=utf8_bin default-storage-engine=max_allowed_packet INNODB=40M
For more info, see https://confluence.atlassian.com/display/DOC/Database+Setup+For+MySQL.
Create a new database and privileges in your new MySQL instance. Note the confluenceuser credentials being used because confluence will ask for them upon setup.
mysql -u root -p -hlocalhost CREATE DATABASE confluence CHARACTER SET utf8 COLLATE utf8_bin; GRANT ALL PRIVILEGES ON confluence.* TO 'confluenceuser'@'localhost' IDENTIFIED BY 'confluencepass';
Step 8. Install MySQL JDBC driver
Download JDBC mysql driver
wget http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.34.tar.gz tar -xvf mysql-connector-java-5.1.34.tar.gz cp /home/ubuntu/mysql-connector-java-5.1.34/mysql-connector-java-5.1.34-bin.jar /home/ubuntu/atlassian/confluence/lib
Step 9. Test your Confluence installation
Start up Confluence from your installation directory:
Install lynx and open it up from your new EC2 instance:
sudo apt-get install lynx ./lynx http://127.0.0.1:8090
At this point Confluence should be running and you’ll go through further setup steps to personalize your Confluence instance.
How to access Confluence from the internet?
Thus far I have shown how to use lynx from your EC2 instance. If you want to access Confluence from your browser then you’ll need to open up an http port in AWS. Log into the AWS Console, go to your ec2 instance, and you’ll see a column called Security Groups on the right. Click that link to open up your Security Groups. Click Action->select drop down Edit inbound rules. Add new rules for:
Type: Custom TCP Rule Protocol: TCP Port Range: 8090 Source: 0.0.0.0/0
Next look for your Public DNS setting near the bottom right of your screen. This is your URL. Open up a browser and access your confluence instance. The URL will look something like http://ec1-1-2-3-4.compute-1.amazonaws.com:8090. If you have a domain name then use the AWS Elastic IP to point your EC2 instance to your domain.
What if the Confluence page does not load?
Check the confluence log files(“
/www/confluence/logs/catalina.out“). If you see something like “VM failed to allocate inital heap” or “VM out of memory” then you ran out of memory. You can try tweaking the confluence settings(“
vim /home/ubuntu/atlassian/confluence/bin/setenv.sh“) or getting an ec2 instance with more memory. Here’s one solution for a server with 2 GB of memory:
JAVA_OPTS="-server -Xms1536m -Xmx1536m -Xmn256m \
So you’ll get 1.5 GB for Tomcat and 5 MB for MySQL and everything else.
What if the Confluence page hangs while going through setup?
See the answer above. You’re probably out of memory. If your shell is saying it can’t fork processes then you have essentially killed your EC2 instance. Go to the AWS Console, restart your instance, adjust the confluence memory settings, then try reloading the confluence settings page.