DevOps ~ Jenkins Installation - rohit120582sharma/Documentation GitHub Wiki
Jenkins requires Java 8 or 11 (either a JRE or Java Development Kit (JDK)).
In Windows / Mac machine, download and install Oracle JDK 8.
In Linux based OS, use apt-get. It is a command-line tool which helps in handling packages in Linux. Here APT stands for the Advanced Packaging Tool.
The openjdk-8-jre package contains just the Java Runtime Environment. If you want to develop Java programs then please install the openjdk-8-jdk package.
$ sudo apt-get install openjdk-8-jre
$ sudo apt-get install openjdk-8-jdk
# Determining the default version of the JDK
$ java -version
-
Open up a terminal, and use following steps:
$ cd ~/path-to-jenkins-war $ java -jar jenkins.war --httpPort=8080
-
Browse to http://localhost:8080
-
Follow the instructions to complete the installation
- First, we’ll add the repository key to the system:
$ wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
- When the key is added, the system will return OK. Next, we’ll append the Debian package repository address to the server’s sources.list:
$ echo deb https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list
- When both of these are in place, we’ll run update so that apt-get will use the new repository:
$ sudo apt-get update
- Finally, we’ll install Jenkins and its dependencies, including Java:
$ sudo apt-get install jenkins
- Now that Jenkins and its dependencies are in place, we’ll start the Jenkins server.
- Using systemctl we’ll start Jenkins:
$ sudo systemctl start jenkins
- Since systemctl doesn’t display output, we’ll use its status command to verify that it started successfully:
$ sudo systemctl status jenkins
- Now that Jenkins is running, we’ll adjust our firewall rules so that we can reach Jenkins from a web browser to complete the initial set up.
- By default, Jenkins runs on port 8080, so we’ll open that port using ufw:
$ sudo ufw allow 8080
- We can see the new rules by checking UFW’s status.
$ sudo ufw status
- Note: If the firewall is inactive, the following commands will make sure that OpenSSH is allowed and then enable it.
$ sudo ufw allow OpenSSH $ sudo ufw enable
- Now that Jenkins is installed and the firewall allows us to access it, we can complete the initial setup. Browse to http://ip_address_or_domain_name:8080 and follow the instructions to complete the installation