Prerequisites

Jenkins requires Java7 or above and Servlet 3.1 to function. Java8 is recommended. Jenkins requires a fair amount of memory to operate well. Smaller installations should start around 256MB-1GB.

To check your current kernel version, open a terminal and use uname -r to display your kernel version:

 $ uname -r
3.10.0-229.el7.x86_64

Jenkins Installation in Centos

On RPM-based distributions, such as Red Hat Enterprise Linux (RHEL), CentOS, Fedora or Scientific Linux, you can install Jenkins through yum.

Make sure your existing packages are up-to-date.

 $ sudo yum update

Download and Install JDK 8.0

 
# # # # # # # # #  Download and Install JDK 8.0 using tar Ball # # # # # # # # # # # # #
$ yum install wget -y
$ cd /opt/
$ mkdir devops
$ cd devops
$ wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.tar.gz
$ tar -zxvf jdk-8u191-linux-x64.tar.gz
$ export JAVA_HOME=path to jdk
$ export PATH=$JAVA_HOME/bin:$PATH
$ echo $JAVA_HOME
$ java -version

# # # # # # # # #  OR # # # # # # # # # # # # # 
# # # # # # # # #  Download and Install JDK 8.0 using RPM file # # # # # # # # # # # # #
$ yum install wget -y
$ wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm
$ rpm -ivh jdk-8u131-linux-x64.rpm
$ java -version

To use this repository, run the following command:


$ sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
$ sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
		  

With that set up, the Jenkins package can be installed with:

 $ yum install jenkins 

To stop the Jenkins Services:

 $ systemctl stop jenkins 

To start the Jenkins Services:

 $ systemctl start jenkins 

To verify if the Jenkins Services are running or not:

 $ ps -eaf | grep -i jenkins 

To know the jenkins used directory location, refer the process log of following commands

 $ ps -eaf | grep -i jenkins 

What does jenkins package do?

  • Jenkins will be launched as a daemon on startup. See /etc/init.d/jenkins for more details.
  • The 'jenkins' user is created to run this service. If you change this to a different user via the config file, you must change the owner of /var/log/jenkins, /var/lib/jenkins, and /var/cache/jenkins.
  • Log file will be placed in /var/log/jenkins/jenkins.log. Check this file if you are troubleshooting Jenkins.
  • /etc/sysconfig/jenkins will capture configuration parameters for the launch.
  • By default, Jenkins listen on port 8080. Access this port with your browser to start configuration.  Note that the built-in firewall may have to be opened to access this port from other computers.  (See http://www.cyberciti.biz/faq/disable-linux-firewall-under-centos-rhel-fedora/ for instructions how to disable the firewall permanently)
  • A Jenkins RPM repository is added in /etc/yum.repos.d/jenkins.repo

Disable the firewall


firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --reload
firewall-cmd --list-all

Accessing Jenkins and Configuring

Jenkins Configuring Screen - 1

jenkins-install-configuration

Jenkins Configuring Screen - 2

jenkins-install-configuration

Jenkins Configuring Screen - 3

jenkins-install-configuration

Jenkins Configuring Screen - 4

jenkins-install-configuration

Jenkins Configuring Screen - 5

jenkins-install-configuration

Jenkins Configuring Screen - 6

jenkins-install-configuration

Jenkins Configuring Screen - 7

jenkins-install-configuration

Jenkins Installation in Windows

Download and Install JDK 8.0 from following url

 
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Set the JAVA_HOME in system environment variable

Download the Latest Jenkins from http://mirrors.jenkins-ci.org/windows-stable/latest and install

To check if windows jenkins services are running or not

 
Type "services.msc" on run commands
and look for jenkins service and their status  
		  

  Call us on +91 700 483 5930   |   +91 700 483 5706     Contact@DevopsSchool.com