In this article, we will learn how to install Jenkins on the following operating systems.
WindowsCentOSUbuntu
For all the above operating systems, Jenkins installation steps slightly vary, but configuration steps are the same.
Prerequisite
JDK8+ is mandatory for all operating systems. So first we need to install JDK8 or higher version. You can download and install it from here.
Jenkins Installation on Windows
Once JDK is installed and running, we are ready to download and install Jenkins. Click here to download the latest Jenkins MSI package for Windows.
Double click on jenkins.msi to begin the installation.
Click on Next and then install
Click on the Change button if you want to install it in another directory. In this example, we will keep the default option, click Next
When done with the installation process, click the Finish button to complete the installation.
As you can see the Jenkins installation in Windows is really easy. Just like any other standard software.
Jenkins Installation on Ubuntu
As mentioned earlier, make sure JDK8+ is installed and running on the Ubuntu machine. If it is not installed execute below command to install it. sudo apt install default-jdk-headless To verify Java has been installed successfully, execute the below command: java -version Once it is installed, then we are good to go for Jenkins installation.
Installation Steps:
Step 1 : First, Open command terminal (Ctrl + Alt + T) Step 2: For installing Jenkins, Let’s adding repository key to the system wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add - Step 3: Once the key is added, we need to append the Debian package repos address to the machine. sudo sh -c ’echo deb http://pkg.jenkins-ci.org/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list’ Step 4: Now update Ubuntu packages sudo apt update Step 5: Finally to install Jenkins, execute below command sudo apt install jenkins Jenkins installed successfully. Now we can start Jenkins server. Step 6: Starting Jenkins through systemctl command sudo systemctl start jenkins systemctl does not show the output so we can check the status through the below command. Through this command, we can check whether Jenkins is active or not. sudo systemctl status jenkins Step 6: Configuring port (Optional) By default, Jenkins is run on 8080 port, and we need to make this port accessible from anywhere(if it is not accessible). Let’s open the port : sudo ufw allow 8080 We can check the status of the port below the following command: sudo ufw status If the status showing of firewall inactive then run the following command otherwise it is not required sudo ufw allow OpenSSH followed by sudo ufw enable
Jenkins Installation on CentOS
First, make sure JDK8+ is installed and running on the machine. If it is not installed execute below command to install OpenJDK 8 package. To verify Java has been installed successfully, execute the below command Once it is installed, then we are good to go for Jenkins installation.
Installation Steps
Step 1: First, Open Command Terminal Step 2: To install Jenkins, First, we need to download and add Jenkins GPG key: Step 3: After downloading and adding Jenkins GPS key, next Import Jenkins GPG Key: Step 4: Update CentOS packages Step 5: After update centos packages, we are ready to install, Jenkins: Step 6: Starting Jenkins through systemctl Since systemctl does not show the output so you can check the status through the below command. And through this command, you can check whether Jenkins is active or not. Step 7: Configuring the port(Optional) By default, Jenkins is run on 8080 port, and we need to make this port accessible from anywhere(only if it is not accessible). Let’s open the port, After configure port reload firewall the
Configuring Jenkins
Once Jenkins is installed, it will be running on port 8080, Let’s configure it by navigating to http://localhost:8080 on our favorite browser. Step-1: Visit http://localhost:8080 Step-2: To unlock the Jenkins, copy the administrator password from the file located at
For Windows
C:\Program Files (x86)\Jenkins\secrets\initialAdminPassword
For CentOS and Ubuntu
/var/lib/jenkins/secrets/initialAdminPassword Now, paste it in the Administrator password field. Then, click the Continue button. Step-3: You can install either suggested plugins or you can select plugins depending on your use case. Here, we will install the suggested plugins. Step-4: Please wait until all plugin is installed. When installation is done, click on Continue. Step-5: Create an admin profile for Jenkins. Enter the required details and Click on Save and Continue. Step-6: We can change the Jenkins URL if required, Let’s keep it default http://localhost:8080. Click Save and Finish to complete the configuration process. Now click on Start Using Jenkins Finally, the configuration process is done, and the above one is the default, Welcome to Jenkins! page. The Jenkins configuration step is similar for all OS, except Step 2 where we need to retrieve and enter the administrator password. This password could be retrieved from the file, store at the path shown on to Unlock Jenkins UI.
Conclusion
So the above were steps to install Jenkins on your favorite OS. Next, learn how to create your first Jenkins Pipelines. Jenkins installation is easy and if you are setting up for the remote team then you can either get some Cloud VM and install it yourself or go for Jenkins hosting platform.