Jenkins is an open source automation server written in Java. Jenkins helps to automate the non-human part of the software development process, with continuous integration and facilitating technical aspects of continuous delivery.
Jenkins is an open source framework for continuous integration, continuous deployment and test automation. we can install Jenkins in several ways and on different OS. This tutorial explain installation of Jenkins on below:
- How to install Jenkins a WAR file.
- How to install Jenkins on Window.
- How to install on Apache Tomcat Server.
- How to install on Ubuntu.
Prerequisite to install Jenkins :First, install JDK. Jenkins supports Java 8. If you don’t know how to install Java, look at this blog. Now that Java is installed, we can proceed with Jenkins.
How to Install Jenkins with a WAR File
1. Click here to download latest Jenkins WAR file.
2. Copy the jenkins.war file to the folder you want. I created a folder named Jenkins in the path C:\Jenkins and copied the jenkins.war file to it.
3. Open the command prompt window and browse to the directory where the jenkins.war file is present, through the command cd C:\Jenkins.
4. Run the command java -jar jenkins.war
5. Wait until the process completes.
6. Take a look at the line “INFO: Jenkins is fully up and running” that indicates that Jenkins is running. Write down the random password that is auto generated. We will use this password for the initial login later.
7. Paste the URL http://localhost:8080 in your browser to browse to the Jenkins page.
8. To unlock Jenkins, paste the random password that you wrote down in the previous step or copy it from the the user account folder, from the file C:\Users\<your_user_account_folder_name>\.jenkins\secrets\initialAdminPassword. Paste it in the Administratorpassword field and click on the “Continue” button.
9. Install the suggested plugins or customize plugins installation according to your needs. We will install the default suggested plugins.
10. Wait for the plugins to complete the installation.
11. Create an admin user and click “Save and Continue”.
12. Click “Save and Finish” to complete the process.
13. Finally! Click “Start using Jenkins” to start Jenkins.
How to Install Jenkins on Windows
1. Click here to download the latest Jenkins package for Windows (currently it is version 2.130)
2. Unzip the file to a folder and click on the Jenkins exe file.
3.Click “Next” to start the installation.
4. Click the “Change…” button if you want to install Jenkins in another folder. In this example I will keep the default option and click on the “Next” button.
5. Click the “Install” button to start the installation process.
6. The installation is processing.
7. When done, click the “Finish” button to complete the installation process.
8. You will automatically be redirected to a local Jenkins page, or you can paste the URL http://localhost:8080 in a browser.
9. To unlock Jenkins, copy the password from the file at C:\Program Files (x86)\Jenkins\secrets\initialAdminPassword and paste it in the Administrator password field. Then, click the “Continue” button.
10. You can install either the suggested plugins or selected plugins you choose. To keep it simple, we will install the suggested plugins.
11. Wait until the plugins are completely installed.
12. The next thing we should do is create an admin user for Jenkins. Put in your details and click “Save and Continue”.
13. Click “Save and Finish” to complete the Jenkins installation.
14. Now, click “Start using Jenkins” to start Jenkins.
15. Finally, here is the default Jenkins page.
How to Install Jenkins on the Apache Tomcat Server
Jenkins is a powerful open source tool that enables you to automate tests and deployment. Apache Tomcat is a powerful servlet Java container for running web applications. If you are running your apps in Tomcat, or wish to do so, you might also want to run Jenkins in it .
Installing Apache Tomcat Server
1. Go to the official Tomcat website and choose the Tomcat version to download. Here I chose version 9.
2. Choose the appropriate binary for your machine. In this case, I chose the binary for Windows 64-bit.
3. Copy the downloaded zip file to the location of your choice and unzip it. In this example, I copied it to the folder C:\Tomcat.
4. Go to sub folder bin and click on the startup windows bat file.
The Tomcat server will start.
5. Browse to the url http://localhost:8080 to launch the Tomcat server.
We can now install Jenkins.
1. Click here to download the latest Jenkins WAR file.
2. Copy the jenkins.war file to the sub folder webapps in the Tomcat installation. It will auto generate a Jenkins folder.
3. Go to the url http://localhost:8080/jenkins to launch the initial Jenkins page.
4. To unlock Jenkins, paste the random password copied from the file C:\Users\<your_user_account_folder_name>\.jenkins\secrets\initialAdminPassword. Paste it in the Administratorpassword field and then click on the “Continue” button.
5. Either click on “Install suggested plugins” to install the default plugins or “Select plugins to install” to install the plugins you want . In this case we will install the default suggested plugins.
6. The plugins will install, wait until this process is completed.
7. Create your first admin user for Jenkins and click “Save and Continue”.
8. Click “Save and Finish” to complete the installation!
9. This is the last step! Click in “Start using Jenkins” to open the default Jenkins page.
10. You can now start your job with Jenkins!
How to Install Jenkins on Ubuntu
1. Add the repository key to the system with the following command. The command will download the Jenkins key file and add it to the system. This key is required on Ubuntu so that it can authenticate packages being downloaded from the Jenkins repository server.
wget -q -O – https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add –
2. Append the debian package repository address to the server’s sources.list through the command:
echo deb https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list
3. Next, run the command sudo apt-get update to make sure we are getting the latest updates.
4. Install Jenkins through the command sudo apt-get install jenkins
5. Start the Jenkins server through the command sudo systemctl start Jenkins
6. Verify Jenkins is active through the command sudo systemctl status Jenkins
7. Go to the Jenkins page by pasting the URL http://localhost:8080 in your browser.
8. To unlock Jenkins, copy the password from the file /var/lib/jenkins/secrets/initialAdminPassword, paste in the Administratorpassword field and click on the “Continue” button.
9. Select the plugins you want to install. Jenkins recommends you install a certain set of plugins that is regularly used in most cases. Choose them or customize the plugins you want to install. In this example, we will install the suggested plugins.
10. The plugins are installed immediately. Wait until all plugins successfully installed.
11. Create an admin user for Jenkins and click “Save and Continue”.
12. Click “Save and Finish” to complete the Jenkins installation.
13. Click on “Start using Jenkins” to access the default Jenkins page.
14. If everything is ok, you will get to a page that looks like this:
You can now start with Jenkins! Thank you for reading!