如何更改macos中安装jenkins的brew的默认端口



在macbook pro jenkins lts 2.492.2中,brew安装了默认端口8080,但端口8080是其他应用程序的默认端口,因此我想更改jenkins默认端口,如7070 0r 8888。请帮助

在这里找到了我的Jenkins plist文件:

/opt/homebrew/Cellar/jenkins-lts/2.289.2/homebrew.mxcl.jenkins-lats.plist

**This solution for macos based jenkins installation with brew**

the Jenkins port on macOS,you must pay attention to the way of installation of Jenkins.

I have installed Jenkins LTS by brew command

brew install jenkins-lts

So my Jenkins plist file is here:

/usr/local/Cellar/jenkins-lts/2.492.2/homebrew.mxcl.jenkins-lts.plist

You can modify the httpPort value from default 8080 to the other value,and then save the file.
as shown below

**vi homebrew.mxcl.jenkins-lts.plist**


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>homebrew.mxcl.jenkins-lts</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/opt/openjdk@11/bin/java</string>
<string>-Dmail.smtp.starttls.enable=true</string>
<string>-jar</string>
<string>/usr/local/opt/jenkins-lts/libexec/jenkins.war</string>
<string>--httpListenAddress=127.0.0.1</string>
<string>--httpPort=7070</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>

You must try these commands(specific to macos) to restart your Jenkins and make the port modification works.


brew services stop jenkins-lts
brew services start jenkins-lts

prkumar@KLL34873 ~ % brew services stop jenkins-lts
Stopping `jenkins-lts`... (might take a while)
==> Successfully stopped `jenkins-lts` (label: homebrew.mxcl.jenkins-lts)
prkumar@KLL34873 ~ % brew services start jenkins-lts
==> Successfully started `jenkins-lts` (label: homebrew.mxcl.jenkins-lts)

Note:If you installed Jenkins LTS,you must pay attention that your command must be jenkins-lts, not jenkins.

最新更新