Mac下使用命令列安裝 jenkins 方法
阿新 • • 發佈:2019-02-05
首先說明不建議使用官網 dmg 形式的安裝包,搭建環境什麼的強烈建議使用**命令列**。
1. 安裝 brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2. 升級 java
brew cask install java
3. 安裝 jenkins
brew install jenkins
4. 執行
java -jar /usr/local/Cellar/jenkins/2.49/libexec/jenkins.war --httpPort=8080
5. 啟動 jinkens
sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist
6. 停止 jinkens
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
備註:
若提示org.jenkins-ci.plist 檔案未找到手動建立即可
sudo touch /Library/LaunchDaemons/org.jenkins-ci.plist
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>Jenkins</string> <key>ProgramArguments</key> <array> <string>/usr/bin/java</string> <string>-jar</string> <string>/usr/local/Cellar/jenkins/2.49/libexec/jenkins.war</string> </array> <key>OnDemand</key> <false/> <key>RunAtLoad</key> <true/> <key>UserName</key> <string>admin</string> </dict> </plist>