0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

勉強メモ9_CentOS7にJenkinsをインストール

Last updated at Posted at 2020-10-25

★1 ユーザーをrootに切り替えて開始、まずはJavaのバージョン確認(Java1.7以上インストールされてないと動かないらしい)

[root@localhost ~]# java -version
openjdk version "1.8.0_222-ea"
OpenJDK Runtime Environment (build 1.8.0_222-ea-b03)
OpenJDK 64-Bit Server VM (build 25.222-b03, mixed mode)

★2 yumリポジトリの追加

[root@localhost ~]# wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
--2020-10-25 13:09:38--  http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
pkg.jenkins-ci.org (pkg.jenkins-ci.org) をDNSに問いあわせています... 52.202.51.185
pkg.jenkins-ci.org (pkg.jenkins-ci.org)|52.202.51.185|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 85
`/etc/yum.repos.d/jenkins.repo' に保存中

100%[===================================================================================================================================================>] 85          --.-K/s 時間 0s

2020-10-25 13:09:39 (5.16 MB/s) - `/etc/yum.repos.d/jenkins.repo' へ保存完了 [85/85]

★3 RPM公開鍵のインストール

[root@localhost ~]# rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
[root@localhost ~]#

★4 ★3だと、下記★5のyumでのJenkinsインストールで「jenkins-2.249.2-1.1.noarch.rpm の公開鍵がインストールされていません」のエラーが出るので、以下をインポート

[root@localhost ~]# rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
[root@localhost ~]#

★5 Jenkinsパッケージのインストール

[root@localhost ~]# yum -y install jenkins
読み込んだプラグイン:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftp.riken.jp
 * extras: ftp.riken.jp
 * updates: ftp.riken.jp
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ jenkins.noarch 0:2.249.2-1.1 を インストール
--> 依存性解決を終了しました。

依存性を解決しました

=============================================================================================================================================================================================
 Package                                     アーキテクチャー                           バージョン                                         リポジトリー                                 容量
=============================================================================================================================================================================================
インストール中:
 jenkins                                     noarch                                     2.249.2-1.1                                        jenkins                                      64 M

トランザクションの要約
=============================================================================================================================================================================================
インストール  1 パッケージ

合計容量: 64 M
インストール容量: 64 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  インストール中          : jenkins-2.249.2-1.1.noarch                                                                                                                                   1/1
  検証中                  : jenkins-2.249.2-1.1.noarch                                                                                                                                   1/1

インストール:
  jenkins.noarch 0:2.249.2-1.1

完了しました!
[root@localhost ~]#

★6 待ち受けポートの設定(8080になってるので、他のサービスの衝突を考えて、8000に変更)

[root@localhost ~]# vim /etc/sysconfig/jenkins
---
JENKINS_PORT="8000"
---

★7 サービスの有効化と開始(enableは失敗してるように見えるが、
 https://qiita.com/sawa_toru/items/d8eedef13ab66e823404
 によると有効らしい

[root@localhost ~]# systemctl enable jenkins
jenkins.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig jenkins on
[root@localhost ~]# systemctl start jenkins
[root@localhost ~]#

★8 ブラウザで「 http://localhost:8000 」でアクセス
 下記、Unlock Jenkinsという、管理者パスワードを入力する画面になります。
Snap 2020-10-25 at 13.56.49.png

★9 初期のAdministrator Passwordは、下記で確認し、★8の画面に入力。

[root@localhost ~]# cat /var/lib/jenkins/secrets/initialAdminPassword

★10 Customer Jenkinsの画面が出るので、「install suggensted plugins」を選択
Snap 2020-10-25 at 14.02.35.png

★11 Create First Admin User 画面でアドミンユーザーを作成
Snap 2020-10-25 at 14.10.06.png

★12 ユーザー作成後、以下の画面がでるが、そのまま進む
Snap 2020-10-25 at 14.12.37.png

★13 さらにそのまま進む
Snap 2020-10-25 at 14.13.52.png

★14 ようこそ画面が出ましたので、一旦完了
Snap 2020-10-25 at 14.15.25.png

★15 参考にした記事

 ・https://qiita.com/inakadegaebal/items/b526ffbdbe7ff2b443f1
 ・https://stackoverflow.com/questions/61344317/im-getting-error-public-key-for-jenkins-2-232-1-1-noarch-rpm-is-not-installed
 ・https://weblabo.oscasierra.net/jenkins-install-centos7/
 ・https://qiita.com/sawa_toru/items/d8eedef13ab66e823404

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?