Fedora 24: Install Jenkins

This article will describe installing Jenkins.

1 Install Jenkins

Install Jenkins with dnf and enable with systemd.

$ sudo dnf install jenkins
$ sudo systemctl enable jenkins
$ sudo systemctl start jenkins

1.1 Change port

You can change port of Jenkins with JENKINS_PORT. Default port is 8080.

$ diff -uprN /etc/sysconfig/jenkins{.org,}
--- /etc/sysconfig/jenkins.org  2016-07-20 17:26:54.161227336 +0900
+++ /etc/sysconfig/jenkins      2016-07-20 17:27:11.347085974 +0900
@@ -65,7 +65,7 @@ JENKINS_JAVA_OPTIONS="-Djava.awt.headles
 # Port Jenkins is listening on.
 # Set to -1 to disable
 #
-JENKINS_PORT="8080"
+JENKINS_PORT="10000"

 ## Type:        integer(0:65535)
 ## Default:     8009

Restart jenkins after chagning.

$ sudo systemctl start jenkins

1.2 Use mod_proxy

Change URL path with Jenkins –prefix option.

$ diff -uprN /etc/sysconfig/jenkins{.org,}
--- /etc/sysconfig/jenkins.org  2016-07-20 17:26:54.161227336 +0900
+++ /etc/sysconfig/jenkins      2016-07-20 19:18:07.241884495 +0900
@@ -116,4 +116,4 @@ JENKINS_HANDLER_IDLE="20"
 # Pass arbitrary arguments to Jenkins.
 # Full option list: java -jar jenkins.war --help
 #
-JENKINS_ARGS=""
+JENKINS_ARGS="--prefix=/jenkins"

Create httpd configuration file for Jenkins.

$ cat /etc/httpd/conf.d/jenkins.conf
<IfModule mod_proxy.c>
  ProxyPass           /jenkins  http://localhost:8080/jenkins
  ProxyPassReverse    /jenkins  http://localhost:8080/jenkins
  ProxyRequests       Off
  AllowEncodedSlashes NoDecode

  <Proxy http://localhost:8080/jenkins>
    Order deny,allow
    Allow from all
  </Proxy>
</IfModule>

Allow HTTP port.

$ sudo firewall-cmd --add-service=http --permanent
$ sudo firewall-cmd --reload

Allow httpd to access TCP port.

$ sudo setsebool -P httpd_can_network_connect on

Restart Jenkins and httpd.

$ sudo systemctl restart jenkins httpd

2 Access to Jenkins

Access to Jenkins with URL as below.

http://<server>:<port>

In case of using mod_proxy is as below.

http://<server>/jenkins

0001_jenkins.png