Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Migrating BB to a new server

Hello, I need to migrate Bitbucket (5.15.1) to a different server.

I have tried the 2 options in this doc to no avail:

  • I have backed/zipped both the Install and Home directories from the existing production server and unzipped them to the new server. I get that message below. I update the variable for JRE_HOME as it indicates (because I have a later version of Java installed on the new server) and it still fails with the same error.
  • I have started from scratch and performed the download/install of the same version of BB on the new server. I still copied the zip files from above into the new server and unzipped them. Still the same error.


This is what happens when I launch bb


[root@atlassian2 bin]# service atlbitbucket status

Bitbucket is not running (pidfile exists)

[root@atlassian2 bin]# service atlbitbucket start

The JRE_HOME environment variable is not defined correctly

This environment variable is needed to run this program

Edit and define JRE_HOME


Startup has been aborted

[root@atlassian2 bin]#

[root@atlassian2 bin]# nano


Displaying Java information below shows the same path I put in the script.

[root@atlassian2 bin]# echo $JAVA_HOME


[root@atlassian2 bin]# echo $JRE_HOME

Thank you in advance for any assistance.


1 answer

 What is the output of echo $PATH ?

Check if it has set the correct path to the java executable. 

If it doesn't, then set the path with following. 

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-
export PATH=$JAVA_HOME/bin:$PATH

Hi @Suhas P thanks for the response. It went into Spam so I apologize for the late reply.

I have reverted back to a snapshot prior to setting things up. I have done a

sudo ./atlassian-bitbucket-5.15.1-linux-x64.bin to get it to install successfully as a Service.

the results of your query is below, so it appears correct.

[root@atlassian2 bitbucket]# echo $JAVA_HOME
[root@atlassian2 bitbucket]# echo $JRE_HOME

[root@atlassian2 bitbucket]# echo $PATH

Now I need to get my data incorporated into this instance. I was hoping copying the existing Production Home and Install directories and their subdirectories (and import the mysql database) would get me back to where I need to be. Do you have an opinion/suggestion on this approach?

Thank you again.

In reviewing the file it contains a totally different path:

[root@atlassian2 bin]# cat
if [ -z "$JRE_HOME" ]; then
if [ -z "$JAVA_HOME" ]; then
# If JRE_HOME and JAVA_HOME are not defined, edit this line to define JRE_HOME
elif [ -n "$JAVA_HOME" ] && [ -x "$JAVA_HOME/jre/bin/java" ]; then
# If JAVA_HOME points to a valid JDK, use its JRE
elif [ -n "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then
# If JAVA_HOME appears to point to a JRE and not a JDK use this anyway


How does that happen?

That explains it, you need to modify the with the correct JRE path. It's referring to the non-existing JAVA version.

Regarding copying prod directories, you can do it as long as it's the same instance (not prod to non-prod). Make sure, your database is reachable from the app server. 

you would never be able to get it working in the first shot, you will have to deal with many issues for sure. So i would recommend migrating the non-prod to the non-prod server first, fix all the issues there, document them, and then plan the production.

It does indeed however I did not update Java so that's a mystery. I originally installed java-1.8.0-openjdk-

Anyways, I will make the change and see how it goes. Thank you for your direction.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

⭐ Calling all Bitbucket and DevOps experts: Special showcase opportunity ⭐

Hi, Bitbucket community! Are you a DevOps practitioner (or know one in your network)? Do you have DevOps tips, tricks, or learnings you'd like to share with the community? If so, we'd love to hea...

1,499 views 4 8
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you