はじめに
- このドキュメントでは,JenkinsをhomeBrewを使ってインストールする手順を説明する.JenkinsはJavaで作られているので,Java Runtimeが必要となるが,これも同時にインストールを行っている.
brew listで現在インストールされているパッケージを表示
MBA13:~ ujpadmin$ brew list🆑
openssl readline sqlite subversion tree wget
MBA13:~ ujpadmin$
Jenkinsは入っていない.
brew searchでjenkinsを探す
MBA13:~ ujpadmin$ brew search jenkins🆑
jenkins jenkins-job-builder
homebrew/versions/jenkins-lts Caskroom/cask/jenkins-menu Caskroom/cask/jenkins
MBA13:~ ujpadmin$
- 追加オプションのようなものもあるようだ.今回は本体だけインストール対象とする.
brew install jenkinsでインストールを行うが失敗
MBA13:~ ujpadmin$ brew install jenkins🆑
jenkins: Java 1.7+ is required to install this formula.
You can install with Homebrew Cask:
brew install Caskroom/cask/java
You can download from:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Error: An unsatisfied requirement failed this build.
MBA13:~ ujpadmin$
- Javaがインストールされてないと警告が出ている.brew installでインストールできると記載してあるので,その通りに実施する.
Javaをダウンロードしてインストールする
MBA13:~ ujpadmin$ brew cask install java🆑
==> Caveats
This Cask makes minor modifications to the JRE to prevent issues with
packaged applications, as discussed here:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=411361
If your Java application still asks for JRE installation, you might need
to reboot or logout/login.
Installing this Cask means you have AGREED to the Oracle Binary Code
License Agreement for Java SE at
http://www.oracle.com/technetwork/java/javase/terms/license/index.html
==> Downloading http://download.oracle.com/otn-pub/java/jdk/8u92-b14/jdk-8u92-macosx-x64.dmg
######################################################################## 100.0%
==> Verifying checksum for Cask java
==> Running installer for java; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
Password:
==> installer: Package name is JDK 8 Update 92
==> installer: Installing at base path /
==> installer: The install was successful.
🍺 java staged at '/opt/homebrew-cask/Caskroom/java/1.8.0_92-b14' (2 files, 227M)
MBA13:~ ujpadmin$
- Successfulと表示されインストールが成功.これでJavaのインストール完了.
brew install jankins2回目
MBA13:~ ujpadmin$ brew install jenkins🆑
==> Downloading http://mirrors.jenkins-ci.org/war/2.3/jenkins.war
==> Downloading from http://ftp.yz.yamagata-u.ac.jp/pub/misc/jenkins/war/2.3/jenkins.war
######################################################################## 100.0%
==> jar xvf jenkins.war
==> Caveats
Note: When using launchctl the port will be 8080.
To have launchd 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:
jenkins
==> Summary
🍺 /usr/local/Cellar/jenkins/2.3: 6 files, 64.3M, built in 1 minute 46 seconds
MBA13:~ ujpadmin$
- インストールは問題無く完了した模様.brew services start jenkisで起動できると書いてある.
MBA13:~ ujpadmin$ brew doctor🆑
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!
brew doctorで環境確認
- インストールしたら環境を確認するdoctorコマンドを実行.
Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:
svn
svnadmin
svndumpfilter
svnlook
svnserve
svnsync
svnversion
Consider setting your PATH so that /usr/local/bin
occurs before /usr/bin. Here is a one-liner:
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
MBA13:~ ujpadmin$
- Subversionへのパスが効いてないと出ている.
/usr/local/binにパスを設定する
- Jenkinsには関係ないが,ここらで設定しておく.
MBA13:~ ujpadmin$ echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile🆑
MBA13:~ ujpadmin$ cat ~/.bash_profile🆑
export PATH="/usr/local/bin:$PATH"🈁
MBA13:~ ujpadmin$
MBA13:~ ujpadmin$ source ~/.bash_profile🆑
MBA13:~ ujpadmin$ env | grep PATH🆑
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin🈁
MBA13:~ ujpadmin$ env | grep PATH🆑
MBA13:~ ujpadmin$
- Subversion(SVN)へのパスが通っているか確認する.
MBA13:~ ujpadmin$ which svn🆑
/usr/local/bin/svn🈁
MBA13:~ ujpadmin$
Jenkinsを起動する
- インストール時に指示があったように,コマンドを入力すれば良い.まずは,すでにJenkinsが起動していないか確認する.
MBA13:~ ujpadmin$ ps -ef | grep jenkins🆑
501 8219 4835 0 10:35PM ttys001 0:00.00 grep jenkins
MBA13:~ ujpadmin$
MBA13:~ ujpadmin$ brew services start jenkins🆑
==> Tapping homebrew/services
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-services'...
remote: Counting objects: 7, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 7 (delta 0), reused 4 (delta 0), pack-reused 0
Unpacking objects: 100% (7/7), done.
Checking connectivity... done.
Tapped 0 formulae (32 files, 46.8K)
==> Successfully started `jenkins` (label: homebrew.mxcl.jenkins)
MBA13:~ ujpadmin$
- Successfullyと出ているので成功した模様.プロセスを確認する.
MBA13:~ ujpadmin$ ps -ef | grep jenkins🆑
501 8382 1 0 10:35PM ?? 0:08.94 /usr/bin/java
-Dmail.smtp.starttls.enable=true -jar /usr/local/opt/jenkins/libexec/jen
kins.war --httpListenAddress=127.0.0.1 --httpPort=8080
501 8386 4835 0 10:35PM ttys001 0:00.00 grep jenkins
MBA13:~ ujpadmin$
Jenkinsを停止するbrew services stop jenkins
MBA13:~ ujpadmin$ brew services stop jenkins🆑
Stopping `jenkins`... (might take a while)
==> Successfully stopped `jenkins` (label: homebrew.mxcl.jenkins)
MBA13:~ ujpadmin$
MBA13:~ ujpadmin$ ps -ef | grep jenkins🆑
501 8640 4835 0 12:29AM ttys001 0:00.00 grep jenkins
MBA13:~ ujpadmin$