Up and Running with Jenkins

Amir Raza
6 min readApr 12, 2020

--

What is Jenkins?

Jenkins is a leading open source automation tool written in Java for continuous integration (CI) practice. It is a server-base application and used to build, test and deploy your software projects.

What is CI?

Continuous Integration is a development practice to remove the problem of a build life cycle.

You can run Jenkins on your local machine in 3 ways

  1. Running Jenkins .war file using command (Easiest way)
  2. Installing Jenkins .war file on Apache Tomcat server
  3. Installing Jenkins .msi file on your system

⚠️ If you do not have JDK 8 installed, please click here to download or can be googled it for JDK 8 to run Jenkins on your machine.

We will be looking into all 3 processes of installation to dashboard.

1. Running Jenkins .war using command

  • Go to download’s page of Jenkins official website and search for Generic Java Package (.war) OR Click here to download directly.
  • After downloading, Copy the jenkins.war file and paste to any folder you want. I would prefer to create a folder in C drive and paste.
    e.g. C:\Jenkins
  • Open command prompt and browse to directory C:\Jenkins
  • Run the following command java -jar jenkins.war --httpPort=9090 and wait for the installation process to be finished.

💡 Tip: java -jar jenkins.war will run on default port 8080, If you want to run jenkins on a specific port, add --httpPort=9090

5. After installing successfully, visit to the browser localhost:9090and you will see

Congratulations! 😃 you are done with the easiest way of installation process. we will go ahead from this stage in a few mins. Just give a name to this screen as Unlock Jenkins, we will resume from here after covering the 2 other ways of installation method.

2. Install Jenkins .war file on Apache Tomcat Server

  • Click Tomcat-9 to download latest stable version (at the time of writing this article) for 64-bit Windows.
  • OR visit the Official website of Apache Tomcat and search for the Download section on the left side menu and click on latest stable version.
  • Now click on Tomcat 9 and you will see the following page.
  • Click on 64-bit Windows zip (pgp, sha512) to download 64-bit version.
  • After downloading successfully, unzip it and copy to the location where you want to save. I would prefer to keep in C. and rename the folder like.
    e.g. C:\Tomcat-9
  • Now go to bin folder and click on startup Window Batch File, and go to browser at localhost:8080

💡 Tip: If you are facing the problem in running with startup.bat try to run catalina.bat file (OR open cmd at tomcat\bin location and runcatalina run). If you are still facing the problem, try to check your environment variable for %CATALINA_HOME% or try to restart your machine.

  • Once you are successfully visited the localhost:8080, you will see a tomcat homepage.
  • Copy the jenkins.war file (previously we have seen how to download) and paste it to subfolder webapps e.g. C:\Tomcat-9\webapps, It will auto generate a jenkins folder.
  • Now visit the browser at localhost:8080/jenkins and you will see the unlock Jenkins page.

Congratulations! 😃 you are done with the 2nd way of installation process. we will now see the 3rd way to to install Jenkins.

3. Installing Jenkins .msi file on your system

  • Go to download’s page of Jenkins official website and search for Windows(or a/c to your OS) to download zip OR Click here to download directly (for windows OS).
  • Once you downloaded, unzip it and run the .msi file. It will start installation wizard, follow the steps by clicking next. When installation finished, click on the finish button, it will automatically open the browser at localhost:8080 and you will see the following
  • You can start/stop Jenkins server using command line:
    Go to installed location of jenkins e.g. C:\Program Files (x86)\Jenkins and open cmd with run as administrator and type:
    jenkins.exe start (to Start)
    jenkins.exe stop (to Stop)
    jenkins.exe restart (to Restart)

Congratulations! 😃 you are done with all the ways of installation process. we will now setup Jenkins dashboard to unlock and ready to use.

Unlock Jenkins

Now resuming from where we paused at unlock Jenkins screen.

Unlocking required the initial admin password to setup securely. You can find the password at the given path below
C:\Users\<user>\.jenkins\secrets\initialAdminPassword, open initialAdminPassword in notepad and copy the text and paste it here in the Administrator password field and press continue.

After processing the password, you see a plugin installation page where you have 2 options… either to install all suggested or manually pick relevant plugins. I would prefer to go with install suggested plugins

Install suggested plugins will start downloading randomly and installing the necessary plugins to up and running Jenkins to the dashboard.

Don’t worry if it failed at any point of plugin installation, you can re-install it from the Jenkins dashboard. After finishing, It will ask you to create first admin user, save the information and press Save and Continue OR you can skip by pressing Continue as admin.

After creating the admin user, you will see a last screen of Instance Configuration. Just press Save and Finish.

Here you go, Your Jenkins is ready! Start using Jenkins now.

By pressing Start using Jenkins, you will be redirected to Jenkins Dashboard.

Next time, when you visit to your Jenkins dashboard after shut-downing server, you will be asked to login. just provide the detail and Boom! 😃

Hats Off! You are done😎

What’s Next?

Create a first job using Jenkins.

Coming soon…!

--

--