Jenkins is an open-source and continuous integration tool and easy to install on Centos 7.
Jenkins is entirely written in Java and install on Centos 7.
Hardware Requirement:
RAM: 256 MB
Hard disk: 1GB
Prerequisite:
Software:
Note: Log in as the root user or If you are login as a non-root user then make sure that the user has
Check the following Jenkin installation steps on CentOS 7.
Step 1:
Install java:yum install java-11-openjdk -y
java -version
Output:openjdk version "11.0.4" 2019-07-16 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.4+11-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.4+11-LTS, mixed mode, sharing)
Note: Check & Install the available java version
Step 2:
Download & install:wget -O /etc/yum.repos.d/jenkins.repo
http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
yum install jenkins -y
Step 3:
Enable, start & check the Jenkins service: systemctl enable jenkins.service
systemctl start jenkins.service
systemctl status jenkins.service

Step 4:
Enable the 8080/tcp port in the firewall:firewall-cmd --add-port=8080/tcp --permanent
Note: If you are using Nginx configuration, then do not use the above commands.
firewall-cmd --reload
firewall-cmd --list-all
Follow the “Install and configure the Nginx with Jenkins(Optional)” instruction for Nginx configuration in this article after Step 12.
Step 5:
Check Jenkins port:netstat -ntpl | grep 8080

Enter the following URL in the browser.http://<IP/fqdn>:8080
IP: Enter the IP address of Jenkins instance.
It opens the first window of Jenkins which is “Unlock Jenkins”
Step 6:
Configure the Jenkins:
Copy the password from the /var/lib/

Step 7:
Install plugins:
There are two options for plugin installation.
1. Install suggested plugins.
2. Select plugins to install.
In this process, we select the first option, which is “Install suggested plugins.” If you want to install more plugins, then select the second option, which is “Select plugins to install.”

Step 8:
Gettting started:
The plugin installation started.

Step 9:
Create the first admin user:
Enter the Username, Password, Confirm password, Full name, E-mail address in the following window. Click on the “Save and Continue” button. OR you can select an option the “Continue as admin.”

Step 10:
Instance configuration:
Click on the “Save and Continue” button.

Step 11:
Jenkins is ready:
Now jenkins is ready. Click on the “Start using Jenkins” button.

Step 12:
Welcome to Jenkins:
Now, you can create your first job in the Jenkins.

Install and configure Nginx:(Optional)
How to install and configure the Nginx on CentOS 7:
Step 1:
Run the following command:vi /etc/yum.repos.d/nginx.repo
Added the following code to the file.[nginx]
name=
nginx repo
baseurl=
http://nginx.org/packages/mainline/centos/7/$basearch/
gpgcheck=
0
enabled=
1
Step 2:
Run the following command to install the Nginx:yum install nginx -y
Step 3:
Enable, start and check the Nginx service:systemctl enable nginx
systemctl start nginx
systemctl status nginx

Step 4:
Run the following command to check the Nginx port:netstat -ntpl | grep nginx

Step 5:
Run the following command to enable the Http port in the firewall:firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --reload
Step 6:
Configure Nginx with Jenkins:
Check the following files./etc/nginx/conf.d/default.conf
/etc/nginx/nginx.conf
If you find the following entry in the file /etc/nginx/nginx.conf
include /etc/
then use this file for/etc/nginx/conf.d/default.conf
configuration.
Step 7:
Search the following line in the /etc/nginx/conf.d/default.conf
file.
location / {
}
Make comment the lines in the above block and make entry of the following code and code should look like:
location / {
proxy_pass http://127.0.0.1:8080;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
Save and quite file using following option.
:wq
Step 8:
Run the following command to enable the SELinux permission for Nginx.setsebool -P httpd_can_network_connect 1
Step 9:
Restart the Nginx service.systemctl restart Nginx
Enter the following URL in the browser.http://<IP/fqdn>
IP: Enter the IP address of Jenkins instance.
fqdn: Enter the fully qualified domain name of Jenkins instance, if specified.
Start configuration from Step 6.
No comments! Be the first commenter?