Jenkins is a powerful open-source automation server designed to facilitate continuous integration and deployment for software projects. By automating a multitude of tasks, Jenkins allows developers to focus more on coding and less on repetitive or complex procedures.
In essence, Jenkins acts as an automated project overseer, handling everything from running unit tests to deploying applications. As a continuous integration tool, it automatically tests code every time it’s committed to a version control repository, enhancing software quality and accelerating development cycles.
Why Use Jenkins?
Jenkins is incredibly versatile. Its most common function is checking out source code from version control, building it, and executing automated tests. However, its capabilities extend much further. Jenkins can automate deployments, monitor filesystem changes, and execute any custom scripts you configure it with, all while minimizing human error.
Written primarily in Java, Jenkins is an open-source tool reliably maintaining many facets of software development, ensuring tasks are executed consistently and efficiently.
This guide will show you how to install Jenkins on an AlmaLinux 8 system, and provide you with some foundational configuration tips.
Prerequisites
- AlmaLinux 8 should already be installed on your server, with SSH access configured.
- Root access is required to install Jenkins and execute certain other operations.
- Your server should meet minimum hardware requirements: 1 GB of RAM, 10GB of free disk space, and a capable processor.
Updating the System
Begin by ensuring your system is up-to-date. It’s prudent to start with a fresh, updated environment. Execute the following commands:
sudo dnf update -y
sudo dnf upgrade -y
sudo dnf install epel-release
Installing Java
As Jenkins is built on Java, it’s essential to have Java installed on your server. We’ll use OpenJDK here. Run the following to install OpenJDK:
sudo dnf install java-1.8.0-openjdk -y
Verify the installation of Java to ensure everything is properly set up:
java -version
Adding Jenkins Repository
To install the latest Jenkins build, add its repository. Start with importing the public PGP key:
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
Create a Jenkins repository file in /etc/yum.repos.d/ with this content:
sudo tee /etc/yum.repos.d/jenkins.repo<
Run makecache
to refresh the list of available packages:
sudo dnf makecache
Ensure the repository is correctly added by checking the list:
sudo dnf repolist
Installing Jenkins
With the repository added, use DNF to install Jenkins:
sudo dnf -y install jenkins
Start and enable Jenkins to launch on boot:
sudo systemctl start jenkins
sudo systemctl enable jenkins
Verify Jenkins is running:
sudo systemctl status jenkins
Configuring the Firewall
Jenkins uses port 8080. Open this port on your firewall to allow external access:
sudo firewall-cmd --permanent --zone=public --add-port=8080/tcp
Apply your changes:
sudo firewall-cmd --reload
Confirm the firewall rule is active:
sudo firewall-cmd --list-all
Accessing Jenkins Web UI
To access Jenkins, navigate to your server’s domain or IP followed by port 8080, e.g., http://192.168.0.1:8080
.
You’ll need the initial administrator password, which can be obtained with:
cat /var/lib/jenkins/secrets/initialAdminPassword
Paste this into the Administrator Password field on the Getting Started page and proceed to configure your Jenkins instance by choosing your plugins and setting up your first admin user.
Conclusion
You’ve now installed and configured Jenkins on AlmaLinux 8. From this point, you can set up jobs, install additional plugins, and further tailor Jenkins to your needs using its robust web interface.
FAQs
- What is Jenkins primarily used for?
- Jenkins is primarily used for continuous integration and deployment, automating the building, testing, and deployment of software projects.
- Is Jenkins free to use?
- Yes, Jenkins is open-source and free to use for both commercial and non-commercial purposes.
- Can I use other Java versions besides OpenJDK?
- While OpenJDK is recommended and readily available in AlmaLinux repositories, you can opt to use Oracle JDK or other distributions if compatible.
- How do I add more plugins to Jenkins?
- Plugins can be installed and managed through Jenkins’ web UI under the “Manage Jenkins” > “Manage Plugins” section.
- Is it necessary to configure a firewall for Jenkins?
- Yes, configuring a firewall ensures that only approved traffic can access Jenkins, adding a layer of security to your deployment.