Skip to main content

Jenkins-Adding Ubuntu Agent


sudo mkdir -p /usr/local/jenkin-service
sudo chown admin /usr/local/jenkin-service
cd /usr/local/jenkin-service

Execute the curl command from the JenkinsĀ  -- below is the example only

curl -sO https://jenkins.issentialsolutions.com/jnlpJars/agent.jar
nano start-agent.sh
#1/bin/bash
cd /usr/local/jenkin-service
curl -sO https://jenkins.issentialsolutions.com/jnlpJars/agent.jar
java -jar agent.jar -url https://jenkins.issentialsolutions.com/ -secret 23569a2d25d3cf47de3950ea382db7f448d3f15e417cbf10562a1abf91f72453 -name "IS-IVH1-Ubuntu" -webSocket -workDir "/home/jenkins"
exit 0
chmod +x start-agent.sh

Create an another file jenkin-agent.service

nano /etc/systemd/system/jenkin-agent.service
[unit]
Description=Jenkin Agent

[Service]
User=admin
WorkingDirectory=/home/jenkins
ExecStart=/bin/bash /usr/local/jenkin-service/start-agent.sh
Restart=alwalys

[Install]
WantedBy=multi-user.target
sudo systemctl enable jenkin-agent.service

Before Enabling the agent, Install the Java

sudo apt install software-properties-common apt-transport-https -y
sudo add-apt-repository ppa:openjdk-r/ppa -y
sudo apt install openjdk-22-jdk -y