How to change jenkins port from 8080 to 8081 ?
It depends what you’re running Jenkins on, first of all, and how you installed it.
If you’re using Ubuntu or CentOS, most likely Jenkins is running as a systemd service. To change the port, you’ll need to edit the system file, by doing something like this:
-
Find the system file by reading the output of
sudo systemctl status jenkins
. On my Ubuntu virtual, this is at/usr/lib/systemd/system/jenkins.service
. -
Edit the file, and look in the file for the PORT setting.
# Port to listen on for HTTP requests. Set to -1 to disable. # To be able to listen on privileged ports (port numbers less than 1024), # add the CAP_NET_BIND_SERVICE capability to the AmbientCapabilities # directive below. Environment="JENKINS_PORT=8080"
-
Save the file after you change the setting, and run
systemctl daemon-reload
to tell systemd you make a change. -
Restart jenkins with
systemctl restart jenkins
.