Skip to content

Jenkins installation on Centos behind Nginx

Step-1: Setting up Timezone

sudo timedatectl set-timezone Asia/Kolkata

Step-2: Download and install tools

sudo yum install -y policycoreutils-python wget git

Step-3: Download Java

sudo wget --no-cookies --no-check-certificate --header "Cookie:; oraclelicense=accept-securebackup-cookie" ""

Step-4: Install java

sudo rpm -ivh jdk-8u141-linux-x64.rpm

Step-5: Setting Java Environmental Variables

sudo vi /etc/profile.d/

export CLASSPATH=.

Step-6: Executing and sourcing the env file

sudo chmod +x /etc/profile.d/

source /etc/profile.d/

Step-7: Download Jenkins

sudo wget

Step-8: Install Jenkins

sudo rpm -ivh jenkins-2.60.3-1.1.noarch.rpm

Step-9: Create JENKINS_HOME directory

sudo mkdir /opt/mycicd

sudo chown -R jenkins:jenkins /opt/mycicd

Step-10: Edit Jenkins Options file

sudo vi /etc/sysconfig/jenkins

Step-11: Start Jenkins

sudo systemctl start jenkins

sudo systemctl enable jenkins

Step-12: Download Nginx

sudo wget

Step-13: Install nginx

sudo rpm -ivh nginx-1.12.1-1.el7.ngx.x86_64.rpm

Step-14: Starting Nginx

sudo systemctl start nginx

sudo systemctl enable nginx

Step-15: Nginx Jenkins Configuration

sudo vi /etcnginx/conf.d/jenkins.conf

upstream app_server {
server fail_timeout=0;

server {
listen 80;
listen [::]:80 default ipv6only=on;

location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;

if (!-f $request_filename) {
proxy_pass http://app_server;

Step-16: Reload Nginx Configuration

sudo nginx -t

sudo nginx -s reload

Step-17: Nginx SELinux Module for Jenkins reverse proxy

sudo cat /var/log/audit/audit.log | grep -i nginx | grep -i denied | audit2allow -M skynginx

sudo semodule -i skynginx.pp

Shashi View All

-== Superman ==-

One thought on “Jenkins installation on Centos behind Nginx Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: