• HOME
  • TECH BLOG
  • MIGRATING TO AMAZON WEB SERVICES
  • IT PROJECT MANAGEMENT BLOG
  • Q&A
  • INTERACTIVE LEARNING

JENKINS INSTALLATION AND ADMINISTRATOR SETUP


RED HAT LINUX VERSION 8

We are going to set up a basic Jenkins build server on a Red Hat Enterprise Linux 8 system and create our first Jenkins administrator user account.



GO TO THE JENKINS WEBSITE WHICH (jenkins.io)
CLICK ON THE DOWNLOAD BUTTON




CHOOSE RED HAT FROM THE LEFT COLUMN
THE LEFT COLUMN IS USED FOR LONG TERM SUPPORT
(LTS)WHICH IS MORE STABLE




AFTER CLICKING THE RED HAT LINK YOU WILL BE BROUGHT TO REDHAT LINUX RPM PACKAGES FOR JENKINS





RUN THE FIRST COMMAND



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



RUN THE second COMMAND



sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key







THE REPOSITORY IS NOW SET UP AND WE ALSO HAVE THE GPG SIGN IN KEY.
GPG IS ENCRYPTION SOFTWARE YOU USE TO ENCRYPT AND DECRYPT FILES.
UNDER THE COMMANDS THERE WILL BE A COMMENT ABOUT MAKING SURE THAT WE HAVE A JAVA ENVIRONMENT INSTALLED ON OUR SERVER.
JENKINS SUPPORTS THE OPEN JDK RUN TIME ENVIRONMENT WHICH IS THE OPEN SOURCE VERSION OF THE ORACLE JAVA DEVELOPMENT ENVIRONMENT



LET'S INSTALL THE JAVA RUN TIME ENVIRONMENT BY RUNNING THE COMAND:



sudo dnf install java



THE JAVA RUN TIME ENVIRONMENT IS NOW INSTALLED



NOW LET'S INSTALL JENKINS



sudo dnf install jenkins



jenkins IS NOW INSTALLED



Before we start Jenkins up, we need to make sure that our system's firewall is configured to allow incoming
network traffic to the Jenkins build server.

There is a link on this page that will take us to a wiki written just for installing Jenkins on Red Hat based Lennox distributions.



CLICK ON THE WIKI LINK



SCROLL DOWN TO CONFIGURE THE FIREWALL



OPENING PORT 8080

We don't need to worry about the serviceS,
because Red Hat Enterprise Linux 8 and above including Fedora already has a service for Jenkins within their firewall configuration.

All we need to do is just open up TCP Port 8080 on our firewall configuration.

You may need to install firewalld



sudo yum install firewalld - (installs firewalld)
sudo systemctl start firewalld - (starts firewalld)
sudo systemctl enable firewalld -(enables firewalld)
sudo systemctl status firewalld - (checks the the status of firewalld)





run the command to add port 8080:



sudo firewall-cmd --permanent --add-port=8080/tcp





We then To reload firewalld



sudo firewall-cmd --reload





enable the jenkins service



sudo systemctl enable jenkins.service






start the jenkins service



sudo systemctl start jenkins.service






check the status of the jenkins service



sudo systemctl status jenkins.service



Note: If you're on a Red Hat based distribution such as Red Hat Enterprise Linux, Centos or Fedora you will need to set up Security-Enhanced Linux (SELinux) to allow network communications to port 8080.

In order to see what network ports our server is expecting for web traffic, we will first install the SeLinux tools.



sudo dnf install policycoreutils-devel setroubleshoot-server



the SELinux tools have been installed












NOW LET'S CHECK WHAT PORTS SELINUX HAS CONFIGURED FOR INCOMING WEB TRAFFIC


sepolicy network -t http_port_t


JENKINS RUNS ON PORT 8080 ANDWE CAN SEE THAT PORT 8080 IS NOT SHOWING


WE WILL NEED TO ADD IT TO THE SELinux POLICY CONFIGURATION


WE WILL ONLY NEED TO DO THIS ONE TIME AFTER WE SET THIS POLICY. IT WILL BE SAVED WITHIN SELINUX’S CONFIGURATION AND WE WILL NOT NEED TO WORRY ABOUT THIS AGAIN.



add the port



sudo semanage port -a -t http_port_t -p tcp 8080



IT'S A LITTLE STRANGE THAT THE COMMAND OUTPUT SHIWS US THAT PORT 8080 WAS ALREADY DEFINED, YET WHEN WE LOOK AT THE OUTPUT WE SEE THAT IT IS NOT.


HOWEVER, THIS HELPS US TO ENSURE THAT THIS PORT IS READY TO GO WITH SELinux






open your web browser and use the ip address of your server followed by a colon and theN 8080.

In order to complete the secure setup of Jenkins, we need TO COPY THE PASSWORD FROM THE FILE LOCATION DISPLAYED HERE
into tthe administrator password field






COPY THE FILE LOCATION LISTED IN THE GETTING

STARTED WINDOW UNDER UNLOCK JENKINS.

/var/lib/jenkins/secrets/initialAdminPassword











use the command:



sudo cat /var/lib/jenkins/secrets/initialAdminPassword



TO DISPLAY THE PASSWORD.

IN THIS EXAMPLE THE PASSWORD IS 7cb0b0596c4c4835a8846a491238733f

COPY THE PASSWORD.





paste the password that was copied into the administrator field AND THEN CLICK ON THE CONTINUE BUTTON.







CLICK ON INSTALL SUGGESTED PLUGINS



THE PLUGINS ARE NOW INSTALLED






CREATE THE FIRST ADMIN USER

USERNAME:

PASSWORD:

CONFIRM PASSWORD:

FULL NAME:

E-MAIL ADDRESS:

THEN CLICK ON SAVE AND CONTINUE








TAKE NOTE OF THE URL AND THEN CLICK ON SAVE AND FINISH








JENKINS IS NOW READY TO USE

CLICK ONSTART USING JENKINS








WE ARE NOW LOGGED ON AS AN ADMIN USER TO JENKINS IN THE WEB CONSOLE.




CERTIFIED CLOUD EXPERTS | AWS PARTNER NETWORK
CLOUD CONSULTING FIRM | (516) 387-2085 | CONTACT US