What do you think? Discuss, post comments, or ask questions at the end of this article [More about me]

Skip to end of metadata
Go to start of metadata

Install guide/tips for Atlassian bitbucket.

Official Bitbucket installation documentation is here.

Install dependencies

Bitbucket requires installing MySQL and git (which will also install perl which is also required).

Install git by (yum base os):

sudo yum install git

Install git by (debian/ubuntu):

sudo apt-get install git


Follow this guide to install MySQL

Make sure to do (see below) to ensure service starts on reboot

sudo chkconfig mysqld on

To install git do:

Debian 

sudo apt-get update
sudo apt-get install git

RPM based distro

sudo yum update -y
sudo yum install git

Bitbucket services

Bitbucket should be started as user altbitbucket to ensure elasticsearch is started correctly. Starting the service as root can cause elasticsearch to fail. See here for more information.

First switch to user atlbitbucket with:

sudo su - atlbitbucket

then use the following service commands to manage bitbucket

service atlbitbucket start
service atlbitbucket stop
service atlbitbucket restart

Setup

For mysql hostname (since only allowing server-side MySQL access):

localhost

Enter user and password configured when setting up database as outlined here.


The below directions for redirecting ports and setting up SSL on confluence are deprecated. Please see Apache reverse-proxy SSL to multiple server applications for a better solution to both port redirection and SSL.

Redirecting port 443 to 8443


We can iptables to route from https (443) to the confluence secured port as outlined here.

Enabling SSL

Create a certificate as outlined here.

Bitbucket, by default looks for a java keystore file like this

<Bitbucket server home directory>/shared/config/ssl-keystore

Rename the .keystore file that you generated and copy to match the above location and filename.

Now just need to edit file bitbucket.properties file

sudo nano /var/atlassian/application-data/bitbucket/shared/bitbucket.properties

Add the following

server.port=8443
server.ssl.enabled=true
server.ssl.key-store-password=<PASSWORD>
server.ssl.key-password=<PASSWORD>

Note: where <PASSWORD> is the password you created in the previous steps (when following this).

Restart bitbucket.