How To Install Jenkins on Ubuntu

How To nstall Jkns on Ubuntu

Jkns s a Java-bult op-source Contnuous ntegraton (C) and CD platform. Bcally, Jkns bulds software projects, checks and deploys them. Ths s one of the most practcal programmng tools you can master, and today we wll show you how Jkns s nstalled on Ubuntu 18.04. Use ths powerful tool to actvate your VPS server!

Jkns s d by teams of all szes, for dffert language projects lke Java, Ruby, Dot Net, PHP etc. Jkns s a platform that s autonomous, and can be used on Wndows, Lnux or any other operatng system. 

You need to consder contnuous ntegraton (C) and contnuous delvery (CD) to understand Jkns: 

Developers update the code regularly n the shared repostory (such as GtHub or TFS). mprovemts made n the source code are made at the d of the day, makng t dffcult to dtfy the errors. So, Jkns s usedhere. 

Once a developer changes the repostory, Jkns wll automatcally able the buld and mmedately warn you n the evt of an error (Contnuous ntegraton C). 

Skp to the next secton f you have Java already nstalled on your system. 

To check, please run the followng command n the termnal: 

The default Ubuntu packages for Jkns are always behnd the currt verson of the project tself. You may use the project-mantaned packages to nstall Jkns to take advantage of the newest patches and features. 

1. add the framework repostory key: 

The devce returns OK wh the key s nserted. Install Jenkins

2. Next, lnk the repostory of Deban packages to the sources.lst of the server: 

3. Wh both are n place, upgrade to apt to use the new repostory: 

4. nstall Jkns: 

Now we’re gong to start the Jkns server, as Jkns and ts depdces are n place. 

1. You can start Jkns usng systemctl: 

2. As systemctl does not dsplay performance, you can use the status command to check that Jkns has successfully launched: 

f all wt well, the start of the performance should demonstrate that the servce s actve and ready to boot: 

Output: 

As Jkns s runnng, so adjust the frewall rules to complete our further setup of Jkns from the web browser. 

1. Jkns works by default on port 8080, so let’s op the port wth ufw: 

2. Check ufw’s status: 

You wll see that traffc from anywhere s permtted to port 8080. 

Output: 

3. f the frewall s nactve, the followng commands wll allow OpSSH and turn t on: 

We can fnsh the ntal confguraton wth Jkns nstalled and our frewall confgured. 

Note: f you decde to contnue to use Jkns, use a Ngnx Reverse Proxy at Ubuntu 18.04 to confgure Jkns wth SSL wh your exploraton has be completed to protect your passwords and any sstve system or product nformaton st betwe the machne and the server n plan text. 

1. To set up nstallaton, vst Jkns on ts default 8080 port wth your server doman name or P address: http://your_server_p_or_doman:8080 

You should see the Unlock Jkns scre, whch dsplays the ntal password’s locaton:

Unlock Jenkin

2. You can use the cat command to dsplay the password: 

3. Copy the alphanumerc termnal 32-character password and paste nto the Admnstrator Password feld, th clck Contnue. 

Output: 

The followng scre shows the ablty to nstall or select certan plugns: Customize jenkins

4. We wll clck on the opton to nstall proposed plugns to start the nstallaton process mmedately. 

5. Wh the nstallaton s done, the frst admnstratve user wll be prompted. You can save ths step and use your ntal password to contnue as an Admn. However, we wll take some tme to create the user. 

The Jkns default server s NOT crypted to prevt data from beng protected. Use the Ngnx Reverse Proxy on Ubuntu 18.04 to confgure Jkns wth SSL. Ths protects the nformaton of users and bulds transmtted through the web nterface. Create First Admin User

6. You wll see a confguraton nstance page, whch asks you to confrm your Jkns nstance’s URL of choce. Confrm ether your server’s doman name or the P address of your server.  Instance Configuration

7. Clck Save and Fnsh once you have confrmed the relevant nformaton. A confrmaton page wll show you that “Jkns s ready!”  Jenkins is ready

HStart usng Jkns button and t wll take you to the Jkns dashboard.  Welcome to Jenkin

