GICT knowledge base
How to install Jenkins in CentOS 7 and Ubuntu?
Published
How to install Jenkins in Centos 7 and Ubuntu?
Jenkins is an open source Integration tool which is written in Java. It is used for automating the non-human part of whole software development process. It is a server based system running in apache tomcat. It is free in cost.
1) Before installation you can update the system using the commands below.
In CentOS
# sudo yum install epel-release
# sudo yum update
# sudo reboot
In Ubuntu
# sudo apt-get update
2) Before installing Jenkins you need to setup a JVM on your server.
# sudo yum install java-1.8.0-openjdk.x86_64
3) After installing Java you need to set two environment variables:
sudo cp /etc/profile /etc/profile_backup
# echo ‘export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk’ | sudo tee -a /etc/profile
# echo ‘export JRE_HOME=/usr/lib/jvm/jre’ | sudo tee -a /etc/profile
# source /etc/profile
4) Add Jenkins repositories using the following command.
In CentOS
# wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins.io/redhat-stable/jenkins.repo
# rpm –import http://pkg.jenkins.io/redhat-stable/jenkins.io.key
In Ubuntu
# wget -q -O – https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add –
# echo deb http://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list
5) Install Jenkins on your server.
In CentOS
# yum install jenkins
In Ubuntu
# apt-get install jenkins
6) Start and enable jenkin service
In CentOS
# systemctl start jenkins
# systemctl enable jenkins
In Ubuntu
7) Open ports 80 and 8080 on server firewall using the below command.
In CentOS
# firewall-cmd –zone=public –add-port=8080/tcp –permanent
# firewall-cmd –zone=public –add-service=http –permanent
# firewall-cmd –reload
In Ubuntu
# ufw allow 8080
# ufw status
8) Now Jenkins has been successfully installed and you can access the service from your portal by using the URL http://yourip:8080
9) Run the below command to obtain the admin password.
In CentOS
# grep -A 5 password /var/log/jenkins/jenkins.log
In Ubuntu
cat /var/lib/jenkins/secrets/initialAdminPassword
This will conclude the installation of Jenkins! Feel free to contact our support team at [email protected] if you have any additional questions or concerns.
Related guides
How to Install and Uninstall Imunify360?
In this tutorial, we can check how to install Imunify360. Imunify360 is an automated security solution with multi-layer defense architecture for Linux
CentOSInstall and Configure mod_evasive on CentOS
How to Install and Configure mod_evasive Apache on CentOS? The mod_evasive module for Apache that takes evasive action to protect Apache during the time
CentOSHow to Install Laravel on CentOS 6/7
How to Install Laravel on CentOS 6/7Laravel is a free, open-source MVC PHP web framework intended for the development of full-featured web applications.
CentOSHow to Setup and Install FirewallD on CentOS 7
How to Setup and Install FirewallD on CentOS 7. Many Linux distributions have a firewalld as their firewall management solution, and it acts as a front-end
