HOWTO Setup Jenkins on a Synology NAS (DS1511+)

DSM version: 3.1
For installing Jenkins you have to have java SDK installed on your Synology. A previous post was a HowTo install Java & Maven on a DS1511+  

The good thing about Jenkins is it does not need a container like Tomcat to run as it comes bundeld with winstone

Step 1, Create the user jenkins
Add the system users Jenkins as user number 145. Please make sure this user id is not used on your Synology!

Edit the /etc/password file
vi /etc/passwd

add the following line 
jenkins:x:145:145:Jenkins:/var/lib/jenkins:/bin/sh

Edit the /etc/shadow file
vi /etc/shaddow

add the following line
jenkins:*:10933:0:99999:7:::

Edit the /etc/group file
vi /etc/group

add the following line
jenkins:x:145:jenkins


Step 2, Create directory structure
Create the Jenkins home directory
cd /opt
mkdir jenkins
ln -s /opt/jenkins /var/lib/jenkins/

Create the Jenkins data directory
cd /opt/jenkins
mkdir data
chown jenkins:jenkins data

Step 3, Install the war file 
Download the latest Jenkins war file
cd /var/lib/jenkins/
wget http://mirrors.jenkins-ci.org/war/latest/jenkins.war

Create a very simple startup script
vi jenkins_start.sh

 

#!/bin/sh

su -s /bin/sh jenkins -c “
 cd /var/lib/jenkins
JENKINS_HOME=/var/lib/jenkins/data exec nohup /usr/java/bin/java  
-jar /var/lib/jenkins/jenkins.war          
$JENKINS_OPTS                                    
</dev/null >>/var/lib/jenkins/data/console_log 2>&1 &
echo $! >/var/lib/jenkins/data/jenkins.pid”

 

Make it executable
chmod 755 jenkins_start.sh

And run it for the first test run
./jenkins_start.sh 

Check for any errors in the log file
cat /var/lib/jenkins/data/console_log 

 

Open firefox and point it to http://<your DS1511+ ip>:8080/
and it should show the main page of jenkins 

 

TODO
Create a proper init.d start/stop script 
Anynone likes to contribute this? Please thanks in advance. 

Note it is possible you find the following error in your log:
java.lang.Error: Failed to create temporary file for jnidispatch library: java.io.IOException: Permission denied
It does not prevent jenkins form running, however if you dont like this, just make the war file writable for the jenkins user with: 
cd /var/lib/jenkins/
chown jenkins:jenkins jenkins.war

 

 

Advertisements

5 thoughts on “HOWTO Setup Jenkins on a Synology NAS (DS1511+)

  1. Sébastien

    Thanks ! It helps me :-)Could you comment this line ?jenkins:*:10933:0:99999:7:::I do not understand "</dev/null" in the scriptWhere can I found Jenkins options (ie: $JENKINS_OPTS) ?

    Reply
  2. Sébastien

    You could find start/stop script here ;-)https://wiki.jenkins-ci.org/display/JENKINS/Starting+and+Accessing+Jenkins

    Reply
  3. Pingback: Jenkins on Synology xx09 -Series

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s