在 macOS 上更改 Jenkins 端口

发布于 2024-12-01 04:40:31 字数 239 浏览 2 评论 0 原文

我想知道如何更改 Jenkins 的默认端口 8080。使用 Linux 或 Windows,只需使用配置文件即可完成此操作。但是 Jenkins 的 Mac 配置文件看起来与其他的完全不同。

当然,可以在启动服务器时传递 --httpPort 参数,但我想在配置文件中执行此操作。

有这样的选择吗?

PS:通过apache传递Jenkins实例可以解决问题,但我想更改Jenkins端口。

谢谢!

I was wondering how one could change Jenkins' default port 8080. Using linux or windows, this is simply done with the configuration file. But the Mac config file of Jenkins looks completely different from the other ones.

Of course one could pass the --httpPort parameter when starting the server, but I want to do this within a config file.

Is there an option for that?

PS: Passing the Jenkins instance through apache would kinda solve the problem, but I want to change the Jenkins port.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

坠似风落 2024-12-08 04:40:32

这对我将端口更改为 7070 或其他端口很有用。

sudo defaults write /Library/Preferences/org.jenkins-ci httpPort 7070

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist

sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist

有关此内容的更多信息

This worked for me for changing port to 7070 or other.

sudo defaults write /Library/Preferences/org.jenkins-ci httpPort 7070

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist

sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist

More info about this

醉南桥 2024-12-08 04:40:32

我已使用 Brew 在我的 Mac OS High Sierra 上安装了 Jenkins。

请按照以下步骤操作:

  1. 您必须将端口更改为以下文件:

    <块引用>

    /usr/local/Cellar/jenkins/2.xx/homebrew.mxcl.jenkins.plist

  2. 分配任何可用端口,例如 7070 或任何您想要的数字。[如果您有静态 IP,则可以指定端口 80(HTTP) ]

    --httpPort=7070

  3. 您还需要重新启动 Jenkins 服务器。使用以下brew service命令:

    $brew 服务停止詹金斯

    $brew services start jenkins

就这样。!

I have installed Jenkins on my Mac OS High Sierra using Brew.

Please follow below steps:

  1. You have to change the port to below file:

    /usr/local/Cellar/jenkins/2.x.x/homebrew.mxcl.jenkins.plist

  2. Assign any free port like 7070 or any number you want.[If you have static IP then you can give port 80(HTTP)]

    --httpPort=7070

  3. You also need to restart the Jenkins Server. using below brew service commands:

    $ brew services stop jenkins

    $ brew services start jenkins

That's all.!

梦幻的心爱 2024-12-08 04:40:32

只需在终端中写入以下命令

sudo defaults write /Library/Preferences/org.jenkins-ci.plist httpPort 9999

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist

sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist

即可解决该问题。

Just write the following command in the terminal:

sudo defaults write /Library/Preferences/org.jenkins-ci.plist httpPort 9999

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist

sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist

That should resolve it.

離人涙 2024-12-08 04:40:32

在不同的 HTTP 端口(即 7070 和 7071)上运行两个 Jenkins 守护进程的另一种解决方案: 不同 HTTP 端口上的多个 Jenkins 守护进程 (Mac OS X)

An other solution in case of running two daemons of Jenkins, on different HTTP ports (i.e. 7070 and 7071) : Multiple Jenkins daemons on different HTTP ports (Mac OS X)

无声无音无过去 2024-12-08 04:40:31

看起来默认方式是:

#add the defaultparameters - 这将编辑/Library/Preferences/org.jenkins-ci.plist

sudo 默认写入 /Library/Preferences/org.jenkins-ci httpPort 7070

#stop

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist

#start

sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist

it looks like the default way is:

#add the default parameters - this will edit /Library/Preferences/org.jenkins-ci.plist

sudo defaults write /Library/Preferences/org.jenkins-ci httpPort 7070

#stop

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist

#start

sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist

川水往事 2024-12-08 04:40:31

在macOS上修改Jenkins端口之前,必须注意Jenkins的安装方式

如果你想处理iOS项目构建,这里我建议你通过“Homebrew”安装Jenkins,因为使用.pkg的方式安装可能会遇到一些错误,而且很难解决问题。

我已经通过brew命令安装了Jenkins LTS:

brew install jenkins-lts

所以我的Jenkins plist文件在这里:

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

您可以将httpPort值从默认的8080修改为其他值,然后保存文件。

<代码>

<字典>
<键>标签
<字符串>homebrew.mxcl.jenkins-lts
ProgramArguments
<数组>
<字符串>/usr/libexec/java_home
<字符串>-v
<字符串>1.8
<字符串>--exec
<字符串>java
<字符串>-Dmail.smtp.starttls.enable=true
<字符串>-jar
<字符串>/usr/local/opt/jenkins-lts/libexec/jenkins.war
<字符串>--httpListenAddress=127.0.0.1
<字符串>--httpPort=8383

