What is Jenkins?

Jenkins is a self-contained, open source automation server that can be used to automate all sorts of tasks related to building, testing, and delivering or deploying software.
Jenkins can be installed through native system packages, Docker, or even run standalone by any machine with a Java Runtime Environment (JRE) installed.

Let’s come to our main question how to change the Jenkins port from 8080 to any other port?

On windows

  1. Go to C: Program Files (x86)\Jenkins
  2. Open Jenkins.xml.
  3. Edit the –httpPort argument (you may need to edit default permissions)
  4. Restart the Jenkins service.
  5. Now Jenkins will permanently use the new port.

On Ubuntu

On Ubuntu, we can find our Jenkins configuration file under folder /etc/default/.

sudo nano /etc/default/jenkins

In the jenkins file change the default HTTP_PORT to the port you want.

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

On Linux

On Linux, we can find our Jenkins configuration file under folder /etc/sysconfig/.

sudo nano /etc/sysconfig/jenkins

In the jenkins file change the default JENKINS_PORT to the port you want.

## Type:        integer(0:65535)
## Default:     8080
## ServiceRestart: jenkins
#
# Port Jenkins is listening on.
# Set to -1 to disable
#
JENKINS_PORT="8080"

## Type:        string
## Default:     ""
## ServiceRestart: jenkins

Thank you for reading this article, I really appreciate it. If you have any questions feel free to leave a comment.