I installed Jenkins on a windows virtual server and want to run it as window service.
Since the port 8080 is being used by other service, I changed the http port to 8081 in jenkins.xml file. However, I am not able to launch localhost:8081/jenkins at all. I need detail instruction/steps to configure port 8081 or something to run Jenkins.
This question is related to
jenkins
In linux,
sudo vi /etc/sysconfig/jenkins
set following configuration with any available port
JENKINS_PORT="8082"
If you are running on Redhat, do following
Stop Jenkins
$sudo service jenkins stop
change port number in /etc/sysconfig/jenkins
like i did for port 8081
JENKINS_PORT="8081"
start Jenkins again
$sudo service jenkins start
On Windows (with Windows Service).
Edit the file C:\Program Files (x86)\Jenkins\jenkins.xml with 8083 if you want 8083 port.
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8083</arguments>
Jenkins.xml
configuration file--httpPort=8080
and replace the 8080
with the new port number that you wishOn Ubuntu 16.04 LTS you can change the Port like that:
/etc/default/jenkins
to 8081 (or the port you like) HTTP_PORT=8081
service jenkins restart
You should follow 2 steps:
This step can be followed by running the cmd in the specific folder location where there will be .war
file. This step helpful as Jenkins needs some disk space to perform builds and keep archives.
set JENKINS_HOME=c:\folder\Jenkins
This step will be helpful to change the port number, and works can be performed accordingly.
java -jar jenkins.war --httpPort=8585
Check in Jenkins.xml and update like below
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8090</arguments>
If the default port 8080 has been bind with other process, Then kill that process.
DOS> netstat -a -o -n
Find the process id (PID) XXXX of the process which occupied 8080.
DOS> taskkill /F /PID XXXX
Now, start Jenkins (on default port)
DOS> Java -jar jenkins.war
DOS> Java -jar jenkins.war --httpPort=8008
Start Jenkins from cmd line with this command :
java -jar jenkins.war --httpPort=8081
For jenkins in a docker container you can use port publish option in docker run command to map jenkins port in container to different outside port.
e.g. map docker container internal jenkins GUI port 8080 to port 9090 external
docker run -it -d --name jenkins42 --restart always \
-p <ip>:9090:8080 <image>
Source: Stackoverflow.com