Installation and Setup of Jenkins

Mac OS

Install Homebrew

Installation of Jenkins on MacOS can be performed using Homebrew. If Homebrew is not already installed, it can be installed using below steps.

Command : ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

DD:~ DevOpsDiggers$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Warning: The Ruby Homebrew installer is now deprecated and has been rewritten in
Bash. Please migrate to the following command:
  /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew


Press RETURN to continue or any other key to abort
Password:
==> /usr/bin/sudo /bin/mkdir -p /Users/DevOpsDiggers/Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Users/DevOpsDiggers/Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown DevOpsDiggers /Users/DevOpsDiggers/Library/Caches/Homebrew
==> Downloading and installing Homebrew..
HEAD is now at 9befd55d5 Merge pull request #7492 from Bo98/docker-fix
Already up-to-date.
==> Installation successful!

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics data has been sent yet (or will be during this `install` run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations

==> Next steps:
- Run `brew help` to get started
- Further documentation: 
    https://docs.brew.sh

Install Java

command : brew cask install homebrew/cask-versions/adoptopenjdk8

DD:~ DevOpsDiggers$ brew cask install homebrew/cask-versions/adoptopenjdk8
Updating Homebrew...
==> Downloading https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u252-b09/OpenJDK8U-jdk_x64_mac_hotspot_8u252b09.pkg
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/140418865/c5d7a700-80b2-11ea-83f0-4ba454f82e1c?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2
######################################################################## 100.0%
==> Verifying SHA-256 checksum for Cask 'adoptopenjdk8'.
==> Installing Cask adoptopenjdk8
==> Running installer for adoptopenjdk8; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
installer: Package name is AdoptOpenJDK
installer: Installing at base path /
installer: The install was successful.
🍺  adoptopenjdk8 was successfully installed!

Install Jenkins

command : brew install jenkins

DD:~ DevOpsDiggers$ brew install jenkins
Updating Homebrew...
==> Downloading http://mirrors.jenkins.io/war/2.234/jenkins.war
==> Downloading from http://mirror.xmission.com/jenkins/war/2.234/jenkins.war
######################################################################## 100.0%
==> jar xvf jenkins.war
==> Caveats
Note: When using launchctl the port will be 8080.

To have launchd start jenkins now and restart at login:
  brew services start jenkins
Or, if you don't want/need a background service you can just run:
  jenkins
==> Summary
🍺  /usr/local/Cellar/jenkins/2.234: 6 files, 63.2MB, built in 2 minutes 34 seconds

Start Jenkins

Command: brew services start jenkins

To check if Jenkins service has been started, status command can be used.

Command: brew services status jenkins

Linux

In order to get the package from Jenkins repository first wget has to be installed on Linux systems if not already installed.

Install wget

Command : sudo yum install wget

Command : wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo

[root@ip-172-31-17-138 ~]# wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
--2020-05-05 02:05:51--  http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
Resolving pkg.jenkins-ci.org (pkg.jenkins-ci.org)... 52.202.51.185
Connecting to pkg.jenkins-ci.org (pkg.jenkins-ci.org)|52.202.51.185|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 85
Saving to: ‘/etc/yum.repos.d/jenkins.repo’

/etc/yum.repos.d/je 100%[===================>]      85  --.-KB/s    in 0s      
2020-05-05 02:05:51 (13.0 MB/s) - ‘/etc/yum.repos.d/jenkins.repo’ saved [85/85]

Command : rpm –import https://jenkins-ci.org/redhat/jenkins-ci.org.key

Install Jenkins

Command : yum install jenkins java-1.8.0-openjdk-devel

[root@ip-172-31-23-97 ec2-user]# yum install jenkins java-1.8.0-openjdk-devel
Last metadata expiration check: 0:02:24 ago on Sat 06 Jun 2020 02:41:40 AM UTC.
Package jenkins-2.222.4-1.1.noarch is already installed.
Dependencies resolved.
================================================================================
 Package                 Arch   Version        Repository                  Size
================================================================================
Installing:
 java-1.8.0-openjdk-devel
                         x86_64 1:1.8.0.252.b09-2.el8_1
                                               rhel-8-appstream-rhui-rpms 9.8 M
Installing dependencies:
 alsa-lib                x86_64 1.2.1.2-3.el8  rhel-8-appstream-rhui-rpms 441 k
 atk                     x86_64 2.28.1-1.el8   rhel-8-appstream-rhui-rpms 272 k
 avahi-libs              x86_64 0.7-19.el8     rhel-8-baseos-rhui-rpms     63 k
 cairo                   x86_64 1.15.12-3.el8  rhel-8-appstream-rhui-rpms 721 k
 copy-jdk-configs        noarch 3.7-1.el8      rhel-8-appstream-rhui-rpms  27 k
 cups-libs               x86_64 1:2.2.6-33.el8 rhel-8-baseos-rhui-rpms    432 k
 dejavu-fonts-common     noarch 2.35-6.el8     rhel-8-baseos-rhui-rpms     74 k
 dejavu-sans-fonts       noarch 2.35-6.el8     rhel-8-baseos-rhui-rpms    1.5 M
 fontconfig              x86_64 2.13.1-3.el8   rhel-8-baseos-rhui-rpms    275 k
 fontpackages-filesystem noarch 1.44-22.el8    rhel-8-baseos-rhui-rpms     16 k
 fribidi                 x86_64 1.0.4-8.el8    rhel-8-appstream-rhui-rpms  89 k
 gdk-pixbuf2             x86_64 2.36.12-5.el8  rhel-8-baseos-rhui-rpms    467 k
 gdk-pixbuf2-modules     x86_64 2.36.12-5.el8  rhel-8-appstream-rhui-rpms 109 k
 giflib                  x86_64 5.1.4-3.el8    rhel-8-appstream-rhui-rpms  51 k
 graphite2               x86_64 1.3.10-10.el8  rhel-8-appstream-rhui-rpms 122 k
 gtk-update-icon-cache   x86_64 3.22.30-5.el8  rhel-8-appstream-rhui-rpms  33 k
 harfbuzz                x86_64 1.7.5-3.el8    rhel-8-appstream-rhui-rpms 294 k
 hicolor-icon-theme      noarch 0.17-2.el8     rhel-8-appstream-rhui-rpms  48 k
 jasper-libs             x86_64 2.0.14-4.el8   rhel-8-appstream-rhui-rpms 167 k
 java-1.8.0-openjdk      x86_64 1:1.8.0.252.b09-2.el8_1
                                               rhel-8-appstream-rhui-rpms 320 k
 java-1.8.0-openjdk-headless
                         x86_64 1:1.8.0.252.b09-2.el8_1
                                               rhel-8-appstream-rhui-rpms  33 M
 javapackages-filesystem noarch 5.3.0-1.module+el8+2447+6f56d9a6
                                               rhel-8-appstream-rhui-rpms  30 k
 jbigkit-libs            x86_64 2.1-14.el8     rhel-8-appstream-rhui-rpms  55 k
 libX11                  x86_64 1.6.8-3.el8    rhel-8-appstream-rhui-rpms 611 k
 libX11-common           noarch 1.6.8-3.el8    rhel-8-appstream-rhui-rpms 158 k

Start Jenkins

Command : systemctl start jenkins

To check if Jenkins service has been started, status command can be used.

Command : systemctl status jenkins

[root@ip-172-31-23-97 ec2-user]# systemctl status jenkins
 jenkins.service - LSB: Jenkins Automation Server
   Loaded: loaded (/etc/rc.d/init.d/jenkins; generated)
   Active: active (running) since Sat 2020-06-06 02:44:42 UTC; 8s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 13408 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=>
    Tasks: 27 (limit: 4936)
   Memory: 226.5M
   CGroup: /system.slice/jenkins.service
           └─13429 /etc/alternatives/java -Dcom.sun.akuma.Daemon=daemonized -Dj>

Windows

Jenkins package for windows can be downloaded from the below link.

Link:

https://www.jenkins.io/download/

Download Package

Install Jenkins

Setup

Once Jenkins get started, then Jenkins dashboard can be accessed with port 8080.

localhost:8080

We will see the options to install plugins . It is better to select “Install suggested plugins” option if not sure what plugins need to get installed.