No comments

How to install jenkins in Red hat Linux machine

Successfully Installing Jenkins on Red Hat EC2: A Concise Guide Jenkins Logo

Successfully Installing Jenkins on Red Hat EC2: A Concise Guide

Just wrapped up setting up Jenkins on a Red Hat EC2 instance and hit a couple of speed bumps. If you're in the same boat, this straightforward guide outlines the exact steps that got everything working. No long-winded explanations, just the commands you need!

The Initial Hurdle:

After installing Jenkins using the official RPM repository, the service refused to start. The error messages hinted at an issue with the Java version being used.

The Solution: Command by Command

Here’s the exact sequence of commands that got Jenkins running:

  1. Check the Jenkins Service Status (to confirm the problem):
    sudo systemctl status jenkins
  2. Identify the Java Version Issue (by examining detailed logs):
    sudo journalctl -xeu jenkins.service

    (This command revealed that Java 17 or a later version was required)

  3. Install a Compatible Java Version (Java 17 in this scenario):
    sudo yum install java-17-openjdk-devel -y
  4. Set Java 17 as the System's Default Java (using the alternatives tool):
    sudo update-alternatives --config java

    (When prompted, select the number corresponding to Java 17)

  5. Start the Jenkins Service:
    sudo systemctl start jenkins
  6. Verify That Jenkins Is Running Correctly:
    sudo systemctl status jenkins

    (Look for the line indicating Active: active (running))

Accessing Your Jenkins Instance:

Once the status confirms that Jenkins is running, you can access its web interface through your web browser. Simply navigate to your EC2 instance's public IP address or its public DNS name, followed by the standard Jenkins port :8080:

http://your_ec2_public_ip:8080

On the initial setup screen, you'll be asked for an administrator password. You can retrieve this password from your EC2 instance using the following command:

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

Key Insight:Java 17 or 21

The core of the problem was the Java environment. Ensuring the correct Java version was installed and actively being used by Jenkins was the key to a successful setup. The system logs provided crucial information for diagnosing this.

Hopefully, this concise guide will help you get your Jenkins instance up and running smoothly on your Red Hat EC2 environment!

ssh -i "jen.pem" ec2-user@ec2-13-217-87-71.compute-1.amazonaws.com

Jenkins url

Comments (0)

Post a Comment

Need Assist?

Cancel