Jenkins is an open-source automation server widely used for continuous integration (CI) and continuous delivery (CD) processes in software development. It helps developers automate the building, testing, and deployment of applications, making it easier to deliver high-quality software quickly and efficiently.
Prerequisites for installing jenkins on Linux :
Linux Machine: You'll need a Linux-based operating system installed, such as Ubuntu, CentOS, or Debian.
Java: Jenkins requires Java to run. Ensure that you have Java Development Kit (JDK) or OpenJDK installed on your Linux machine.
Internet Access: Ensure that your Linux machine has internet connectivity to download packages and dependencies during the installation process.
System Requirements: Check the system requirements for the Linux distribution you are using to ensure it meets the minimum specifications for Jenkins.
Firewall Configuration: If you have a firewall enabled on your Linux machine, make sure to configure it to allow incoming connections to the Jenkins port (default is 8080) or disable the firewall temporarily during the installation process.
User Access: Ensure that you have administrative or root access to the Linux machine to install software packages and make necessary configurations.
Choose the Linux Distribution
- Provide an overview of different Linux distributions and guide readers on selecting the one that suits their needs. Mention popular distributions like Ubuntu, CentOS, and Debian.
- Update System Packages: Open a terminal and run the following commands to update your system's package lists:
sudo apt update
- Install Java: Jenkins requires Java to run. Install OpenJDK, which is a free and open-source implementation of Java:
sudo apt install openjdk-11-jre
- Add Jenkins Repository Key: Add the Jenkins repository key to ensure package authenticity:
curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee \
/usr/share/keyrings/jenkins-keyring.asc > /dev/null
- Add Jenkins Repository: Add the Jenkins repository to the package sources list:
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/nul
- Update System Packages Again: Run the following command to update your system's package lists with the new Jenkins repository:
sudo apt-get update
- Install Jenkins: Install Jenkins with the following command:
sudo apt-get install jenkins
- Start Jenkins: Start the Jenkins service:
sudo systemctl start jenkins
- Enable Jenkins on System Startup: To ensure Jenkins starts automatically on system startup, run the following command:
sudo systemctl enable jenkins
- Check Jenkins Status: Verify the status of the Jenkins service to ensure it is running:
sudo systemctl status jenkins
Access Jenkins Web Interface: Open a web browser and enter
http://localhost:8080
orhttp://<your-server-IP>:8080
to access the Jenkins web interface.Unlock Jenkins: During the first access, Jenkins will ask you to unlock it by retrieving the initial administrator password. Run the following command to get the password:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Copy the password and paste it into the Jenkins web interface.
- Customize Jenkins: Follow the on-screen instructions to customize Jenkins according to your preferences.
That's it! You have successfully installed Jenkins on Linux. You can now create your Jenkins jobs and configure your CI/CD pipelines. Enjoy exploring the power of Jenkins for automation and continuous integration!
Thank you