Jenkins is an open-source automation tool that helps with continuous integration and continuous delivery (CI/CD) of software. It can be used in a master-slave configuration to distribute workloads across multiple machines. In this article, we'll walk through the steps to set up a Jenkins master and slave on Ubuntu. Additionally, we'll show you how to mirror your setup using rsync to ensure consistency across servers. If you're looking for hosting solutions, consider using Windows VPS UK for your Jenkins setup.

Step 1: Install Jenkins on the Master Server

Start by updating your Ubuntu system and installing Jenkins on the master server. Run the following commands to do so:

sudo apt update && sudo apt upgrade

Next, install Jenkins using the official repository:


sudo apt install openjdk-11-jdk
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt update
sudo apt install jenkins
            

Once Jenkins is installed, start the Jenkins service:

sudo systemctl start jenkins

This process is applicable whether you're running Jenkins on a local server or a Windows Virtual Private Server hosting platform.

Step 2: Configure Jenkins Master

After installation, access Jenkins through your browser at http://your-server-ip:8080. Unlock Jenkins using the password found in the following file:

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Complete the setup by installing the recommended plugins and creating an admin user. Once done, your Jenkins master will be ready. Setting up Jenkins on a virtual private server, such as a UK VPS Windows, can offer additional flexibility and performance.

Step 3: Install Jenkins Slave

To set up the Jenkins slave, you need to install Java on the slave machine, which could be another Ubuntu server or a VPS Windows Servers. Run the following command to install Java:

sudo apt install openjdk-11-jdk

After installing Java, navigate to the Jenkins master dashboard, go to Manage Jenkins > Manage Nodes and Clouds > New Node, and add the slave machine details. Make sure to configure the slave with the appropriate labels and settings based on your use case.

Step 4: Connect Jenkins Slave to Master

Once the slave is configured, connect it to the master server. On the slave machine, you can use the Launch agent via SSH option from the Jenkins dashboard. This requires the slave to be accessible via SSH

Cette réponse était-elle pertinente? 0 Utilisateurs l'ont trouvée utile (0 Votes)