Tag Archives: Jenkins

jenkins + gitlab auto build and deploy to tomcat

Step 1: Download jenkins.war file from  here.

Step 2: On server create user jenkins

Step 3: Add user jenkins as sudoer execute the command to access the 


Step 4: Add jenkins follow below

Switch to user jenkins test command sudo

Step 5:  download tomcat 7 from here or using wget to download


Continue reading jenkins + gitlab auto build and deploy to tomcat

Setup Jenkins with Bitbucket on EC2

Jenkins CI is the leading open-source continuous integration server.

A. Requirement

  • Java
  • Maven
  • Git
  • Tomcat

B. Install

  1. Download Jenkins
  2. Copy to tomcat

C. Config

1. Configure System (Jenkins > Manage Jenkins > Configure System)


2. Configure Global Security (Jenkins > Manage Jenkins > Configure Global Security)

  • Enable
  • Security Realm:
  • Authorization:

3. Install Plugins (Jenkins > Manage Jenkins > Manage Plugins)

  • Update all plugin installed
  • Install:

4. Config Credentials (Jenkins > Credentials)

a. Config Linux

b. Config Bitbucket: Add tomcat public key to

c. Config Jenkins (Jenkins > Credentials > Global credentials)

  • Click on
  • Kind:
  • Scope:
  • Username:
  • Private Key:

5. Setup Jenkins Hook on Bitbucket

a. Jenkins Information Requirement

  • Get : (Jenkins > People > Username > Configure > API Token)
  • Get : (Jenkins > Manage Jenkins > Configure System > Jenkins Location)

b. Jenkins Hook Management on Bitbucket

  1. Go to the repository’s settings
  2. Click Hooks in the left-hand navigation
  3. Select the Jenkins hook from the Hook dropdown
  4. Click Add hook
  5. Enter the following information
    • Token: The token from the build job I want to run
    • Project name: The build project name
    • Endpoint:

Key points:

  • The usertoken in the URL is the token for the user account, not the password, and not the same token used for the job
  • The endpoint URL is not the full URL. Bitbucket adds on the /build/jobname?token=token, using the other fields you enter

6. Create Maven Jenkins Job (Jenkins > New Item)

a. Source Code Management:

  • Repository URL:
  • Credentials:

b. Build Triggers

  • Enable
  • Credentials:

c. Build

  • Root POM:
  • Goals and options:

d. Post Steps

  • Choose
  • Execute shell

D. Bitbucket IP

Inbound (bound to bitbucket.org) Outbound (for hooks like POST)