π What is Jenkins?
Jenkins, the superhero of continuous integration-continuous delivery and deployment (CI/CD), is an open-source automation maestro written in Java. π¦ΈββοΈβ¨ It orchestrates CI/CD workflows, known as pipelines.
Jenkins is your go-to tool for automation, an open-source server empowering developers to effortlessly build, test, and deploy software. π οΈπ» It runs on Java, making continuous integration and end-to-end automation a breeze.
Jenkins achieves Continuous Integration with the help of plugins β think of them as magical tools integrating various DevOps stages. Need Git integration? Maven support? Just plug in the right one! π§©π
Why Jenkins?
In a world where digital screens and one-click buttons are abundant, why the need for Jenkins? Because, let's admit it, we're becoming a bit lazy! π΄ But not the lazy where we avoid work β the kind where we'd rather automate repetitive tasks and let Jenkins handle the heavy lifting. π€πΌ
Jenkins steps in precisely where you don't want to babysit a process (here called a job) for completion before moving on to the next. It's our automation ally, ensuring efficiency without the constant watch. π€π§
In a world where simplicity matters, Jenkins automates tasks with plugins, integrating various DevOps stages like Git, Maven, Amazon EC2, and more. βοΈ
π Step-by-Step Guide: Installing Jenkins π
Step 1: Update Package Lists
π Update your package lists to ensure you have the latest information about available packages:
sudo apt update
Step 2: Install Required Dependencies
π οΈ Install the necessary dependencies, including fontconfig and OpenJDK 17:
sudo apt install fontconfig openjdk-17-jre
Step 3: Add Jenkins Repository Key
π Download and add the Jenkins repository key to your system's keyring:
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
Step 4: Add Jenkins Repository to Sources List
β Add the Jenkins repository to the apt 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/null
Step 5: Update Package Lists Again
π Update the package lists with the new Jenkins repository:
sudo apt-get update
Step 6: Install Jenkins
π Install Jenkins from the LTS (Long-Term Support) release:
sudo apt-get install jenkins
This will install Jenkins and its dependencies on your system.
Step 7: Start Jenkins Service
βΆοΈ Start the Jenkins service:
sudo systemctl start jenkins
Step 8: Enable Jenkins to Start on Boot
π Enable Jenkins to start automatically on boot:
sudo systemctl enable jenkins
Step 9: Check Jenkins Status
π Check the status of the Jenkins service to make sure it's running without any issues:
sudo systemctl status jenkins
Step 10: Open Jenkins in your Browser
π Jenkins, by default, runs on port 8080. Open your web browser and navigate to:
http://your_server_ip_or_domain:8080
Follow the on-screen instructions to complete the Jenkins setup.
That's it! You've successfully installed Jenkins on your Ubuntu system using the provided commands.
π Jenkins Freestyle Pipeline: Printing 'Hello World!!' π
1.Create a New Job:
Log in to Jenkins.
Click on "New Item."
Enter a name for the job and select "Freestyle project"
2.Configure the Job:
Under the "Build" section, click on "Add build step" and choose "Execute shell"
In the command box, type: echo "Hello World!!"
3.Save and Run:
Save the job configuration.
Click on "Build Now" to run the job.