Full Stack LAMP - MEAN Developer, Python developer. Certified Azure Developer. Freelance programmer/consultant/trainer.

How to Install Jenkins agent as Linux Service

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 slaveStart.sh file with your Jenkins start script which you can grab from your Jenkins master.

java -jar agent.jar -jnlpUrl https://arjunphp.com:8443/computer/Ubuntu- -secret 44787c299136da39b30af3449a833500c994d946222d281a194d551c24080f88 -workDir "/home/ubuntu/jenkins"
exit 0

Make the script executable by executing chmod +x slaveStart.sh

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/slaveStart.sh


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

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

0 0 votes
Article Rating
Notify of

1 Comment
Most Voted
Newest Oldest
Inline Feedbacks
View all comments