How to Install Bamboo in Ubuntu?
Posted on July 14th, 2020
In this tutorial, we can check how to Install Bamboo in Ubuntu.
The Bamboo is a continuous integration and deployment server that provides a reliable and automated build and test process for the software that has source codes. Bamboo was initially available as both cloud computing and on-premises services. Some features offered by Bamboo are:
- Bamboo can run multiple builds at a time to complete a task faster.
- Bamboo offers a stack trace and other analysis reports during build failure.
- The REST API of Bamboo displays the current status of each build.
- Bamboo offers a customized notification feature.
- It provides a feature to import data from Jenkins.
In this knowledgebase, you learn how to install and configure Bamboo on your Ubuntu server.
Prerequisites
- Java OpenJDK-8-JDK.
- A user with the sudo privileges.
Install and Configure Bamboo
The Java software should be pre-installed on your server before installing Bamboo. To check which Java version is available on your server, run the following command.
$ sudo java --version
If Java is not available on your server, then install the same by executing the following commands.
$ sudo apt-get install software-properties-common $ sudo add-apt-repository ppa:openjdk-r/ppa $ sudo apt-get update $ sudo apt-get install openjdk-8-jdk
After that, to install and configure the Bamboo software, follow the below steps:
Switch to the ‘opt’ directory.
$ sudo cd /opt
Download the latest stable version of Bamboo. The latest stable version of Bamboo available now is 6.10.4, so to download the same execute the following wget command.
$ sudo wget https://www.atlassian.com/software/bamboo/downloads/binary/atlassian-bamboo-6.10.4.tar.gz
After that, unzip the downloaded tar.gz file by using the following command.
$ sudo tar -xvf atlassian-bamboo-6.10.4.tar.gz
Then, move the downloaded contents into a folder named bamboo.
$ sudo mv atlassian-bamboo-6.10.4 bamboo
Switch to the bamboo directory and list all the files to make sure that the downloaded files got moved to this directory.
$ sudo cd /opt/bamboo $ sudo ls -l
Next, set the bamboo home environment. For that, open the ‘bamboo-init.properties’ file using any of the text editors.
$ sudo vim /opt/bamboo/atlassian-bamboo/WEB-INF/classes/bamboo-init.properties
Then uncomment the following line in the ‘bamboo-init.properties’ file to set the home environment. After that, save and close the file.
bamboo.home=/home/bamboo/bamboo-home
Then, create the home directory set in the above step by using the following command.
$ sudo mkdir -p /home/bamboo/bamboo-home
After that, create a user named ‘bamboo’ who has access to run the Bamboo service by executing the following commands.
$ sudo useradd -s /bin/bash bamboo $ sudo chown bamboo: /opt/bamboo/atlassian-bamboo
Now, create the bamboo.service file.
$ sudo vim /etc/systemd/system/bamboo.service
Paste the following lines in the created bamboo.service file and then save and close the file.
[Unit] Description = Atlassian Bamboo After = syslog.target network.target [Service] Type = forking User = bamboo ExecStart = /opt/bamboo/atlassian-bamboo/bin/start-bamboo.sh ExecStop = /opt/bamboo/atlassian-bamboo/bin/stop-bamboo.sh SuccessExitStatus = 143 [Install] WantedBy = multi-user.target
Enable the Bamboo service to start during the boot up by executing the following systemctl command.
$ sudo systemctl enable bamboo.service
After that, run the following script to check if it got correctly enabled.
$ if [ -f /etc/systemd/system/*.wants/bamboo.service ]; then echo "On"; else echo "Off"; fi
The above script should show the result as ‘On’, if Bamboo got enabled during boot up.
Run Bamboo as a Service
To run Bamboo as a service and to auto start the service during boot up, follow the below steps:
Open the ‘bamboo’ file under the /etc/init.d directory using any of the text editors.
$ sudo vim /etc/init.d/bamboo
Then, copy and paste the following script inside the bamboo file. After that, save and close the file.
#!/bin/sh set -e #### VARIABLES #### # Name of app ( bamboo, Confluence, etc ) APP=bamboo # Name of the user to run as USER=bamboo # Location of application's bin directory BASE=/opt/bamboo case "$1" in # Start command start) echo "Starting $APP" /bin/su - $USER -c "export BAMBOO_HOME=${BAMBOO_HOME}; $BASE/bin/startup.sh &> /dev/null" ;; # Stop command stop) echo "Stopping $APP" /bin/su - $USER -c "$BASE/bin/shutdown.sh &> /dev/null" echo "$APP stopped successfully" ;; # Restart command restart) $0 stop sleep 5 $0 start ;; *) echo "Usage: /etc/init.d/$APP {start|restart|stop}" exit 1 ;; esac exit 0
Edit the permission of the bamboo file.
$ sudo chmod 755 /etc/init.d/bamboo
Then, execute the following command to auto start the Bamboo service during boot up.
$ sudo update-rc.d bamboo defaults
Run the following commands to start, stop, and restart the bamboo service.
$ sudo service bamboo start $ sudo service bamboo stop $ sudo service bamboo restart
Then, change the default port to which bamboo listens from 8085 to 80 by editing the value of Port in the server.xml file.
$ sudo vim /opt/bamboo/conf/server.xml
After that, restart the bamboo service to reflect the changes.
$ sudo service bamboo restart
Now, you can access the Bamboo initial installation setup screen by browsing the following URL.
http://<server_IP_address>
Then, perform the following on the installation page.
- Create an administrator user.
- Fill all the required fields, such as License Key.
- Express installation.
Now, after the configuration, you can access the Bamboo from any web browser.
Conclusion
The Bamboo is a continuous integration and deployment server that provides a reliable and automated build and test process for the software that has source codes. We hope that this knowledge base was helpful to you. Please comment below for any questions or queries. If you are an InterServer customer, please reach out to our support team for further help.