Issue
I'm running Jenkins on Ubuntu 20.04 LTS and I want to change the port or the user Jenkins runs as but changes to the /etc/default/jenkins file do not change the port after restarting the service.
The service still starts as:
/usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080
While the /etc/default/jenkins file reads:
[...]
# port for HTTP connector (default 8080; disable with -1)
HTTP_PORT=8081
# servlet context, important if you want to use apache proxying
PREFIX=/$NAME
# arguments to pass to jenkins.
# full list available from java -jar jenkins.war --help
# --javaHome=$JAVA_HOME
# --httpListenAddress=$HTTP_HOST (default 0.0.0.0)
# --httpPort=$HTTP_PORT (default 8080; disable with -1)
# --httpsPort=$HTTP_PORT
# --argumentsRealm.passwd.$ADMIN_USER=[password]
# --argumentsRealm.roles.$ADMIN_USER=admin
# --webroot=~/.jenkins/war
# --prefix=$PREFIX
JENKINS_ARGS="--webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT"
I've checked two different Ubuntu 20.04 LTS machines and both have the same problem. Anyone have an idea what I'm doing wrong?
Solution
after jenkins 2.332.1..
the /etc/default/jenkins is no longer used.
jenkins is configured with systemd.
you can check systemctl cat jenkins
to see the options
and systemctl edit jenkins
to modify it..
you can change the port.
[Service] Environment="JENKINS_PORT=8081"
updated java memory and java args Environment="JENKINS_OPTS="
Environment="JENKINS_OPTS=-Xmx2048m"
Answered By - Jihed Hmida
Answer Checked By - Willingham (JavaFixing Volunteer)