Installing jenkins on fedora

Dear reader,

Today i will show how to install jenkins and put it behind apache

They are a lot of information on the web about jenkins and apache. But he could to be difficult to get all information about the to use jenkins with apache.

Jenkins

Open a terminal

alt+F2 → gnome-terminal

Login as root

×

+

Terminal

$ su –
Password :
#

Create repo file

Create file: /etc/yum.repos.d/jenkins.repo

 
     [jenkins]
     name=Jenkins
     baseurl=http://pkg.jenkins-ci.org/redhat/
     gpgcheck=1

Installing jenkins

×

+

Terminal

# rpm –import http://pkg.jenkins-ci.org/redhat-stable/jenkins-ci.org.key
# yum install jenkins

configure jenkins

Usually you want to customize url to go to jenkins as localhost:8080/jenkins instead of localhost:8080 . This will allow to structure your web site.

For this edit file /etc/sysconfig/jenkins and set line which start by JENKINS_ARGS. Put "--prefix=/jenkins" as value.

JENKINS_ARGS="--prefix=/jenkins"

Start and check jenkins service

×

+

Terminal

# systemctl start jenkins
# systemctl status jenkins

Apache

Install Apache

×

+

Terminal

# yum install httpd

Configure Hosts

ifconfig command will give your ip address to bind to a website name.

You can enhance this command to match exactly ip address as

×

+

Terminal

$ ifconfig | grep -Po ‘(?<=inet )[0-9\.]+

Configure Apache for jenkins

Edit /etc/hosts

Now we will bind localhost to a website. For this we will edit /etc/hosts . Add to this file the line.

XXX.XXX.X.X mywebsite.org

Where the first field is the ip address and second field is the name of your web site.

Configure virtual host

This will finalize our configuration. Create a file /etc/httpd/conf.d/mywebsite.conf to contain:

    ServerName          mywebsite.org
     Redirect            /jenkins http://mywebsite.org/jenkins
     ProxyPass           /jenkins http://mywebsite.org:8080/jenkins
     ProxyPassReverse    /jenkins http://mywebsite.org:8080/jenkins
     ProxyRequests       Off
     SetOutputFilter     INFLATE;proxy-html;DEFLATE
     ErrorLog            "/var/log/www/mywebsite/error.log"
     CustomLog           "/var/log/www/mywebsite/custom.log" common

     Order deny,allow
     Allow from all

Create directory for log file and your website

×

+

Terminal

# mkdir -p /var/log/www/mywebsite/ /var/www/mywebsite/

Start Apache and Jenkins

×

+

Terminal

# systemctl start httpd
# systemctl enable httpd
# systemctl start jenkins

Now you should to be able to access to your jenkins instance via mywebsite.org/jenkins.

Share Button

Leave a Reply