To install Jenkins to Ubuntuserver, we recommend that you use the official document description: http://pkg.jenkins-ci.org/debian/very quick to use. In addition, this method can be easily upgraded to the latest version. However, the port number is 8080, and another program of mine uses 8080. How can this problem be modified? Some methods on the Internet are introduced to map port 80 to port 8080 through nginx or apache, and some people say that iptables is used, which is indirect. I just don't want
Install Jenkins to Ubuntu server recommended way to use official documentation Description: http://pkg.jenkins-ci.org/debian/
It will soon be ready for use. In addition, this method can be easily upgraded to the latest version. However, the port number is 8080, and another program of mine uses 8080. How can this problem be modified?
Some methods on the Internet are introduced to map port 80 to port 8080 through nginx or apache, and some people say that iptables is used, which is indirect. I just don't want jenkins to use port 8080.
By checking the/etc/init. d/jenkins script, we can find that two steps are required:
1. Modify the check_tcp_port command of the do_start function, and change the port number from 8080 to 8082.
#
# Function that starts the daemon/service
#
Do_start ()
{
# The default location is/var/run/jenkins. pid but the parent directory needs to be created
Mkdir 'dirname $ pidfile'>/dev/null 2> & 1 | true
Chown $ JENKINS_USER 'dirname $ pidfile'
# Return
#0 if daemon has been started
#1 if daemon was already running
#2 if daemon cocould not be started
$ DAEMON $ DAEMON_ARGS -- running & return 1
# Verify that the jenkins port is not already in use, winstone does not exit
# Even for BindException
Check_tcp_port "http" "$ HTTP_PORT" "8082" | return 1
# If the var MAXOPENFILES is enabled in/etc/default/jenkins then set the max open files to
# Proper value
If [-n "$ MAXOPENFILES"]; then
["$ VERBOSE "! = No] & echo Setting up max open files limit to $ MAXOPENFILES
Ulimit-n $ MAXOPENFILES
Fi
# -- User in daemon doesn't prepare environment variables like HOME, USER, LOGNAME or USERNAME,
# So we let su do so for us now
$ SU-l $ JENKINS_USER -- shell =/bin/bash-c "$ DAEMON $ DAEMON_ARGS -- $ JAVA $ JAVA_ARGS-jar $ JENKINS_WAR $ JENKINS_ARGS" | return 2
}
2. Modify the/etc/default/jenkins file and change port 8080 to 8082.
Then restart jenkins and check:
Ps-def | grep java
Jenkins 7234 7233 99? 00:00:04/usr/bin/java-jar/usr/share/jenkins. war -- webroot =/var/cache/jenkins/war -- httpPort = 8082 -- ajp13Port =-1
Modified successfully.
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2