How to Change Jenkins Default Port

Posted on

Introduction about Jenkins

This is an article for describing on how to change the Jenkins default port. Before going on to the detail on changing the Jenkins default port, there is a general explanation on Jenkins. For a reference and an additional information, there are lots of source of information about Jenkins.  One of the source of information explaining about Jenkins is available in Wikipedia. According to the Wikipedia : “Jenkins is an open source automation server written in Java programming language. Jenkins helps to automate the non-human part of the software development process, with continuous integration and facilitating technical aspects of continuous delivery”.

Furthermore, according to Wikipedia : “Jenkins is a server-based system that runs in servlet containers such as Apache Tomcat. It supports version control tools, including AccuRev, CVS, Subversion, Git, Mercurial, Perforce, TD/OMS, ClearCase and RTC, and it can execute Apache Ant, Apache Maven and sbt based projects as well as arbitrary shell scripts and Windows batch commands.

How to change Jenkins default port

Basically, Jenkins is running as an actual service. Generally, every service running in a certain port. Furthermore, by default Jenkins is running in port 8080. The definition of the running port for Jenkins to run is available in the Jenkins configuration file. The configuration file for Jenkins exists in ‘/etc/default/jenkins’. The following is the content of the Jenkins configuration for the port specification :

# port for HTTP connector (default 8080; disable with -1)
# HTTP_PORT=8080

So, in order to change the port from the default port below are the following steps :

1. Add an additional line to specify the different port. For an example, change the default port into 8090. So, the additional line will be in the following :

# port for HTTP connector (default 8080; disable with -1)
# HTTP_PORT=8080
HTTP_PORT=8090

2. After editing the Jenkins configuration file by adding the above line, don’t forget to restart the Jenkins service. The following is the command for restarting the Jenkins service :

root@hostname:~# systemctl restart jenkins
root@hostname:~# 

Leave a Reply