We recently set up a new Jenkins installation on Red Hat development box. Here are the steps.
1. SSH into the Red Hat server.
2. Setup need root access, so use either sudo, or login or su as root. Here we are running the su command.
> su root
3. Add Jenkins to your Yum repository, then install Jenkins.
> wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo > rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key > yum install jenkins
4. Jenkins runs on port 8080 by default. Port 8080 is a common port used by other applications so we are going to change it to 8081 instead. We’ll also disable AJP since we don’t need it.
> vi /etc/sysconfig/jenkins ... JENKINS_PORT="8081" ... JENKINS_AJP_PORT="-1"
5. We were getting an “java.lang.UnsatisfiedLinkError” error when we tried to start Jenkins. The fix is to change the tmp directory.
> vi /etc/sysconfig/jenkins JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Djava.io.tmpdir=$JENKINS_HOME/tmp"
> mkdir /var/lib/jenkins/tmp > chown jenkins.jenkins /var/lib/jenkins/tmp
6. Start Jenkins. Tail the log just to make sure things are okay.
> service jenkins start > tail -f /var/log/jenkins/jenkins.log
7. Open a browser and go to the freshly installed Jenkins instance.
7. To stop or restart Jenkin, run these
> service jenkins stop > service jenkins restart