Jenkins : FreeBSD

Installing Jenkins CI on FreeBSDĀ 

Installing Jenkins on FreeBSD is now as simple as running the following commands as root (or prefix the 'sudo' command):

You can install Jenkins LTS with pkg:

# pkg install jenkins-lts

Or if you want to install the latest version of Jenkins:

# pkg install jenkins

Compiling from ports:

# cd /usr/ports/devel/jenkins
# make install clean

This will automatically install Java (by default, OpenJDK)

Manually starting and stopping the Jenkins CI service

You can start, stop, restart, and get the status of Jenkins with the 'service' command run as root, like this:

# service jenkins start
# service jenkins status
# service jenkins restart
# service jenkins stop

Starting Jenkins CI automatically

To have Jenkins start automatically whenever your FreeBSD system starts, add the following line to /etc/rc.conf:

jenkins_enable="YES"

Accessing Jenkins on FreeBSD

It is the default configuration to listen on every address of the host and port 8180:

/usr/local/etc/rc.d/jenkins
: ${jenkins_args="--webroot=${jenkins_home}/war --httpPort=8180 --prefix=/jenkins"}

Once you've installed and launched Jenkins, it will be available at the following URI. Note: you may find that the trailing slash is mandatory when using curl to test:

http://localhost:8180/jenkins/

Changing the Jenkins CI listen address, port and prefix

This fine if you only want to access Jenkins directly from external. If you want the Jenkins can be accessed only from system on which it is installed, for example, put Jenkins behind of a reverse proxy which can provide https connection (or you want Jenkins can only be accessed through an SSH tunnel with port forwarding), or you just want to drop "/jenkins" prefix. Set the jenkins_args in the configuration file "/etc/rc.conf" or "/etc/rc.conf.d/jenkins", add the httpListenAddress argument and set its value to 127.0.0.1, and remove the prefix argument to the . For example:

/etc/rc.conf
jenkins_args="--webroot=${jenkins_home}/war --httpListenAddress=127.0.0.1 --httpPort=8180"

After making these changes, restart Jenkins to apply the change:

# service jenkins restart