Beginner’s Guide: How To Install Jenkins on an EC2 Instance(Linux). Part 2.
Download and install Jenkins
To switch to root user
[ec2-user ~]$ sudo su
To ensure that your software packages are up to date on your instance, use the following command to perform a quick software update:
[ec2-user ~]$ sudo yum update –y
Add the Jenkins repo using the following command:
[ec2-user ~]$ sudo wget -O /etc/yum.repos.d/jenkins.repo \
Import a key file from Jenkins-CI to enable installation from the package:
[ec2-user ~]$ sudo rpm — import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
[ec2-user ~]$ sudo yum upgrade
Install Java:
[ec2-user ~]$ sudo amazon-linux-extras
[ec2-user ~]$ install java-openjdk11 -y
Install Jenkins:
[ec2-user ~]$ sudo yum install jenkins -y
Enable the Jenkins service to start at boot:
[ec2-user ~]$ sudo systemctl enable jenkins
Start Jenkins as a service:
[ec2-user ~]$ sudo systemctl start jenkins
You can check the status of the Jenkins service using the command:
[ec2-user ~]$ sudo systemctl status jenkins
Configure Jenkins
Jenkins is now installed and running on your EC2 instance. To configure Jenkins:
~Connect to http://<your_server_public_DNS>:8080 from your favorite browser. You will be able to access Jenkins through its management interface:
As prompted, enter the password found in /var/lib/jenkins/secrets/initialAdminPassword.
Recommended by LinkedIn
Use the following command to display this password:
[ec2-user ~]$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
The Jenkins installation script directs you to the Customize Jenkins page. Click Install suggested plugins.
Once the installation is complete, Create First Admin User, click Save and Continue.
After you must have created the your account, it will be logged into jenkins dashboard.
Setup Java.
On the left-hand side, click Manage Jenkins, and then click Global Tool Configuration.
Go to the JDK section, Click on Add JDK, uncheck Install automatically, and then add your java path. Click Save.
Create your first Jenkins project
On the left-hand side, Click on New Item.
Name your project, Select freestyle project and click ok.
Click on Build Environment, in the build section click on Add build step select Execute shell. Type this code
echo “Welcome to my DevOps Journey!!!”
Click Save
Click on Build Now. Then click on #1
Hurray!!! We have successfully built our first ever Jenkins Project.
Let me know in the comment section if this article helped you, also let me know if you encounter any difficulties.
Thanks for Reading.
Great post. Jenkins is always a very good option