How to Change Port Number for Jenkins Installation in Ubuntu 12.04

how to change port number for Jenkins installation In Ubuntu 12.04

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

Jenkins on different port rather than 8080 in Ubuntu

Add the following two lines after DAEMON_ARGS in the file

/etc/init.d/jenkins

HTTP_PORT=8010  <br/>
JENKINS_ARGS="--httpPort=$HTTP_PORT"

How to start jenkins on different port rather than 8080 using command prompt in Windows?

Use the following command at command prompt:

java -jar jenkins.war --httpPort=9090

If you want to use https use the following command:

java -jar jenkins.war --httpsPort=9090

Details are here

How to configure Jenkins to run on port 80

Give a try to 'authbind':

sudo apt-get install authbind
sudo touch /etc/authbind/byport/80
sudo chmod 500 /etc/authbind/byport/80
sudo chown jenkins /etc/authbind/byport/80

Then modify the script above to have (add authbind before the $JAVA_HOME/bin/java part):

exec daemon --name=jenkins --inherit --output=$JENKINS_LOG/jenkins.log \
--user=$USER -- authbind $JAVA_HOME/bin/java $JAVA_OPTS \
-jar $JENKINS_ROOT/jenkins.war $JENKINS_ARGS \
--preferredClassLoader=java.net.URLClassLoader

For newer Jenkins installations (1.598) on newer Ubuntu installations (14.04) edit /etc/init.d/jenkins and add authbind before $JAVA

$SU -l $JENKINS_USER --shell=/bin/bash -c "$DAEMON $DAEMON_ARGS -- authbind $JAVA $JAVA_ARGS -jar $JENKINS_WAR $JENKINS_ARGS" || return 2

As mentioned by Alan (see comment below) if you need IPv6 and your system is lower than Quantal you can instead of using apt-get to install authbind download a higher version.
Make sure you have libc6 and libc6-udeb installed. Here is authbind version 2.1.1 from Ubuntu:

  • amd64
  • i386

Then execute:

sudo dpkg -i authbind_2.1.1_amd64.deb
# or sudo dpkg -i authbind_2.1.1_i386.deb

sudo touch /etc/authbind/byport/80
sudo chmod 500 /etc/authbind/byport/80
sudo chown jenkins /etc/authbind/byport/80

centos 7.x jenkins2 on port 80

If you did not any further customization then it's probably Jenkins not starting up, not a firewall issue. That service is configured to start as user jenkins, but binding to ports below 1024 is restricted for root.

I run the same steps as you mentioned and it is clear in the logs:

# cat /var/log/jenkins/jenkins.log
...
2019-12-06 09:39:23.781+0000 [id=1] INFO winstone.Logger#logInternal: Jetty shutdown successfully
java.io.IOException: Failed to start Jetty
...
Caused by: java.net.SocketException: Permission denied
at sun.nio.ch.Net.bind0(Native Method)
...

# service jenkins status
jenkins dead but pid file exists

To make it work on port 80 you could technically change JENKINS_USER to root in /etc/sysconfig/jenkins and reprotect the files, but this is not recommended as it would be a great security hole. Better install nginx and configure it as a reverse proxy listening on port 80 and redirecting traffic to localhost:8080.



Related Topics



Leave a reply



Submit