Congratulatons! You have completed the nstallaton of Jkns. 

The freestyle job s a hghly versatle and user-frdly choce. t’s easy to set up and many of ts optons appear n many other buld jobs. For all projects, you can use t. 

Follow the followng steps: 

You have to logn to your Jkns Dashboard by vstng

Welcome to jenkin

2) Create New tem: 

Clck on the New tem on the left-hand sde of the dashboard.

 Create New item

3) Fll the project descrpton: 

You can ter the job detals as per your need. Fill the project description

4) Source Code Managemt: 

Under source code managemt, ter the repostory URL.
You can also use a Local repostory. 

5) Buld vronmt: 

Now n the Buld secton, 

 Build Environment

Now, add the java commands. n ths artcle, we have used javac HelloWorld.java and java HelloWorld.    Build Environment

6) Save the project: 

Clck Apply and save the project. 

7) Buld Source Code and check ts status: 

Clck on “Buld Now” on the left-hand sde of the scre to create the source code. 

8) Console Output: 

Select the buld number and clck on “Console Output” to check the status of the buld run. Console Output

Wh t shows success, t means that we have successfully run the HelloWorld program from the cGtHub Repostory. 

n case of falure, you can check the job logs by clckng on falure con and debug the root cause.

Follow the nstructons to unnstall Jkns: 

sudo apt-get remove jkns Uninstall Jenkins

sudo apt-get remove –auto-remove jkns 

Purgng your data: 

or you can use: 

Concluson: 

nstallng Jkns on Ubuntu s really that easy. Jkns has a low learnng curve and so you can start to work wth t as quckly as possble. 

n the above artcle we have learned how to nstall Jkns n an Ubuntu machne where all the steps are explaned clearly. n case you want to learn more about the core concepts of Jkns Jobs, Ppelnes, Dstrbuted System, Plugns, and how to use Jkns n depth you can roll for our course Jenkins Certification Course. 

  • Hardware Requremts: 

    • RAM- 4 GB (Recommded) 
    • Storage- more than 50 GB of Hard Dsk (Recommded)        
  • RAM- 4 GB (Recommded) 
  • Storage- more than 50 GB of Hard Dsk (Recommded)        
  • Software Requremts: 

    • Java: Java Developmt (JDK) or Java Runtme vronmt (JRE).  
    • Web Browser: Any browser such as Google Chrome, Mozlla Frefox, Mcrosoft Edge. 
    • Operatng System: An Ubuntu 18.04 server nstalled wth a non-root sudo user and frewall. For help n the nng of producton capablty of a Jkns nstallaton seChoosing the right hardware for Masters. 
  • Java: Java Developmt (JDK) or Java Runtme vronmt (JRE).  
  • Web Browser: Any browser such as Google Chrome, Mozlla Frefox, Mcrosoft Edge. 
  • Operatng System: An Ubuntu 18.04 server nstalled wth a non-root sudo user and frewall. For help n the nng of producton capablty of a Jkns nstallaton seChoosing the right hardware for Masters. 
  • Contnuous ntegraton – the practce of contnuous producton combned wth the man ndustry. 
  •  Contnuous delvery – the code s constantly delvered to an area after the code s ready for delvery. t could be for producton or st. The commodty s suppled to a consumer base that can provde QA or nspecton by customers. 
  • Jkns needs Java for runnng, but doesn’t nclude certan dstrbutons by default, and Java versons of Jkns are ncompatble. 
  • Multple Java mplemtatons are avalable to you. OpJDK s currtly the most popular one, whch we wll use n ths gude. 
  • Beng an op-source Java applcaton, Jkns requres the nstallaton of OpJDK 8 on your system. The apt repostores can drectly access OpJDK 8. 
  • The nstallaton of OpJDK from standard repostores s recommded. Op and ter the followng n the termnal wndow: 
  • The download and nstallaton wll be requested. Press the “Y” button and press the ter button to fnsh the process. 
  • Java 8 wll be nstalled on your system. We are ready to download Jkns package now as we have our requremts ready! 
  • Clck on the “Add buld Setup” 
  • Select Execute Wndows batch command“.

  • Source