<键>RunAtLoad
<真/>

sudo launchctl unload 命令对您不起作用。您必须尝试这些命令来重新启动 Jenkins 并使端口修改生效。

<代码>
Brew 服务停止 jenkins-lts
酿造服务启动詹金斯-LTS

<代码>
ifeegoo:~ ifeegoo$ 酿造服务停止 jenkins-lts
停止`jenkins-lts`...(可能需要一段时间)
==>成功停止`jenkins-lts`(标签:homebrew.mxcl.jenkins-lts)
ifeegoo:~ ifeegoo$ 酿造服务启动 jenkins-lts
==>成功启动`jenkins-lts`(标签:homebrew.mxcl.jenkins-lts)

注意:如果你安装了Jenkins LTS,必须注意你的命令必须是jenkins-lts,而不是jenkins

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

Here I recommend you install Jenkins by 'Homebrew' if you want to deal with iOS project building,because you may meet some errors that the way of using .pkg to install,it's really hard to solve the problems.

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.121.2/homebrew.mxcl.jenkins-lts.plist

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


<?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/libexec/java_home</string>
<string>-v</string>
<string>1.8</string>
<string>--exec</string>
<string>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=8383</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>

sudo launchctl unload command will not work for you.You must try these commands to restart your Jenkins and make the port modification works.


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


ifeegoo:~ ifeegoo$ brew services stop jenkins-lts
Stopping `jenkins-lts`... (might take a while)
==> Successfully stopped `jenkins-lts` (label: homebrew.mxcl.jenkins-lts)
ifeegoo:~ ifeegoo$ 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.

谎言 2024-12-08 04:40:31

我将引导您完成它:

cd /Applications/Jenkins
sudo vi winstone.properties
httpPort=9999 添加到文件中。要查看可以放入其中的所有选项,请输入 java -jar jenkins.war --help

/Applications/Jenkins< 运行 java -jar jenkins.war /代码>。您的端口将被更改。默认情况下,jenkins.war./winstone.properties 获取配置选项。

Andrew-Finnells-MacBook-Pro:Jenkins afinnell$ pwd
/Applications/Jenkins
Andrew-Finnells-MacBook-Pro:Jenkins afinnell$ ls -al
total 87928
drwxr-xr-x   4 root  wheel       136 Aug 21 12:32 .
drwxrwxr-x+ 83 root  admin      2822 Aug 21 12:05 ..
-rwxr-xr-x   1 root  wheel  45014470 Aug 19 13:14 jenkins.war
-rw-r--r--   1 root  wheel        14 Aug 21 12:32 winstone.properties
Andrew-Finnells-MacBook-Pro:Jenkins afinnell$ sudo cat winstone.properties 
httpPort=9494
Andrew-Finnells-MacBook-Pro:Jenkins afinnell$ java -jar jenkins.war
Running from: /Applications/Jenkins/jenkins.war
webroot: $user.home/.jenkins
[Winstone 2011/08/21 12:33:19] - Beginning extraction from war file
Jenkins home directory: /Users/afinnell/.jenkins found at: $user.home/.jenkins
[Winstone 2011/08/21 12:33:21] - HTTP Listener started: port=9494

I'll walk you through it:

cd /Applications/Jenkins
sudo vi winstone.properties
Add httpPort=9999 to the file. To see all the options you can put in there type java -jar jenkins.war --help

run java -jar jenkins.war from /Applications/Jenkins. Your port will be changed. jenkins.war picks up config options from ./winstone.properties by default.

Andrew-Finnells-MacBook-Pro:Jenkins afinnell$ pwd
/Applications/Jenkins
Andrew-Finnells-MacBook-Pro:Jenkins afinnell$ ls -al
total 87928
drwxr-xr-x   4 root  wheel       136 Aug 21 12:32 .
drwxrwxr-x+ 83 root  admin      2822 Aug 21 12:05 ..
-rwxr-xr-x   1 root  wheel  45014470 Aug 19 13:14 jenkins.war
-rw-r--r--   1 root  wheel        14 Aug 21 12:32 winstone.properties
Andrew-Finnells-MacBook-Pro:Jenkins afinnell$ sudo cat winstone.properties 
httpPort=9494
Andrew-Finnells-MacBook-Pro:Jenkins afinnell$ java -jar jenkins.war
Running from: /Applications/Jenkins/jenkins.war
webroot: $user.home/.jenkins
[Winstone 2011/08/21 12:33:19] - Beginning extraction from war file
Jenkins home directory: /Users/afinnell/.jenkins found at: $user.home/.jenkins
[Winstone 2011/08/21 12:33:21] - HTTP Listener started: port=9494
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文