how to change port number for Jenkins installation In Ubuntu 12.04

For others still looking for answers you can go to /etc/sysconfig/jenkins in CentOS/RHEL or /etc/default/jenkins in Debian based distributions and change the JENKINS_PORT= variable to whatever port you want. Restart jenkins, and it should be running on your desired port.


First open the /etc/default/jenkins file.
Then under JENKINS_ARGS section, you can change the port like this HTTP_PORT=9999.

Then you should restart Jenkins with sudo service jenkins restart.

Then to check the status use this command sudo systemctl status jenkins


The question is about ubuntu 12, but this not used anymore. In modern debian/ubuntu systems take a look into:

/usr/lib/systemd/system/jenkins.service

change the port in the line

Environment="JENKINS_PORT=8080"

The port is still in /etc/default/jenkins but the change there is useless. Tested in debian11.3