Mac安装jenkins

DevOps Jenkins Mac评论346字数 3481阅读11分36秒阅读模式
  • 如之前安装过则跳过
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

安装jdk11

brew cask install homebrew/cask-versions/adoptopenjdk11

安装jenkins

brew install jenkins
  • 安装后会有这样的提示
Note: When using launchctl the port will be 8080.

To start jenkins now and restart at login:
brew services start jenkins
Or, if you don't want/need a background service you can just run:
/opt/homebrew/opt/jenkins/bin/jenkins --httpListenAddress\=127.0.0.1 --httpPort\=8080
==> nmap
If using `ndiff` returns an error about not being able to import the ndiff module, try:
chmod go-w /opt/homebrew/Cellar
==> python@3.10
Python has been installed as
/opt/homebrew/bin/python3.10

Unversioned and major-versioned symlinks `python`, `python3`, `python-config`, `python3-config`, `pip`, `pip3`, etc. pointing to
`python3.10`, `python3.10-config`, `pip3.10` etc., respectively, have been installed into
/opt/homebrew/opt/python@3.10/libexec/bin

You can install Python packages with
pip3.10 install <package>
They will install into the site-package directory
/opt/homebrew/lib/python3.10/site-packages

tkinter is no longer included with this formula, but it is available separately:
brew install python-tk@3.10

If you do not need a specific version of Python, and always want Homebrew's `python3` in your PATH:
brew install python3

See: https://docs.brew.sh/Homebrew-and-Python
devops@localhost devops %

命令启动/停止/重启jenkins

#启动jenkins
brew services start jenkins
#停止jenkins 
brew services stop jenkins
#重启jenkins
brew services restart jenkins

访问Jenkins

  • localhost:8080

Mac安装jenkins

修改端口或者局域网访问

  • jenkins默认的httpListenAddress是127.0.0.1也就是本机地址,如果局域网需要访问的话需要改成0.0.0.0,修改httpPort的值就是修改端口。
devops@localhost ~ % vim /Users/devops/Library/LaunchAgents/homebrew.mxcl.jenkins.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>KeepAlive</key>
        <true/>
        <key>Label</key>
        <string>homebrew.mxcl.jenkins</string>
        <key>LimitLoadToSessionType</key>
        <array>
                <string>Aqua</string>
                <string>Background</string>
                <string>LoginWindow</string>
                <string>StandardIO</string>
                <string>System</string>
        </array>
        <key>ProgramArguments</key>
        <array>
                <string>/opt/homebrew/opt/jenkins/bin/jenkins</string>
                <string>--httpListenAddress=127.0.0.1</string>
                <string>--httpPort=8080</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>StandardErrorPath</key>
        <string>/opt/homebrew/var/log/jenkins/error.log</string>
        <key>StandardOutPath</key>
        <string>/opt/homebrew/var/log/jenkins/output.log</string>
</dict>
</plist>
  • 改成
root@localhost ~ # vi /System/Volumes/Data/opt/homebrew/Cellar/jenkins/2.466/homebrew.mxcl.jenkins.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>KeepAlive</key>
        <true/>
        <key>Label</key>
        <string>homebrew.mxcl.jenkins</string>
        <key>LimitLoadToSessionType</key>
        <array>
                <string>Aqua</string>
                <string>Background</string>
                <string>LoginWindow</string>
                <string>StandardIO</string>
                <string>System</string>
        </array>
        <key>ProgramArguments</key>
        <array>
                <string>/opt/homebrew/opt/jenkins/bin/jenkins</string>
                <string>--httpListenAddress=0.0.0.0</string>
                <string>--httpPort=8080</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>StandardErrorPath</key>
        <string>/opt/homebrew/var/log/jenkins/error.log</string>
        <key>StandardOutPath</key>
        <string>/opt/homebrew/var/log/jenkins/output.log</string>
</dict>
</plist>

重启jenkins

devops@localhost ~ % brew services restart jenkins
Stopping `jenkins`... (might take a while)
==> Successfully stopped `jenkins` (label: homebrew.mxcl.jenkins)
==> Successfully started `jenkins` (label: homebrew.mxcl.jenkins)

继续阅读
DevOps
  • 本文由 发表于 2024年7月8日 10:06:31
  • 除非特殊声明,本站文章均为原创,转载请务必保留本文链接
Jenkins集成Gitlab的SSO用户认证 Jenkins

Jenkins集成Gitlab的SSO用户认证

安装插件Gitlab Authentication   gitlab单点登录 一般我们会配置Gitlab系统与LDAP系统做用户认证集成,开发人员登录gitlab系统的频率还是...
评论  0  访客  0

发表评论