Raspberry Pi に Jenkins をインストールしてみた
2017-06-26 09:00
  • 衝動買して一通り遊んだ後放置していた Raspberry Pi に Jenkins をインストールして遊んでみました。
    なお、ディストリビューションは Raspbianを選択していて、すでにインストール済みで話を進めます。

    各アプリケーションを最新化する

    しばらく放置していたので、もろもろ更新がかかっているはずなので
    Jenkins をインストールする前に最新に保っておきます。

    pi@raspberrypi:~ $ sudo apt-get update
    pi@raspberrypi:~ $ sudo apt-get upgrade
    

    Jenkins をインストールする

    Raspbian 標準のリポジトリでは
    Jenkins 1 系しかインストール出来ないので、新たにリポジトリを追加して 2 系をインストールできるようにします。

    pi@raspberrypi:~ $ wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
    OK
    
    pi@raspberrypi:~ $ sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
    pi@raspberrypi:~ $ sudo apt-get update
    Ign http://pkg.jenkins-ci.org binary/ InRelease
    Get:1 http://pkg.jenkins-ci.org binary/ Release.gpg [181 B]                      
    Hit http://mirrordirector.raspbian.org jessie InRelease                          
    Get:2 http://pkg.jenkins-ci.org binary/ Release [2,042 B]
    Hit http://archive.raspberrypi.org jessie InRelease
    Hit http://mirrordirector.raspbian.org jessie/main armhf Packages
    Get:3 http://pkg.jenkins-ci.org binary/ Packages [880 B]                         
    Hit http://mirrordirector.raspbian.org jessie/contrib armhf Packages                                       
    Hit http://archive.raspberrypi.org jessie/main armhf Packages                           
    Hit http://mirrordirector.raspbian.org jessie/non-free armhf Packages                   
    Hit http://mirrordirector.raspbian.org jessie/rpi armhf Packages                                                          
    Hit http://archive.raspberrypi.org jessie/ui armhf Packages                                                               
    Ign http://pkg.jenkins-ci.org binary/ Translation-en_GB                                 
    Ign http://pkg.jenkins-ci.org binary/ Translation-en                                    
    Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en_GB                                                                                                                                                  
    Ign http://archive.raspberrypi.org jessie/main Translation-en_GB                                                                                                                                                         
    Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en                                                                                                                                                     
    Ign http://mirrordirector.raspbian.org jessie/main Translation-en_GB                                                                                                                                                     
    Ign http://archive.raspberrypi.org jessie/main Translation-en                                                                                                                                                            
    Ign http://mirrordirector.raspbian.org jessie/main Translation-en                                                                                                                                                        
    Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en_GB                                                                                                                                                 
    Ign http://archive.raspberrypi.org jessie/ui Translation-en_GB                                                                                                                                                           
    Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en                                                                                                                                                    
    Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en_GB                                                                                                                                                      
    Ign http://archive.raspberrypi.org jessie/ui Translation-en                                                                                                                                                              
    Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en                                                                                                                                                         
    Fetched 3,103 B in 15s (195 B/s)                                                                                                                                                                                         
    Reading package lists... Done
    

    続いて、 Jenkins をインストールします
    pi@raspberrypi:~ $ sudo apt-get install jenkins
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following extra packages will be installed:
      daemon libxi6 libxrender1 libxtst6 oracle-java8-jdk x11-common
    The following NEW packages will be installed:
      daemon jenkins libxi6 libxrender1 libxtst6 oracle-java8-jdk x11-common
    0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
    Need to get 0 B/134 MB of archives.
    After this operation, 245 MB of additional disk space will be used.
    Do you want to continue? [Y/n] Y
    Selecting previously unselected package libxi6:armhf.
    (Reading database ... 33876 files and directories currently installed.)
    Preparing to unpack .../libxi6_2%3a1.7.4-1_armhf.deb ...
    Unpacking libxi6:armhf (2:1.7.4-1) ...
    Selecting previously unselected package libxrender1:armhf.
    Preparing to unpack .../libxrender1_1%3a0.9.8-1_armhf.deb ...
    Unpacking libxrender1:armhf (1:0.9.8-1) ...
    Selecting previously unselected package x11-common.
    Preparing to unpack .../x11-common_1%3a7.7+16_all.deb ...
    Unpacking x11-common (1:7.7+16) ...
    Selecting previously unselected package libxtst6:armhf.
    Preparing to unpack .../libxtst6_2%3a1.2.2-1_armhf.deb ...
    Unpacking libxtst6:armhf (2:1.2.2-1) ...
    Selecting previously unselected package daemon.
    Preparing to unpack .../daemon_0.6.4-1_armhf.deb ...
    Unpacking daemon (0.6.4-1) ...
    Selecting previously unselected package oracle-java8-jdk.
    Preparing to unpack .../oracle-java8-jdk_8u65_armhf.deb ...
    Unpacking oracle-java8-jdk (8u65) ...
    Selecting previously unselected package jenkins.
    Preparing to unpack .../archives/jenkins_2.66_all.deb ...
    Unpacking jenkins (2.66) ...
    Processing triggers for systemd (215-17+deb8u7) ...
    Processing triggers for man-db (2.7.0.2-5) ...
    Setting up libxi6:armhf (2:1.7.4-1) ...
    Setting up libxrender1:armhf (1:0.9.8-1) ...
    Setting up x11-common (1:7.7+16) ...
    update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
    Setting up libxtst6:armhf (2:1.2.2-1) ...
    Setting up daemon (0.6.4-1) ...
    Setting up oracle-java8-jdk (8u65) ...
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/java to provide /usr/bin/java (java) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/keytool to provide /usr/bin/keytool (keytool) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/orbd to provide /usr/bin/orbd (orbd) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/pack200 to provide /usr/bin/pack200 (pack200) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/rmid to provide /usr/bin/rmid (rmid) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/rmiregistry to provide /usr/bin/rmiregistry (rmiregistry) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/servertool to provide /usr/bin/servertool (servertool) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/tnameserv to provide /usr/bin/tnameserv (tnameserv) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/unpack200 to provide /usr/bin/unpack200 (unpack200) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/policytool to provide /usr/bin/policytool (policytool) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/lib/jexec to provide /usr/bin/jexec (jexec) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/appletviewer to provide /usr/bin/appletviewer (appletviewer) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/extcheck to provide /usr/bin/extcheck (extcheck) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/idlj to provide /usr/bin/idlj (idlj) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/jar to provide /usr/bin/jar (jar) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/jarsigner to provide /usr/bin/jarsigner (jarsigner) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/javac to provide /usr/bin/javac (javac) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/javadoc to provide /usr/bin/javadoc (javadoc) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/javah to provide /usr/bin/javah (javah) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/javap to provide /usr/bin/javap (javap) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/jcmd to provide /usr/bin/jcmd (jcmd) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/jconsole to provide /usr/bin/jconsole (jconsole) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/jdb to provide /usr/bin/jdb (jdb) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/jdeps to provide /usr/bin/jdeps (jdeps) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/jhat to provide /usr/bin/jhat (jhat) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/jinfo to provide /usr/bin/jinfo (jinfo) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/jmap to provide /usr/bin/jmap (jmap) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/jps to provide /usr/bin/jps (jps) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/jrunscript to provide /usr/bin/jrunscript (jrunscript) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/jsadebugd to provide /usr/bin/jsadebugd (jsadebugd) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/jstack to provide /usr/bin/jstack (jstack) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/jstat to provide /usr/bin/jstat (jstat) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/jstatd to provide /usr/bin/jstatd (jstatd) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/native2ascii to provide /usr/bin/native2ascii (native2ascii) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/rmic to provide /usr/bin/rmic (rmic) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/schemagen to provide /usr/bin/schemagen (schemagen) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/serialver to provide /usr/bin/serialver (serialver) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/wsgen to provide /usr/bin/wsgen (wsgen) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/wsimport to provide /usr/bin/wsimport (wsimport) in auto mode
    update-alternatives: using /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/xjc to provide /usr/bin/xjc (xjc) in auto mode
    Setting up jenkins (2.66) ...
    Processing triggers for libc-bin (2.19-18+deb8u10) ...
    Processing triggers for systemd (215-17+deb8u7) ...
    

    Jenkins の初期設定をする

    すでに Jenkins が起動している状態なので、http://[your raspberrypi's IP]:8080 にアクセスします。/etc/default/jenkins にて HTTP_PORT を変更して下さい。(変更した場合は Jenkins の再起動も忘れずに。 sudo service jenkins restart
    Jenkins 初回画面

    初回アクセス時は、ロックされた状態になっていますので、管理者初回パスワードを入力して Jenkins を有効化します。

    pi@raspberrypi:~ $ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
    xxxxxxxxxxxxxx
    

    あとは支持に従って必要だと思われるプラグインを決めてインストール、管理者ユーザーを作成すれば
    Jenkins を利用できるようになります。

    プラグインインストール
    Jenkins プラグインインストール画面

    管理者ユーザー作成
    Jenkins 管理者ユーザー作成


    以上で、インストールが完了です。
    あとはジョブを作って好きに遊ぶ感じで。

    人気ブログランキングへ ブログランキング・にほんブログ村へ
    ↑応援よろしくお願いします!m(_ _)m

  • 2017-06-26 09:00
  • その他
  • RaspberryPiRaspbianJenkinsCIインストール
  • 新しい記事へ
    [firefox] Slack View Optimizer が firefox addon にも対応しました

    古い記事へ
    Windows に SQLite をインストールして使ってみた

profile picture

自己紹介的な何か

@wkmettyでついったーやってます。時々。 普段はなんちゃってプログラマやってます。海外から帰任してからは現場に戻って最前線でコード書いてます。 週末は気の向くままにプログラミングしたり、写真撮りに出かけたり、家でhuluみながらまったりしたりしています。(*´ω`*)モキュ