How To Configure Jenkins Linux slave nodes by Launching Agents via SSH
Muhammad Raheel
Jenkins | Docker | Kubernetes | Ansible | Git | Nexus | SonarQube | XL Release | Maven | QMetry | Jira | Burp | LeanFT | Cypress
This is about configuring Linux slaves to Jenkins.
Configure a Jenkins linux slave node and connect it to the master machine, you can follow the steps below
Steps Details
Step#1 Ensure that both the master and slave machines have the same version of Java installed. check with below command
java --version
Step#2 Assuming ssh is installed on slave agent or install it if not already installed
Installing SSH on Linux involves setting up the OpenSSH server package, which allows remote connections to your system. The specific commands will differ slightly depending on your Linux distribution's package manager
Debian-based systems (Ubuntu, Mint, etc.)
sudo apt update
sudo apt install openssh-server
RedHat-based systems (CentOS, Fedora, RHEL, etc.)
sudo yum install openssh-server
Verifying Installation
ssh
These commands install the server package (openssh-server) to enable remote logins. You might also consider installing the openssh-client package for initiating SSH connections from your system to other servers.
Step#3 Generate SSH Keys and configure with Jenkins slave and master
These all steps are executed on the agent machine
领英推荐
.ssh will be there but you may create it under your user profile if it doesn't exist: i.e. /root/.ssh
mkdir /root/.ssh
If you don't have an SSH key pair, you can generate one using the following command:
ssh-keygen -t ecdsa-sha2-nistp256
I used ecdsa algorithm, you may use any other as well like rsa
cat id_ecdsa.pub >> ~/.ssh/authorized_keys
Agent_IP Public_Key
Step#4 Configure Jenkins Agent with SSH Credentials
These all steps are executed on the master machine
Configure Jenkins Agent in Jenkins master:
Now just open the jenkins agent and click on Launch agent button and this should spin up your agent.