Step-by-Step Guide: Installing Jenkins with Java 11 on AWS EC2 (Kernel 5.10)
Introduction
Jenkins, a widely used open-source automation server, facilitates continuous integration and continuous delivery (CI/CD) workflows. This blog post will guide you through the process of setting up Jenkins on an AWS EC2 instance with a 5.10 kernel while also installing Java 11, a prerequisite for Jenkins. Let's get started!
1. Prerequisites:
Before you begin, ensure you have the following:
- An AWS EC2 instance with the 5.10 kernel.
- SSH access to your EC2 instance.
2. Installing Java 11:
Jenkins requires Java to run. Here's how to install Java 11 on your EC2 instance:
- SSH into your EC2 instance using the following command:
ssh -i path_to_your_key.pem ec2-user@your_instance_ip
- Update the package list:
sudo yum update -y
- Install OpenJDK 11:
sudo yum install java-11-openjdk-devel -y
- Verify Java installation:
java -version
3. Installing Jenkins:
Now that Java is set up, let's install Jenkins:
- Add the Jenkins repository key:
sudo wget -O /etc/yum.repos.d/jenkins.repo
> http://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
- Install Jenkins:
sudo yum install jenkins -y
- Start Jenkins and set it to start on boot:
sudo systemctl start jenkins
sudo systemctl enable jenkins
- Check Jenkins service status:
sudo systemctl status jenkins
- Jenkins runs on port 8080 by default. To access Jenkins, open your web browser and enter: http://your_instance_ip:8080
- Retrieve the initial Jenkins admin password:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Copy the password and paste it on the Jenkins setup page in your browser.
- Follow the prompts to complete the Jenkins setup.
4. Configuring Jenkins:
Once Jenkins is installed, you can configure it for your needs:
- Install necessary plugins: You can choose recommended plugins or select them manually based on your requirements.
- Create your admin user: Set up an admin user with a secure password.
- Customize Jenkins: You can further configure Jenkins settings based on your preferences.
- Start using Jenkins: After configuration, you'll have access to the Jenkins dashboard, where you can create and manage your CI/CD pipelines.