Jenkins is an open-source and continuous integration tool and easy to automate the installation of Jenkins on Centos 8.
Jenkins is entirely written in Java and install on Centos 8.
Also, automate the installation of Jenkins on CentOS 8 & configure with Nginx using the following method.
Git Hub Repo:
Download the following git hub repo. Easy to install and configure the Jenkins, Nginx using script:https://github.com/smarttechfunda/jenkins-nginx.git
The command to Download git repo:git clone https://github.com/smarttechfunda/jenkins-nginx.git
OR use the following step to install and configure Jenkins, Nginx manually.
Note: Login
Check the following Jenkin installation steps on CentOS 8.
Hardware Requirement:
RAM: 256 MB
Hard disk: 1GB
Prerequisite:
Software: wget, net-tools(netstat command to Check the open ports), Java, Nginx(Optional)
Step 1:
Install EPEL repo:
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y
Step 2:
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 3:
Download & Install:wget -O /etc/yum.repos.d/jenkins.repo
http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
https://pkg.jenkins.io/redhat/jenkins.io.key
rpm --import
yum install jenkins -y
Step 4:
Enable, start & check the Jenkins service: systemctl enable jenkins.service
systemctl start jenkins.service
systemctl status jenkins.service
Step 5:
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 13.
Step 6:
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.
fqdn: Enter the fully qualified domain name of Jenkins instance, if specified.
It opens the first window of Jenkins which is “Unlock Jenkins”
Step 7:
Configure the Jenkins:
Copy the password from the /var/lib/
Step 8:
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 9:
Getting started:
The plugin installation started.
Step 10:
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 11:
Instance configuration:
Click on the “Save and Continue” button.
Step 12:
Jenkins is ready:
Now Jenkins is ready. Click on the “Start using Jenkins” button.
Step 13:
Welcome to Jenkins:
Now, you can create your first job in Jenkins.
Install and configure Nginx:(Optional)
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 and it enable the Http port in the firewall:firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --reload
Step 6:
Configure Nginx with Jenkins:
Create the /etc/
upstream jenkins {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/jenkins.access.log;
error_log /var/log/nginx/jenkins.error.log;
proxy_buffers 16 64k;
proxy_buffer_size 128k;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
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 http;
}
}
Step 7:
Open the file /etc/"listen 80 default_server;"
line and remove the “default_server” from it.
Step 8:
Run the following command and 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 and configure the Jenkins.http://<IP/fqdn>
IP: Enter the IP address of Jenkins instance.
Start configuration from Step 6.
Convert the shell script to binary file automation:
Git hub repo: https://github.com/smarttechfunda/shell-to-binary.git
The command to Download git repo:git clone https://github.com/smarttechfunda/shell-to-binary.git
No comments! Be the first commenter?