安装 jdk 依赖

java -version

java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

安装 Apache

mac 环境已经自带 Apache 工具,可以不安装

安装 jenkins

dmg 安装 (不推荐)

设置开机自启动:sudo launchctl load -w /Library/LaunchDaemons/org.jenkins-ci.plist
取消开机自启动:sudo launchctl unload -w /Library/LaunchDaemons/org.jenkins-ci.plist
手动启动:Java -jar jenkins.war
后台启动(默认端口):nohup java -jar jenkins.war &
后台启动(指定端口):nohup java -jar jenkins.war -httpPort=88 &
后台启动(HTTPS):nohup java -jar jenkins.war -httpsPort=88 &

brew 安装 (推荐)

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install jenkins
在安装后有可能找不到war包地址,可以用mdfind命令本地查询下

mdfind -name jenkins.war
/usr/local/Cellar/jenkins/2.116/libexec/jenkins.war
java -jar /usr/local/Cellar/jenkins/2.116/libexec/jenkins.war --httpPort=8080
后台启动的意思是放到后台运行,即使窗口被干掉,jenkins的进程也会存在.

简单用shell脚本nohup命令放到后台

启动脚本命令:sh startjenkins.sh

#!/bin/bash
echo start jenkins

nohup java -jar /usr/local/Cellar/jenkins/2.116/libexec/jenkins.war --httpPort=8080 &

echo start end

jenkins 常用操作

访问:http://localhost:8080/login?from=%2F

退出:http://localhost:8080/exit 

重启:http://localhost:8080/restart 

重新加载:http://localhost:8080/reload

小结


↙↙↙阅读原文可查看相关链接,并与作者交流