Linux教程

Mac安装jenkins

本文主要是介绍Mac安装jenkins,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

1.首先先安装brew命令, 如之前安装过则跳过

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 
复制代码

2.jenkins的安装,依赖jdk8,使用以下命令安装jdk8

brew cask install homebrew/cask-versions/adoptopenjdk8
复制代码

3.安装jenkins, Homebrew会将软件包安装到独立目录/usr/local/Cellar,并将其文件软链接至/usr/local

brew install jenkins
复制代码

4.命令启动/停止/重启jenkins

#启动jenkins
brew services start jenkins
#停止jenkins 
brew services stop jenkins
#重启jenkins
brew services restart jenkins
复制代码

5.然后打开浏览器,输入localhost:8080 or ip:8080 访问,然后输入密码。

# 获取密码
cat /Users/${计算机名称}/.jenkins/secrets/initialAdminPassword
复制代码

6.修改端口或者局域网访问,jenkins默认的httpListenAddress是127.0.0.1也就是本机地址,如果局域网需要访问的话需要改成0.0.0.0,修改httpPort的值就是修改端口

# 打开配置文件
sudo vim /usr/local/opt/jenkins/homebrew.mxcl.jenkins.plist

#重启jenkins
brew services restart jenkins
复制代码
<?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</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/libexec/jenkins.war</string>
      <string>--httpListenAddress=127.0.0.1</string>
      <string>--httpPort=8080</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
  </dict>
</plist>
复制代码
这篇关于Mac安装jenkins的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!