総数:56 今日:1 昨日:0
参考URL https://linuxconfig.org/how-to-install-ssh-server-on-ubuntu-16-04-xenial-linux
$ sudo apt-get install ssh
パッケージリストを読み込んでいます... 完了 依存関係ツリーを作成しています 状態情報を読み取っています... 完了 以下の追加パッケージがインストールされます: ncurses-term openssh-server openssh-sftp-server ssh-import-id 提案パッケージ: ssh-askpass rssh molly-guard monkeysphere 以下のパッケージが新たにインストールされます: ncurses-term openssh-server openssh-sftp-server ssh ssh-import-id アップグレード: 0 個、新規インストール: 5 個、削除: 0 個、保留: 4 個。 643 kB のアーカイブを取得する必要があります。 この操作後に追加で 5,244 kB のディスク容量が消費されます。 続行しますか? [Y/n] Y 取得:1 http://jp.archive.ubuntu.com/ubuntu xenial-updates/main amd64 openssh-sftp-server amd64 1:7.2p2-4ubuntu2.1 [38.8 kB] 取得:2 http://jp.archive.ubuntu.com/ubuntu xenial-updates/main amd64 openssh-server amd64 1:7.2p2-4ubuntu2.1 [338 kB] 取得:3 http://jp.archive.ubuntu.com/ubuntu xenial-updates/main amd64 ssh all 1:7.2p2-4ubuntu2.1 [7,070 B] 取得:4 http://jp.archive.ubuntu.com/ubuntu xenial/main amd64 ncurses-term all 6.0+20160213-1ubuntu1 [249 kB] 取得:5 http://jp.archive.ubuntu.com/ubuntu xenial/main amd64 ssh-import-id all 5.5-0ubuntu1 [10.2 kB] 643 kB を 0秒 で取得しました (2,945 kB/s) パッケージを事前設定しています ... 以前に未選択のパッケージ openssh-sftp-server を選択しています。 (データベースを読み込んでいます ... 現在 187369 個のファイルとディレクトリがインストールされています。) .../openssh-sftp-server_1%3a7.2p2-4ubuntu2.1_amd64.deb を展開する準備をしています ... openssh-sftp-server (1:7.2p2-4ubuntu2.1) を展開しています... 以前に未選択のパッケージ openssh-server を選択しています。 .../openssh-server_1%3a7.2p2-4ubuntu2.1_amd64.deb を展開する準備をしています ... openssh-server (1:7.2p2-4ubuntu2.1) を展開しています... 以前に未選択のパッケージ ssh を選択しています。 .../ssh_1%3a7.2p2-4ubuntu2.1_all.deb を展開する準備をしています ... ssh (1:7.2p2-4ubuntu2.1) を展開しています... 以前に未選択のパッケージ ncurses-term を選択しています。 .../ncurses-term_6.0+20160213-1ubuntu1_all.deb を展開する準備をしています ... ncurses-term (6.0+20160213-1ubuntu1) を展開しています... 以前に未選択のパッケージ ssh-import-id を選択しています。 .../ssh-import-id_5.5-0ubuntu1_all.deb を展開する準備をしています ... ssh-import-id (5.5-0ubuntu1) を展開しています... man-db (2.7.5-1) のトリガを処理しています ... systemd (229-4ubuntu10) のトリガを処理しています ... ureadahead (0.100.0-19) のトリガを処理しています ... ureadahead will be reprofiled on next reboot ufw (0.35-0ubuntu2) のトリガを処理しています ... openssh-sftp-server (1:7.2p2-4ubuntu2.1) を設定しています ... openssh-server (1:7.2p2-4ubuntu2.1) を設定しています ... Creating SSH2 RSA key; this may take some time ... 2048 SHA256:EEoY9zH7S7NKv2zcSnjfgyXou82OytYuL3xXkYbA6X4 root@ryu (RSA) Creating SSH2 DSA key; this may take some time ... 1024 SHA256:wcQxlpVBJ7VEQg8WBg8ZB7smHQYsCAbrUwW2kaUqd+8 root@ryu (DSA) Creating SSH2 ECDSA key; this may take some time ... 256 SHA256:2oqyKIXQ7SHlo9PzpyZ+JYKplh12BJYobVd1BCy4Ag0 root@ryu (ECDSA) Creating SSH2 ED25519 key; this may take some time ... 256 SHA256:davM55b/rU4zBUXbc+JqZ/UoYB3HmrJBGC0KtfGx7Jo root@ryu (ED25519) ssh (1:7.2p2-4ubuntu2.1) を設定しています ... ncurses-term (6.0+20160213-1ubuntu1) を設定しています ... ssh-import-id (5.5-0ubuntu1) を設定しています ... systemd (229-4ubuntu10) のトリガを処理しています ... ureadahead (0.100.0-19) のトリガを処理しています ... ufw (0.35-0ubuntu2) のトリガを処理しています ...
$ sudo service ssh start
$ sudo systemctl enable ssh
Synchronizing state of ssh.service with SysV init with /lib/systemd/systemd-sysv-install... Executing /lib/systemd/systemd-sysv-install enable ssh
下記を参考に操作するWindowsの共有フォルダを自動マウントするようにしておく
http://foxtail.lv9.org/wiki/doc/pukiwiki-1_5_1_utf8/index.php?mount%20command#o9dce617
~$ wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add - OK
~$ sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
~$ sudo apt-get update
ヒット:1 http://jp.archive.ubuntu.com/ubuntu xenial InRelease 取得:2 http://jp.archive.ubuntu.com/ubuntu xenial-updates InRelease [95.7 kB] ヒット:3 http://jp.archive.ubuntu.com/ubuntu xenial-backports InRelease 取得:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB] 無視:5 http://pkg.jenkins.io/debian-stable binary/ InRelease 取得:6 http://pkg.jenkins.io/debian-stable binary/ Release [2,042 B] 取得:7 http://pkg.jenkins.io/debian-stable binary/ Release.gpg [181 B] 取得:8 http://pkg.jenkins.io/debian-stable binary/ Packages [658 B] 193 kB を 1秒 で取得しました (121 kB/s) パッケージリストを読み込んでいます... 完了 W: http://pkg.jenkins.io/debian-stable/binary/Release.gpg: 鍵 150FDE3F7787E7D11EF4E12A9B7D32F2D50582E6 による署名は弱い digest アルゴリズム (SHA1) を使用しています
~$ sudo apt-get install jenkins
パッケージリストを読み込んでいます... 完了 依存関係ツリーを作成しています 状態情報を読み取っています... 完了 以下の追加パッケージがインストールされます: daemon 以下のパッケージが新たにインストールされます: daemon jenkins アップグレード: 0 個、新規インストール: 2 個、削除: 0 個、保留: 4 個。 69.0 MB のアーカイブを取得する必要があります。 この操作後に追加で 70.1 MB のディスク容量が消費されます。 続行しますか? [Y/n] Y 取得:1 http://jp.archive.ubuntu.com/ubuntu xenial/universe amd64 daemon amd64 0.6.4-1 [98.2 kB] 取得:2 http://pkg.jenkins.io/debian-stable binary/ jenkins 2.19.1 [68.9 MB] 69.0 MB を 10秒 で取得しました (6,299 kB/s) 以前に未選択のパッケージ daemon を選択しています。 (データベースを読み込んでいます ... 現在 190132 個のファイルとディレクトリがインストールされています。) .../daemon_0.6.4-1_amd64.deb を展開する準備をしています ... daemon (0.6.4-1) を展開しています... 以前に未選択のパッケージ jenkins を選択しています。 .../jenkins_2.19.1_all.deb を展開する準備をしています ... jenkins (2.19.1) を展開しています... man-db (2.7.5-1) のトリガを処理しています ... systemd (229-4ubuntu10) のトリガを処理しています ... ureadahead (0.100.0-19) のトリガを処理しています ... daemon (0.6.4-1) を設定しています ... jenkins (2.19.1) を設定しています ... systemd (229-4ubuntu10) のトリガを処理しています ... ureadahead (0.100.0-19) のトリガを処理しています ...
~$ sudo gvim -f /etc/default/jenkins
例: HTTP_PORT=4000
編集例
~$ colordiff -pu /etc/default/jenkins.default /etc/default/jenkins
--- /etc/default/jenkins.default 2016-10-05 00:20:48.000000000 +0900 +++ /etc/default/jenkins 2016-10-10 18:17:07.879767718 +0900 @@ -10,6 +10,7 @@ JAVA=/usr/bin/java JAVA_ARGS="-Djava.awt.headless=true" # Allow graphs etc. to work even when an X server is present #JAVA_ARGS="-Xmx256m" #JAVA_ARGS="-Djava.net.preferIPv4Stack=true" # make jenkins listen on IPv4 address +JAVA_ARGS="-Dfile.encoding=utf-8" # avoid garbled characters in Git Plugin PIDFILE=/var/run/$NAME/$NAME.pid @@ -54,8 +55,8 @@ MAXOPENFILES=8192 # UMASK=027 # port for HTTP connector (default 8080; disable with -1) -HTTP_PORT=8080 - +#HTTP_PORT=8080 +HTTP_PORT=4000 # servlet context, important if you want to use apache proxying PREFIX=/$NAME @@ -69,4 +70,4 @@ PREFIX=/$NAME # --webroot=~/.jenkins/war # --prefix=$PREFIX -JENKINS_ARGS="--webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT" +JENKINS_ARGS="--webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT --prefix=/jenkins"
~$ sudo service jenkins restart * Restarting Jenkins Continuous Integration Server jenkins
http://<hostname>:<port>/jenkins/
/var/lib/jenkins/secrets/initialAdminPassword
Username: jenkins Password: プリセットされている Confirm password: 同じのを入力する Full name: <your name> E-mail address: <your email address>
You've skipped creating an admin user. To log in, use the username: 'admin' and the administrator password you used to access the setup wizard.
http://<hostname>:<port>/jenkins/
Username: admin Password: <Administrator password>
| プラグイン | 説明 | 備考 |
| Javadoc Plugin | This plugin adds Javadoc support to Jenkins. | その他 (website) |
| Filesystem Trigger Plug-in | FSTrigger provides polling mechanisms to monitor a file system and trigger a build if a file or a set of files have changed. | ビルドトリガ |
| Shelve Project Plugin | This plugin lets you shelve projects so that they can easily be resurrected. | その他 (website) ユーザーインタフェース |
| Translation Assistance plugin | This plugin adds an additional dialog box in every page, which enables people to contribute localizations for the messages they are seeing in the current page | ユーザーインタフェース |
| Maven Integration plugin | This plugin provides an advanced integration for Maven 2/3 projects. | ビルドツール |
| Job Configuration History Plugin | Saves copies of all job and system configurations. | その他 (website) ユーザーインタフェース |
| Parameterized Trigger plugin | This plugin lets you trigger new builds when your build has completed, with various ways of specifying parameters for the new build. | その他 (website) |
| Hudson Seleniumhq plugin | This plugin allows you to run and load HTML Selenese suite result generate by Selenium Server from Seleniumhq. Jenkins will generate the trend report of test result. | ビルドツール ビルドレポート |
| CVS Plug-in | This bundled plugin integrates Jenkins with CVS version control system. | ソース管理システム |
| Copy Artifact Plugin | This bundled plugin integrates Jenkins with CVS version control system. | ソース管理システム |
| Join plugin | This plugin allows a job to be run after all the immediate downstream jobs have completed. | ビルドトリガ |
| Files Found Trigger | Build trigger that polls one or more directories and starts a build if certain files are found within those directories. | ビルドトリガ |
| Lockable Resources plugin | This plugin allows to define lockable resources (such as printers, phones, computers, etc.) that can be used by builds. If a build requires an resource which is already locked, it will wait for the resource to be free. One can define a lock-priority globally and on a per-job basis. | Agent Launchers and Controllers |
| disk-usage plugin | This plugin records disk usage. | ビルドレポート |
| SSH Agent Plugin | This plugin allows you to provide SSH credentials to builds via a ssh-agent in Jenkins. | その他 (website) |
| Rebuilder | This plug-in allows the user to _rebuild_ a _parametrized build_ without entering the _parameters_ again.It will also allow the user to edit the parameters before rebuilding. | その他 (website) |
| Gerrit Trigger | This plugin integrates Jenkins to Gerrit code review for triggering builds when a "patch set" is created. | ビルドトリガ |
| Copy To Slave Plugin | This plugin allows to copy a set of files, from a location somewhere on the master node, to jobs' workspaces. It also allows to copy files back from the workspaces of jobs located on a slave node to their workspaces on the master one. | Agent Launchers and Controllers ビルドラッパー ビルド通知 |
| ThinBackup | This plugin simply backs up the global and job specific configurations (not the archive or the workspace). | その他 (website) |
| Mask Passwords Plugin | This plugin allows masking passwords that may appear in the console | その他 (website) ビルドラッパー |
| Build Trigger Badge Plugin | This plugin displays icon(s) representing the cause(s) of a build directly in the build history. It lets you quickly know which cause triggered a build. | ユーザーインタフェース |
| jQuery plugin | This plugin is a library plugin for other plugins to share common jQuery. It also allows users to use jQuery on each view descriptions. | Library plugins (for use by other plugins) |
| Node and Label parameter plugin | This plugin adds two new parameter types to job configuration - node and label, this allows to dynamically select the node where a job/project should be executed. | Agent Launchers and Controllers Build Parameters ビルドトリガ |
| Build Pipeline Plugin | This plugin provides a _Build Pipeline View_ of upstream and downstream connected jobs that typically form a build pipeline. In addition, it offers the ability to define manual triggers for jobs that require intervention prior to execution, e.g. an approval process outside of Jenkins. | ビルドツール ビルド後のアクション ユーザーインタフェース |
| Publish Over CIFS | Send build artifacts to a windows share (CIFS/SMB/samba) | 成果物のアップロード |
| Selenium Auto Exec Server(AES) plugin | This plugin is for continuous regression test by Selenium Auto Exec Server (AES). | ビルドツール ビルドレポート |
| Mercurial plugin | This plugin integrates the Mercurial version control system with Jenkins. | ソース管理システム |
| Associated Files Plugin | This plugin allows for marking files or directories outside of Jenkins as related to a build. | ビルド後のアクション |
| Hudson Locks and Latches plugin | This plugin allows you to control the parallel execution of jobs. | ビルドトリガ ビルドラッパー |
| File System SCM | Use File System as SCM. | ソース管理システム |
| Role-based Authorization Strategy | Adds a new role-based strategy to manage users' permissions. | Security 認証/ユーザー管理 |
参考URL http://qiita.com/west-hiroaki/items/410a76c96ad57c8cb547
ユーザー名: john パスワード: john パスワードの確認: john フルネーム: John Smith メールアドレス: john@smith
プラグインをインストールした直後は、全てのアクションが可能なadmin権限しか無いので、その他の権限を作成します。
例として、閲覧と既存ジョブが実行可能なoperator権限を作成します。
作成したユーザーと権限を紐付けます。
# $HOMEを確認する
echo "HOME: ${HOME}"
# current directoryを確認する
work_dir=`pwd`
echo "work_dir: ${work_dir}"
# process idを確認する
echo "pid of this job : $$"
pid_of_this_job="$$"
# 指定したprocess idのprocessの情報を確認する
ps auxcf | grep -i --color -e "^USER\|${pid_of_this_job}"
実行結果 USERは jenkins だ。$HOMEは /var/lib/jenkins だ。
ビルドします。 ワークスペース: /var/lib/jenkins/workspace/confirm_processes [confirm_processes] $ /bin/sh -xe /tmp/hudson1474396497236908427.sh + echo HOME: /var/lib/jenkins HOME: /var/lib/jenkins + pwd + work_dir=/var/lib/jenkins/workspace/confirm_processes + echo work_dir: /var/lib/jenkins/workspace/confirm_processes work_dir: /var/lib/jenkins/workspace/confirm_processes + echo pid of this job : 2750 pid of this job : 2750 + pid_of_this_job=2750 + ps auxcf + grep -i --color -e ^USER\|2750 USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND jenkins 2750 0.0 0.0 4508 708 ? S 11:16 0:00 \_ sh Started calculate disk usage of build Finished Calculation of disk usage of build in 0 seconds Started calculate disk usage of workspace Finished Calculation of disk usage of workspace in 0 seconds Notifying upstream projects of job completion Finished: SUCCESS
$ sudo visudo
下記を追記する
jenkins ALL=NOPASSWD: ALL
編集後
1 # 2 # This file MUST be edited with the 'visudo' command as root. 3 # 4 # Please consider adding local content in /etc/sudoers.d/ instead of 5 # directly modifying this file. 6 # 7 # See the man page for details on how to write a sudoers file. 8 # 9 Defaults env_reset 10 Defaults mail_badpass 11 Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin" 12 13 # Host alias specification 14 15 # User alias specification 16 17 # Cmnd alias specification 18 19 # User privilege specification 20 root ALL=(ALL:ALL) ALL 21 jenkins ALL=NOPASSWD: ALL 22 # Members of the admin group may gain root privileges 23 %admin ALL=(ALL) ALL 24 25 # Allow members of group sudo to execute any command 26 %sudo ALL=(ALL:ALL) ALL 27 28 # See sudoers(5) for more information on "#include" directives: 29 30 #includedir /etc/sudoers.d
https://wiki.jenkins-ci.org/display/JENKINS/Disable+security
http://qiita.com/koara-local/items/79cb9c08e77ac9d94b1d
Dockerコンテナを使って自動ビルドを実行する
Jenkins のスレーブを設定する
【ぼっさんのJenkins講座】マスタースレーブを体験しよう – ノード作成編
認証情報の追加 予め作成しておく。あとでNode新規作成時に認証情報として指定する。
http://<jenkins_host>/jenkins/credentials/store/system/domain/_/newCredentials
| 種類 | SSHユーザー名と秘密鍵 |
| スコープ | グローバル |
| ユーザー名 | スレーブ側のユーザー名/home/salve/なら「slave」にする |
| 秘密鍵 | マスター側jenkinsで ssh-keygen でid_rsaをつくったときの.pubがついてないほうのファイルを指定する。それか直接テキスト指定する。 |
| パスフレーズ | マスター側jenkinsで ssh-keygen でid_rsaをつくったときのパスワード。パスワード無しで作成しておく。 |
| ID | 空欄 |
| 説明 | 認証情報を区別するための説明です。認証情報はスレーブ側のユーザー名のぶんだけ別に必要 |