User Tools

Site Tools


tech:devops:jenkins:start

Jenkins Topics

Installation & Configuration

Prerequisites

Jenkins Installation

Pull the Jenkins repository file and import its GPG key:

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

… then, do a yum update and yum install jenkins
If the jenkins login isn't locked down off-server:

  • Enable login for Jenkins with usermod -s /bin/bash jenkins
  • Log in as jenkins and create SSH key with: ssh-keygen -t rsa

Otherwise:

  • Create SSH key for jenkins from root: ssh-keygen -f id_rsa -C “jenkins@bluejay”

Open firewall for Jenkins:

firewall-cmd --permanent --zone=public --add-port=8080/tcp
firewall-cmd --reload

Remember to systemctl enable jenkins and systemctl start jenkins
Log in (default login is admin with password admin) and change password, add user(s)

Maven Installation

Get latest maven archive, example:

wget http://www-eu.apache.org/dist/maven/maven-3/3.6.0/binaries/apache-maven-3.6.0-bin.tar.gz

Extract to suitable location and sym-link to it (/usr/maven or /opt/maven)
Set environment variables in /etc/profile.d/maven.sh:

export M3_HOME=/usr/maven
export M2_HOME=${M3_HOME}
export PATH=${M3_HOME}/bin:${PATH}

… perform a source /etc/profile.d/maven.sh to get these in current shell.

Configuration

Environment Variables

Some environment variables may need to be set at the global level, which can be configured under the “Manage Jenkins” section:

  • PATH
  • JAVA_HOME
  • M3_HOME

Trivia

CentOS/RHEL Trivia

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

NOTE: if you've previously imported the key from Jenkins, the “rpm –import” will fail because you already have a key. Please ignore that and move on.

You will need to explicitly install a Java runtime environment, because Oracle's Java RPMs are incorrect and fail to register as providing a java dependency. Thus, adding an explicit dependency requirement on Java would force installation of the OpenJDK JVM.
With that set up, the Jenkins package can be installed with:

yum install jenkins
tech/devops/jenkins/start.txt · Last modified: 2018/12/19 01:39 by rk4n3