Upgrade Bitbucket Server to Bitbucket Data Center on Centos8/RHEL8

Ahmet Kasım Erbay
5 min readMar 1, 2024

--

I could not have understand the importance of source code management until working in a big company that tries to manage hundreds of projects with more than 80 actively coding software engineers. Everyone had an experience with Github and public repositories; but in a professional environment, you definitely need an SCM solution private to your company.

In this series of papers, we will be installing and configuring Bitbucket. As our company tries to achieve to work in a highly available setup, I will be sharing the steps to configure Bitbucket Data Center in a cluster.

Install and Configure Bitbucket Data Center on Application Nodes

Prerequisites

For a RHEL8 environment below requirements will be necessary and sufficient. Be sure to understand and complete this requirements before proceed.

Hardware

  • This requirements need to be adjusted according to your company needs!

Java

  • You do not need to install and configure Java for Bitbucket. Because Bitbucket installer bundled with Java.

Database

  • In a company environment, this databases are managed by a separate team.

Git

  • Be sure you have installed git 2.39+.

Shared Search Server

Search Servers give you to use search functionality in your application through a search bar. Please follow the instructions from the below page to install and configure OpenSearch 1.3.13 on a remote server.

NOTE 1: ElasticSearch will not be available in a future version of Bitbucket.

Shared File System

This is an important part of the cluster structure because nodes will be doing I/O operations on this server. Please follow the instructions to install and configure NFSv3 for Bitbucket.

NOTE 2: Please be sure about time sync of your nodes. If they are not synced, there will be serious logging errors on your application.

Installation on Application Nodes

Install the Installer :)

From now on, please be careful about the prompts. Because sometimes we change the server and some codes are server specific! For instance, [atlbender@cluster_node ~]# means you are running the code as root because of “#” sign and you need to run the command in the “cluster_node”

With the below command you can download the installer to your local machine,

[atlbender@cluster_node ~]# wget https://www.atlassian.com/software/stash/downloads/binary/atlassian-bitbucket-7.21.9-x64.bin

After installing the installer, you send this to application nodes,

[atlbender@cluster_node ~]# scp atlassian-bitbucket-7.21.9-x64.bin <SERVER_USER>@<NODE_ADDRESS>:/var/tmp

Change the owner and mode of the installer,

[atlbender@cluster_node ~]# chown -R root:root atlassian-bitbucket-7.21.9-x64.bin
[atlbender@cluster_node ~]# chmod u+x atlassian-bitbucket-7.21.9-x64.bin

IMPORTANT NOTE: Run the installer but do not start the service on the server or launch Bitbucket.

Install Bitbucket

[atlbender@cluster_node tmp]# ./atlassian-bitbucket-7.21.9-x64.bin
Unpacking JRE …
Starting Installer …

Bitbucket 7.21.9 installation wizard
Would you like to install or upgrade an instance?
Install a new instance [1, Enter], Upgrade an existing instance [2]


Install Bitbucket 7.21.9
What type of instance are you looking to install?
Install a Server instance [1, Enter], Install a Data Center instance [2], Install a Smart Mirroring instance [3]
2
Where should Bitbucket be installed?

Select the folder where you would like Bitbucket 7.21.9 to be installed,
then click Next.
[/opt/atlassian/bitbucket/7.21.9]

Default location for Bitbucket home directory

The location for Bitbucket data.
This will be the default location for repositories, plugins, and other data.

Ensure that this location is not used by another Bitbucket installation.
[/var/atlassian/application-data/bitbucket]

Configure which ports Bitbucket will use.


Configure TCP Ports
Bitbucket requires a TCP port that isn't being used by other applications.

The HTTP port is where users access Bitbucket through their browsers.

Bitbucket also requires ports 7992 and 7993 are available to run the bundled
search server that provides search functionality to Bitbucket.
HTTP Port Number
[7990]



Run as a service
For a production server we recommend that you run Bitbucket as a
Windows/Linux service because Bitbucket will restart automatically when the
computer restarts.
Install Bitbucket as a service?
Yes [y, Enter], No [n]

Please review your Bitbucket installation settings


Installation Summary
Installation Directory: /opt/atlassian/bitbucket/7.21.9
Home Directory: /var/atlassian/application-data/bitbucket
HTTP Port: 7990
Install as a service: Yes

Install [i, Enter], Exit [e]


Extracting files …


Installation of Bitbucket is complete
Would you like to launch Bitbucket?
Yes [y, Enter], No [n]
n

An important note about changes to starting Bitbucket Server
Bitbucket Server standard startup commands have changed to automatically
start a new service that enabled code search.When starting Bitbucket Server
manually, ensure you start all required services using both of the following
command:service atlbitbucket start

This machine now has Bitbucket 7.21.9 Data Center installed
Your installation of Bitbucket 7.21.9 Data Center on this node is ready and
can be accessed from your browser.

For a complete Bitbucket 7.21.9 Data Center installation, you will need to
also install and connect to:

* Shared database system
* Shared file system
* Shared search server

Read more about installing Bitbucket Data Center.
Bitbucket 7.21.9 can be accessed at http://localhost:7990
Finishing installation …

Finally, we have completed the installation of Bitbucket to a node successfully. :)

Repeat the same actions on the other nodes.

In the above steps, we had 2 important directories created,

  • /opt/atlassian/bitbucket/7.21.9 — Installation Directory; included Java for the application under ./jre
  • /var/atlassian/application-data/bitbucket/ — Home Directory; inclueded “Shared Home Directory” under ./shared This where we have mounted our shared file system on NFS Server.

NOTE 3: You can move forward on NFSv3 client side configurations from where you left off.

OpenSearch SSL Configuration for Nodes

Make sure you have completed “Configure TLS on Client Side” section on “Install and Configure OpenSearch for Bitbucket Data Center” paper.

Shared File System Configurations for Nodes

Also make sure you have completed “Client Side Configurations” section on “Install and Configure NFSv3 for Bitbucket Data Center” paper.

Shared Home Restoration

Since you have already up and running Bitbucket Server instance, the data we want to transfer is living there. To transfer data to new place, create tarball for /var/atlassian/application-data/bitbucket/shareddirectory on legacy Bitbucket

[atlbender@cluster_node ~]# tar -cvzf /var/tmp/shared.tar.gz /var/atlassian/application-data/bitbucket/shared

Extract it to /var/atlassian/application-data/bitbucket/sharedfolder on one of the nodes’ shared folder.

NOTE: Understand that completion of this section depends on the preceding section above.

Add to Trusted Certificate Path

This section depends on your local company TLS policies. Put your certificates to Bitbucket’s java keystore and RHEL to trust local communications.

[atlbender@cluster_node ~]# ./keytool -import -alias <ALIAS> -file /var/tmp/server_certs/<cert_name>.crt -keystore /opt/atlassian/bitbucket/7.21.9/jre/lib/security/cacerts
[atlbender@cluster_node ~]# cp /var/tmp/server_certs/* /etc/pki/ca-trust/source/anchors/
[atlbender@cluster_node ~]# update-ca-trust

Start Bitbucket Data Center on First Node

[atlbender@cluster_node ~]# systemctl daemon-reload
[atlbender@cluster_node ~]# systemctl start atlbitbucket

Move on to your browser and follow the setup wizard.

Conguratilations! You have Bitbucket Data Center up and running. You can configure and manage your repositories from here.

Next thing is to create disaster recovery instance and configure mirroring options.

Thanks for reading. Please feel free to be in contact. Any comment is appreciated.

--

--