How to install Jenkins on Amazon Linux EC2 Machine

Step 1 : Update your EC2 instance machine

				
					sudo yum update

				
			

Step 2 : Add the Jenkins repo using the following command

				
					sudo wget -O /etc/yum.repos.d/jenkins.repo \
    https://pkg.jenkins.io/redhat-stable/jenkins.repo
				
			
    • Import a key file from Jenkins-CI to enable installation from the package:

				
					sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key

				
			

Step 3 : Now install java on your ec2 instance/machine

				
					sudo amazon-linux-extras install java-openjdk11
				
			

Step 4 : Now install epel library

				
					sudo amazon-linux-extras install epel

				
			

Step 5 : Now install daemonize library

				
					sudo yum install daemonize -y  

				
			

Step 6 : Now install jenkins application

				
					sudo yum install jenkins -y  

				
			

Step 7 : Now reload the service

				
					sudo systemctl daemon-reload

				
			

Step 8 : Now start the jenkins server

				
					sudo systemctl start jenkins

				
			

Step 9 : Make sure to open 8080 port in jenkins security group.

 

Step 10 : Now go to your browser and enter <your instance public ip address>:8080 (eg. 156.10.152.10:8080 ) in the new tab.

Step 11 : Now you have to hit below command to get the admin password password

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

				
			

Leave a Comment