How To Install Jenkins on Fedora 40
In this tutorial, we will show you how to install Jenkins on Fedora 40. Jenkins is an open-source automation server that facilitates continuous integration and continuous delivery (CI/CD) in software development. It acts as the central hub for automating various stages of the software delivery pipeline, allowing developers to build, test, and deploy their applications with ease.
At its core, Jenkins is designed to manage and control the entire software development lifecycle. It integrates with a wide range of tools and technologies, such as version control systems (e.g., Git, SVN), build tools (e.g., Maven, Gradle), and testing frameworks (e.g., JUnit, Selenium). By leveraging these integrations, Jenkins enables teams to automate repetitive tasks, catch bugs early, and ensure the quality and consistency of their software releases.
One of the key benefits of using Jenkins is its ability to provide immediate feedback on the status of builds and tests. Whenever a developer commits code changes to the version control system, Jenkins automatically triggers a build process, compiles the code, runs tests, and generates reports. This continuous integration approach helps identify issues quickly, reducing the risk of introducing bugs into the main codebase.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of Jenkins on Fedora 40.
Prerequisites
Before we dive into the installation process, ensure that you have the following prerequisites in place:
- A server running one of the following operating systems: Fedora 40.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- You will need access to the terminal to execute commands. Fedora provides the Terminal application for this purpose. It can be found in your Applications menu.
- A stable internet connection to download the necessary packages.
- A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
Install Jenkins on Fedora 40
Step 1. Update the System.
To begin, make sure your Fedora 40 installation is up to date with the latest security patches, bug fixes, and software updates. Open a terminal and run the following command:
sudo dnf clean all sudo dnf update
This command will fetch the latest package information from the Fedora repositories and prompt you to install any available updates. Review the list of updates and confirm the installation by typing “y” when prompted.
Step 2. Installing Necessary Dependencies.
Next, we’ll install some essential dependencies that Jenkins relies on. Run the following command to install these packages:
sudo dnf install java-11-openjdk git curl wget
This command installs the OpenJDK 11 Java Development Kit, which is required to run Jenkins, along with other useful tools like Git, curl, and wget.
To double-check that the Java installation is properly configured, you can run a simple Java command to print the version information:
java -version
Step 3. Installing Jenkins.
To install Jenkins on Fedora 40, we’ll be using the official Jenkins repositories. Adding these repositories to your system ensures that you have access to the latest stable version of Jenkins and simplifies the installation and update process.
Run the following command to import the Jenkins repository GPG key:
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
Next, create a new repository file for Jenkins by running:
sudo dnf config-manager --add-repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
With the Jenkins repository added and the GPG key imported, you’re now ready to install Jenkins on your Fedora 40 system:
sudo dnf install jenkins
Once the installation is complete, you can verify the installed version of Jenkins by running:
rpm -qi jenkins
This command will display information about the installed Jenkins package, including the version number.
Step 4. Starting and Enabling Jenkins Service.
After installing Jenkins on your Fedora 40 system, the next step is to start the Jenkins service and configure it to start automatically on system boot.
To start the Jenkins service, run the following command in your terminal:
sudo systemctl start jenkins
To ensure that the Jenkins service starts automatically whenever your Fedora 40 system boots up, you need to enable the Jenkins service. Run the following command:
sudo systemctl enable jenkins
To verify that the Jenkins service is running correctly, you can check its status by running:
sudo systemctl status jenkins
This command will display the current status of the Jenkins service, including whether it’s active (running) or inactive (stopped). If the service is active, you should see output similar to the following:
● jenkins.service - LSB: Jenkins Automation Server Loaded: loaded (/etc/rc.d/init.d/jenkins; generated) Active: active (running) since Fri 2024-05-05 10:30:00 UTC; 5min ago Docs: man:systemd-sysv-generator(8) Process: 1234 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=0/SUCCESS) Main PID: 5678 (java) Tasks: 50 (limit: 4915) Memory: 500M CGroup: /system.slice/jenkins.service └─5678 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080
Step 5. Configuring Firewall Settings.
If you have a firewall enabled on your Fedora 40 system, you’ll need to allow incoming connections on the default Jenkins port (8080) to access the Jenkins web interface. To do this, run the following commands:
sudo firewall-cmd --permanent --add-port=8080/tcp sudo firewall-cmd --reload
These commands add a permanent firewall rule to allow traffic on port 8080 and reload the firewall configuration to apply the changes.
Step 6. Accessing Jenkins Web Interface.
To access the Jenkins web interface, open a web browser and navigate to http://localhost:8080
. If you’re accessing Jenkins from a remote machine, replace localhost with the IP address
or hostname
of your Fedora 40 server.
On the “Unlock Jenkins” page, you’ll be prompted to enter the initial admin password. This password is generated during the Jenkins installation and stored in a file on your system.
To retrieve the password, open a terminal and run the following command:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Copy the password and paste it into the “Administrator password” field on the Jenkins web interface, then click “Continue”.
Congratulations! You have successfully installed Jenkins. Thanks for using this tutorial for installing Jenkins on Fedora 40. system. For additional help or useful information, we recommend you check the Jenkins website.