Jenkins is an open source automation server software that allows continuous integration. Read more about it here.
We are going to install Jenkins on AWS EC2 instance. If you have not already done so, please login into your AWS account and launch an EC2 instance with RHEL OS. For more information on how to launch an instance, please read this post.
1) Install the latest stable packages, then reboot.
sudo yum update -y
2) Before you can install Jenkins, you need to setup a JVM.
sudo yum install java-1.8.0-openjdk.x86_64
3) After the installation, you can confirm it by running the following command:
Jenkins require Java 1.6 or more than. If Java version is less than 1.6 than we have to upgrade the Java. Follow the instruction here on installing Java
4) Install wget
sudo yum install wget -y
5) Install Jenkins
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
sudo rpm --import http://pkg.jenkins-ci.org/redhat-stable/jenkins-ci.org.key
sudo yum install jenkins -y
6) Start the Jenkins service and set it to run at boot time:
sudo systemctl start jenkins.service
sudo systemctl enable jenkins.service
6) Install firewalld (if not already installed)
sudo yum install firewalld -y
8) After install unmask, enable and start the firewall with below commands
sudo systemctl unmask firewalld
sudo systemctl enable firewalld
sudo systemctl start firewalld
9) In order to allow visitors access to Jenkins, you need to allow inbound traffic on port 8080. You can either open port 8080 in AWS Console or run the following command:
sudo firewall-cmd --zone=public --permanent --add-port=8080/tcp
sudo firewall-cmd --reload
sudo firewall-cmd --list-all
10) Finally, visit the following address from your web browser to confirm your installation:
or by running the following command
sudo netstat -ntulp | grep 8080
If the site does not load, please check the Jenkins log file for more information
By default, logs are here /var/log/jenkins/jenkins.log (unless customized in /etc/default/jenkins (for *.deb) or via /etc/sysconfig/jenkins (for */rpm)
By default, logs are here %JENKINS_HOME%/jenkins.out and %JENKINS_HOME%/jenkins.err (unless customized in %JENKINS_HOME%/jenkins.xml)
More information can be found here.
Moving forward, you will need the Jenkins Initial Password to get started:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Oh! And one last thing – If you wish to change Jenkins HTTP port number from the default port 8080, you need to change the file /etc/sysconfig/jenkins
sudo vi /etc/sysconfig/jenkins