Setting Up Jenkins on Red Hat 6.5

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.

http://server:8081

7. To stop or restart Jenkin, run these

> service jenkins stop
> service jenkins restart

Mapping SharePoint to a Windows Drive

Use the “net use” command to map SharePoint to a local drive. You need local network access to SharePoint, so you either need to be in the office or connected via VPN.

net use DRIVE: \\SHARE_POINT_HOST@ssl PASSWORD /user:USERNAME

Excluding Folders in Play Framework 2.2 dist

We have a Play Framework 2.2 application that uses Gulp to optimize the public files. Gulp uses Node.js and it creates a public\node_modules directory. We don’t need the node_modules directory at runtime so we want to remove it when running the Play “dist” command.

1. In build.sbt, add the following lines.

mappings in (Compile, packageBin) ~= { _.filterNot { case (_, name) =>
	  name.startsWith("public\\node_modules")
}}

packageBin is the task that creates the project JAR under Compile scope. mappings are the files used during compilation and packaging. We filter out all the files that are under “public\node_modules”.

2. We also want to to remove the share folder. So we added the following lines in build.sbt as well.

doc in Compile <<= target.map(_ / "none")