1) Create an EC2 Instance from the aws amazon.com UI with basic free tier configuration and select RedHat AMI



2) Generate KeyPair if its not already generated
3) Store the key-pair in secure location in your system and change its permission to 400 which means only the owner can utilize it
4) I'm using windows wsl , so it did not let me modify the permission in the download directory so I copied the file in linux direcotry ( /home/<username>/) and then changed its permission using chmod
sudo chmod 400 myec2login.pem
5) Then I logged in to my ec2 instance using ec2-user which is default user for ec2 instances providing the path of this file
ssh -i "/path/to/ec2pemFile" ec2-user@ec2IPaddress
6) First installed the java version 8 on the instance as Jenkins needs java 8 run time
sudo yum install java-1.8.0-openjdk-devel.x86_64
In case there was already a different version of java available,
you have to run alternative config command on linux to select this version to reflect in java --version
command is sudo update-alternatives --config java
this will list all java options and will ask you to enter the number for the option for which you want to point
7) Then follow instructions on jenkins guide for redhat
https://www.jenkins.io/doc/book/installing/#red-hat-centos
1) Download the jenkins redhat packagesudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo2) Import the rpm key from jenkins stable release sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key3) Upgrade yum to keep any required latest data sudo yum upgrade4) Install jenkins sudo yum install jenkins
IN case wget is not found you can install using sudo yum install wget
8) Now start the jenkins service
sudo service jenkins start
9) By default Jenkins start on port 8080, you can access it UI by entering the publicIP:8080 . Example
In case you are not able to access the port, make sure the port is accessible for http access.
IN case you are using ec2 instance, you have to add a security group and allow inbound cusotm tcp access either from a public IP of your machine/subnet or give access to all the IP address on port 8080
In case you are facing issues with fetching git urls in jenkins job, make sure git is installed on jenkin server otherwise install with sudo yum install git
Once the security group is created, apply that to the Jenkins instance
After that you should be able to access the jenkins UI
10) Enter the password from the file mentioned in the UI to get the secure one time password ( use it with sudo to cat the file )
Make sure, you dont copy spaces at the end
11) you can install the suggested plugin or you can choose
12) Then add the login details which you would be repeatedly using
13) then the home page will appear where you can start using the Jenkins to create different jobs
Comments
Post a Comment