Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Systemd service file for Jenkins agent on Ubuntu 20.04 Focal Fossa
# Steps to install Jenkins Agent using JNLP connection on Ubuntu 20.04 Focal Fossa
#
# * create an Agent node on the web GUI: https://wiki.jenkins.io/display/JENKINS/Step+by+step+guide+to+set+up+master+and+agent+machines+on+Windows
# * $ sudo apt-get install -y openjdk-14-jre-headless
# * $ sudo adduser jenkins
# * $ curl http://jenkins-master.internal/jnlpJars/agent.jar -o /home/jenkins/agent.jar
# * create systemd service: place this file in /lib/systemd/system/jenkins-agent.service
# * $ sudo systemctl enable myservice
# * $ sudo systemctl start jenkins-agent
[Unit]
Description=Jenkins Agent
After=network.target
Requires=network.target
[Service]
Type=simple
# optional file to provide environment variables (e.g. http_proxy, https_proxy):
#EnvironmentFile=/etc/sysconfig/jenkins
# TODO: adapt -jnlpUrl und -secret, as found on the web GUI: Jenkins > Nodes > ...
ExecStart=/usr/bin/java -jar /home/jenkins/agent.jar -jnlpUrl http://jenkins-master.internal:8080/computer/Linux/slave-agent.jnlp -secret 6bd5082ce1531212341234123412341234123412341234123412341234764898 -workDir "/home/jenkins"
Restart=always
User=jenkins
RestartSec=20
[Install]
WantedBy=multi-user.target
@HEXtoDEC

This comment has been minimized.

Copy link

@HEXtoDEC HEXtoDEC commented Jul 14, 2021

nice man!

but how to use user jenkins without passwd?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment