Skip to content

Instantly share code, notes, and snippets.

@prasanjit-
Created June 26, 2017 01:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prasanjit-/9676aafe1e8ff8460c890495dae827b4 to your computer and use it in GitHub Desktop.
Save prasanjit-/9676aafe1e8ff8460c890495dae827b4 to your computer and use it in GitHub Desktop.
Jenkins Installation
'''''''''''''''''''''''''''''
Module 3 - Process Automation
'''''''''''''''''''''''''''''
Concepts Covered:::
- Jenkins Deployment & Overview
- Process Automation
Jenkins is an open source automation server written in Java. The project was forked from Hudson after a dispute with Oracle.
Jenkins helps to automate the non-human part of the whole software development process with now common things like continuous integration and by empowering teams to implement the technical aspects of continuous delivery.
It is a server-based system running in a servlet container such as Apache Tomcat.
It supports version control tools, including AccuRev, CVS, Subversion, Git, Mercurial, Perforce, Clearcase and RTC, and can execute Apache Ant, Apache Maven and sbt based projects as well as arbitrary shell scripts and Windows batch commands.
The creator of Jenkins is Kohsuke Kawaguchi. Released under the MIT License, Jenkins is free software.
Builds can be triggered by various means, for example by commit in a version control system, by scheduling via a cron-like mechanism and by requesting a specific build URL.
It can also be triggered after the other builds in the queue have completed.
Jenkins functionality can be extended with plugins.
:: Installing Jenkins in CentOS 7 ::
Step 1: Update your CentOS 7 system
One of the Linux system administrator's best practices is keeping a system up to date. Install the latest stable packages, then reboot.
sudo yum install epel-release
sudo yum update # (optional)
sudo reboot # (optional)
When the reboot finishes, login with the same sudo user.
Step 2: Install Java
Before you can install Jenkins, you need to setup a Java virtual machine on your system. Here, let's install the latest OpenJDK Runtime Environment 1.8.0 using YUM:
sudo yum install java-1.8.0-openjdk.x86_64
After the installation, you can confirm it by running the following command:
java -version
This command will tell you about the Java runtime environment that you have installed:
openjdk version "1.8.0_121"
OpenJDK Runtime Environment (build 1.8.0_91-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)
In order to help Java-based applications locate the Java virtual machine properly, you need to set two environment variables: "JAVA_HOME" and "JRE_HOME".
sudo cp /etc/profile /etc/profile_backup
echo 'export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk' | sudo tee -a /etc/profile
echo 'export JRE_HOME=/usr/lib/jvm/jre' | sudo tee -a /etc/profile
source /etc/profile
Finally, you can print them for review:
echo $JAVA_HOME
echo $JRE_HOME
Step 3: Install Jenkins
Use the official YUM repo to install the latest stable version of Jenkins, which is 1.651.2 at the time of writing:
cd ~
yum install wget -y
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
sudo rpm --import http://pkg.jenkins-ci.org/redhat-stable/jenkins-ci.org.key
sudo yum install jenkins
Start the Jenkins service and set it to run at boot time:
sudo systemctl start jenkins.service
sudo systemctl enable jenkins.service
(This is optional, just disable iptables for lab purposes)
In order to allow visitors access to Jenkins, you need to allow inbound traffic on port 8080:
sudo firewall-cmd --zone=public --permanent --add-port=8080/tcp
sudo firewall-cmd --reload
Now, test Jenkins by visiting the following address from your web browser:
http://server_IP:8080
Default password present in /var/lib/jenkins/secrets/initialAdminPassword location
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment