How to install and set up Jenkins in FreeBSD 13

In this Guide we are going to learn how to install and configure Jenkins in a FreeBSD 13 Server.

Jenkins is a popular opensource automation tool to perform continuous integration and build automation. Jenkins allows to execute a predefined list of steps, e.g. to compile golang source code to build build binary file. The trigger for this execution can be time or event based.

Possible steps executed by Jenkins are for example:

  • Cloning the code from source control system.
  • execute a command to install dependencies required for the code to run
  • Run tests for the software
  • build the software to get an executable
  • Publish test results
  • publish the resulting binary code

Jenkins monitors the execution of the steps and allows to stop the process, if one of the steps fails. Jenkins can also send out notifications in case of a build success or failure.

Jenkins can be extended by additional plug-ins. For example, you can install plug-ins to support building and testing Android applications.

# Requirements

  • A Linux system with Rocky Linux/CentOS 8 server (At least 2GB of Ram)
  • A user account with sudo or root privileges
  • Access to a terminal window/command line
  • Recent Java version installed

# Table of content

  1. Ensuring that the system is up to date
  2. Install Java
  3. Install Jenkins
  4. Starting and enabling jenkins
  5. Accessing Jenkins
  6. Optional – Using an Ansible playbook

# 1. Ensuring that the system is up to date

Ensure that the system packages are up to date using this command:

pkg update
pkg upgrade -y

# 2. Install Java

In this section, we will install java on our system. We will be using the openjdk version of Java.

To confirm whether Java is installed locally, check the java -version command.

# java -version
java: Command not found.

From the above output it shows that the Java is not installed. Jenkins runs on Java version 11. To search the package providing openjdk 11 use this command:

# pkg search ^openjdk
openjdk11-11.0.12+7.1          Java Development Kit 11
openjdk11-jre-11.0.12+7.1      Java Runtime Environment 11
openjdk12-12.0.2+10.4_3        Java Development Kit 12
openjdk13-13.0.8+5.1           Java Development Kit 13
openjdk14-14.0.2+12.1_2        Java Development Kit 14
openjdk15-15.0.4+5.1           Java Development Kit 15
openjdk16-16.0.2+7.1           Java Development Kit 16
openjdk17-17+35.1              Java Development Kit 17
openjdk8-8.302.08.1_2          Java Development Kit 8
openjdk8-jre-8.302.08.1_2      Java Runtime Environment 8

From the above output we can see tha the package openjdk11 provides out required version of Java. Install it using this command:

pkg install openjdk11

Now we can finally confirm Java version

# java -version
openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment (build 11.0.12+7-1)
OpenJDK 64-Bit Server VM (build 11.0.12+7-1, mixed mode)

This OpenJDK implementation requires a few file systems to be mounted for full functionality. Run these commands to perform the required mounts immediately:

sudo mount -t fdescfs fdesc /dev/fd
sudo mount -t procfs proc /proc

To make this change permanent, we must add these mount points to the /etc/fstab file. Open the file to edit now:

sudo vim /etc/fstab

Insert the following mount information into the file:

fdesc   /dev/fd     fdescfs     rw  0   0
proc    /proc       procfs      rw  0   0

Save and exit.

Lastly, you will want to rehash to be sure that you can use your new Java binaries immediately:


The OpenJDK package that you selected is now installed and ready to be used!

# 3. Install Jenkins

Search what provides jenkin

 # pkg search ^jenkins
jenkins-2.319                  Open-source continuous integration server
jenkins-lts-2.303.3            Open-source continuous integration server

Use the following command to install the lts version of jenkins

pkg install -y jenkins-lts

# 4. Starting and enabling jenkins

service jenkins onestart

To display the status of the Jenkins service, enter the following:

<meta charset="utf-8"># service jenkins onestatus
jenkins is running as pid 73295.

Run this command to run jenkins on boot

sync jenkins_enable="YES"

# 5. Accessing the jenkins server

Once installed, open browser and navigate to the jenkins on the url If you are running on a remote server, replace the ip with that server’s ip.

You will be asked to provide an initial password found in this location <small><code>/usr/local/jenkins/secrets/initialAdminPassword. Get it by running this command on the server.

sudo cat /usr/local/jenkins/secrets/initialAdminPassword

Citizix - Jenkins install unlock

Citizix – Jenkins install unlock

From here choose whether you want to install the recommended plugins or choose what you want to install.

Citizix - Cuztomize jenkins

Citizix – Cuztomize jenkins

The last page will allow you to set up some initial configuation for the user who will be using the jenkins server.

# Conclusion

We managed to install and access Jenkins in our FreeBSD 13 server.

comments powered by Disqus
Citizix Ltd
Built with Hugo
Theme Stack designed by Jimmy