Steps to Upgrade Bitbucket Server 4.0.3 to 6.6.0 | Bitbucket Server Upgrade

Steps to Upgrade Bitbucket Server 4.0.3 to 6.6.0 | Bitbucket Server Upgrade


How to Upgrade Bitbucket Server Version 4.0.x to 6.6.x ?
How to Upgrade Bitbucket ?
Step by Step Upgrade Bitbucket Server
Upgrade Bitbucket Old version to new latest version ?
How to Upgrade git server ?

Upgrade Bitbucket Server 4.x to 6.6.x

Current version : Atlassian Bitbucket v4.0.3
latest version : Atlassian Bitbucket v6.6.0
OS : CentOS 7 64bit

Path::::

BITBUCKET_HOME:       /bitbucket/atlassian/application-data/bitbucket
CATALINA_BASE:           /opt/atlassian/bitbucket/4.0.3
CATALINA_HOME:         /opt/atlassian/bitbucket/4.0.3
CATALINA_TMPDIR:     /opt/atlassian/bitbucket/4.0.3/temp
JRE_HOME:            /usr/local/java/jdk1.8.0_31/jre
CLASSPATH:       /opt/atlassian/bitbucket/4.0.3/bin/bitbucket-bootstrap.jar:/opt/atlassian/bitbucket/4.0.3/bin/bootstrap.jar:/opt/atlassian/bitbucket/4.0.3/bin/tomcat-juli.jar
CATALINA_PID:        /opt/atlassian/bitbucket/4.0.3/work/catalina.pid

Best Practice : Create dummy server and test on it before performing on the production server. 

Steps: 1

Take backup of all bitbucket/git using the official Bitbucket Server Backup Client, click on download link - Download Bitbucket Server Backup Client
wget https://marketplace.atlassian.com/download/apps/1211500/version/300600000 -O Bitbucket-Server-Backup-Client.zipunzip Bitbucket-Server-Backup-Client.zipcd bitbucket-backup-client-3.6.0/ls
Run following command to take backup of bitbucket server
java  -Dbitbucket.user="admin user" -Dbitbucket.password="admin password" -Dbitbucket.baseUrl="http://localhost:7990" -Dbitbucket.home=path/to/bitbucket/home -Dbackup.home=path/to/backup-home -jar bitbucket-backup-client.jar

bitbucket.user      = Bitbucker admin user
bitbucket.password    = Bitbucket admin password
bitbucket.baseUr l    = Url of your bitbucket 
bitbucket.home     = Data home directory
backup.home        = Backup store path, you can define where you want to keep backup

Note: It will take time to create backup file, its  depend on your data size. We have 140GB so it takes approx  4 Hour and required more than 140GB disk space to create it. If you don't have mount another external disk and define backup path. 

java  -Dbitbucket.user="admin" -Dbitbucket.password="admin" -Dbitbucket.baseUrl="http://localhost:7990" -Dbitbucket.home=/bitbucket/atlassian/application-data/bitbucket -Dbackup.home=/opt/ -jar bitbucket-backup-client.jar



Verify Backup file
ls  /opt/backups


To restore backup:(if needed / Something went wrong )

java -Dbitbucket.home="path/to/bitbucket/home" -jar bitbucket-restore-client.jar <backup file path>

bitbucket.home=Data home path
java -Dbitbucket.home="/bitbucket/atlassian/application-data/bitbucket" -jar bitbucket-restore-client.jar /opt/backups/bitbucket-20190904-142535-617.tar
For more info about Bitbucket Server Backup Client

Step 2 

Update Git Version if you have an old version, To check git version 
git  --version

We have 1.8.3.1 version so we will remove this version and install above 2.x.x 

To Add IUS release


yum install https://centos7.iuscommunity.org/ius-release.rpm

Remove old version 
yum remove git
Install latest git 
yum install git222


To verify version 
git  --version


Step 3:

Download bitbucket Server from the official website by visit 

https://bitbucket.org/product/download  → Select OS and Download the installer (the recommended approach) for your operating system

We downloaded it on /tmp directory, Now we will set execute permission on bin file

cd  /tmp/chmod +x atlassian-bitbucket-x.x.x-x64.bin



Note : If you are upgrading from Bitbucket Server 4.14 or earlier, then you must do the following for If you made any customization
If you made any customization to the server.xml file, you must migrate those changes in the bitbucket.properties file in your existing Bitbucket home directory.  The bitbucket.properties file uses a slightly different syntax, so it is not merely a copy and paste procedure.

Read the page Migrate customizations from server.xml to bitbucket.properties and follow the instructions to migrate your customizations. Once your changes are migrated, proceed to the next step.

Step 4:
cd /bitbucket/atlassian/application-data/bitbucketcd sharedcp -rv bitbucket.properties bitbucket.properties-`date -I`cp -rv server.xml server.xml-`date -I`


To Run Bitbucket Server bin file
./atlassian-bitbucket-x.x.x-x64.bin
Bitbucket 6.6.1 installation wizard
Would you like to install or upgrade an instance?
Install a new instance [1, Enter], Upgrade an existing instance [2]

Press 2 



Upgrade Bitbucket 6.6.1
What type of instance are you looking to upgrade?
Upgrade an existing Server instance [1, Enter], Upgrade an existing Data Center instance [2], Upgrade an existing Smart Mirroring instance [3]
1



Where should Bitbucket be installed?

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

Default location for Bitbucket home directory

The location for Bitbucket data.
Please provide the location of your existing home directory, where your
repositories, plugins, and other data are stored.

Be sure to STOP your current instance and create a backup before proceeding.



Acknowledge 
a
Install [ i, Enter], Exit [e]
i




Note : Upgrading from a version older than Bitbucket Server 6 will automatically disable all user-installed apps. You will need to enable your apps after successfully upgrading, regardless of compatibility with Bitbucket Server 6.


Stop bitbucket server
/etc/init.d/atlbitbucket stop
Check process all bitbucket service and kill all runing process
ps -ef | grep atl
Start Bitbucket Server
/etc/init.d/atlbitbucket start
Your Bitbucket Server has been Upgraded, you can verify by accessing url
http://172.17.20.222:7990

Thanks
Previous
Next Post »