3

I have Ubuntu 20.04 and Jenkins 1.3.3 I need to change the local Jenkins port from 8080 to 8888.

I tried to change the config file sudo gedit /etc/default/jenkins in the string

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

After restart service: sudo service jenkins start it doesn't affect changes. I still visit jenkins with 8080 port.

Also in this config file I add additional string: JENKINS_ARGS="--httpPort=$HTTP_PORT" but unfortunately after restart service the same - 8080.

I tried to change the address via web interface in the Manage Jenkins next Configure System next change string Jenkins URL to http://0.0.0.0:8888/ and apply and restart service. I visited page http://0.0.0.0:8080/cli/command/who-am-i and have got next features:

java -jar jenkins-cli.jar -s http://0.0.0.0:8888/ -webSocket who-am-i
Reports your credential and permissions.

So changes are saved but doesn't affect. I tried to restart my PC to initial all changes. Can You help me? Any suggestions?

2 Answers2

5

Refer to the documentations in: https://www.jenkins.io/doc/book/installing/linux/#debianubuntu

It says that you can modify by:

systemctl edit jenkins

Then add the following lines:

[Service] Environment="JENKINS_PORT=8888"

Port should be your desired port to use. Save it and then restart jenkins:

sudo systemctl restart jenkins
trguapo
  • 66
3

If jenkins installed as linux service, open the file /usr/lib/systemd/system/jenkins.service,search for the content "Environment="JENKINS_PORT=8080". Change the port number to your desired. Execute the commands

systemctl daemon-reload
systemctl restart jenkins.service `

Access the jenkins in browser with the new port number