安裝jenkins
- jenkins依賴的java環境,使用
$ java –version
命令,檢視是否已經安裝。 - 安裝HomeBrew,jenkins依賴HomeBrew包管理,使用
$ brew -v
命令,檢視是否已安裝。 - 安裝完HomeBrew後,執行
$ brew install jenkins
命令,安裝jenkins,安裝時間較長,耐心等待,出現Jenkins is fully up and running字樣後,說明安裝成功已啟動。
解除安裝jenkins
// 需要刪除Jenkins可以執行命令列
$ sh "/Library/Application Support/Jenkins/Uninstall.command"
// 使用brew安裝的可以執行
$ brew uninstall jenkins
複製程式碼
啟動/關閉jenkins
// 啟動Jenkins
$ jenkins -h
// 快捷鍵關閉Jenkins
$ control + c
複製程式碼
問題
- 埠號衝突
// 異常資訊
Apr 26, 2018 4:17:37 PM winstone.Logger logInternal
SEVERE: Container startup failed
java.io.IOException: Failed to start Jetty
at winstone.Launcher.<init>(Launcher.java:156)
at winstone.Launcher.main(Launcher.java:354)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at Main._main(Main.java:312)
at Main.main(Main.java:136)
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:334)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:302)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:238)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.server.Server.doStart(Server.java:397)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at winstone.Launcher.<init>(Launcher.java:154)
... 7 more
複製程式碼
// 修改埠號
$ jenkins --httpPort=7778
複製程式碼
驗證安裝結果
在瀏覽器中輸入http://localhost:7778,進入Jenkins。
Linux環境搭建