Skip to content

How to Install Jenkins agent as Linux Service

Last updated on November 17, 2022

In this tutorial, you will learn how to start a Jenkins agent as a Linux service. This tutorial is going to be a simple step-by-step guide.

Create a directory called Jenkins in your home directory or anywhere with any name.

$mkdir Jenkins

Download your agent.jar file into this directory.

Now create a file with your Jenkins start script which you can grab from your Jenkins master.

java -jar agent.jar -jnlpUrl -secret 44787c299136da39b30af3449a833500c994d946222d281a194d551c24080f88 -workDir "/home/ubuntu/jenkins"
exit 0

Make the script executable by executing chmod +x

Now create /etc/systemd/system/jenkins-slave.service a file with the following content. sudo vim /etc/systemd/system/jenkins-slave.service


ExecStart=/bin/bash /home/ubuntu/jenkins/


Enable the daemon with the following command.

sudo systemctl enable jenkins-slave.service

Now start the daemon with the following command.

sudo systemctl start jenkins-slave.service

Check the status with the below command and about should be similar to the below image.

sudo systemctl status jenkins-slave.service
0 0 votes
Article Rating
Notify of

1 Comment
Most Voted
Newest Oldest
Inline Feedbacks
View all comments