Issue
Using:
- Ubuntu 20.04.2 LTS
- Java 1.8.0_322
- Jenkins 2.332.1
I've been attempting to change the HTTP port or the User in /etc/default/jenkins file. However the changes are not picked up once I do:
sudo service jenkins restart
The answer here also doesn't seem to work: Jenkins changes in /etc/default/jenkins not working
sudo systemctl edit jenkins
just opens a new file for editing
Solution
Editing
/etc/default/jenkins
does not work anymore since version 2.332.1, which relies on systemd rather than the init system (documentation). Instead, run
systemctl edit jenkins
which will bring up an editor with an empty file. Paste the following contents: [Service]
Environment="JENKINS_PORT=8888"
Change the port as desired and save the file (in case of nano as editor with Ctrl + X, Y). Finally, restart Jenkins and it should pick up the new port:
sudo systemctl restart jenkins
Answered By - Barath Kumar
Answer Checked By - Pedro (JavaFixing Volunteer)