
Jenkinsのインストールが完了し、さあ起動しようとしたとき、こんなエラーがでたことはないでしょうか。

前の記事でJenkinsのインストール手順を記載したのですが、その過程で何度も何度も発生したコイツは環境によって様々理由があるんでしょうが、確認できた範囲で解消策を記載していきます。
まずはログを確認
エラーした原因はsyslogに書き出されます。
もしsyslogをインストールしてなかった場合は下記の手順でインストールします。
syslogインストール
dnf install rsyslog
systemctl start rsyslog
systemctl enable rsyslog #自動起動On
起動すると/var/log以下にログが書き出されるようになります。
ログの確認
Jenkinsの起動時に出るエラーは、「/var/log/messages」に出力されます。
viとかで見てみると下記のようになっていたりします。
Aug 11 16:02:34 localhost systemd[1]: Starting Jenkins Continuous Integration Server...
Aug 11 16:02:34 localhost jenkins[6594]: jenkins: failed to find a valid Java installation
Aug 11 16:02:34 localhost systemd[1]: jenkins.service: Main process exited, code=exited, status=1/FAILURE
Aug 11 16:02:34 localhost systemd[1]: jenkins.service: Failed with result 'exit-code'.
Aug 11 16:02:34 localhost systemd[1]: Failed to start Jenkins Continuous Integration Server.
Aug 11 16:02:34 localhost systemd[1]: jenkins.service: Service RestartSec=100ms expired, scheduling restart.
Aug 11 16:02:34 localhost systemd[1]: jenkins.service: Scheduled restart job, restart counter is at 1.
Aug 11 16:02:34 localhost systemd[1]: Stopped Jenkins Continuous Integration Server.
Aug 11 16:02:34 localhost systemd[1]: Starting Jenkins Continuous Integration Server...
今回のエラーは「jenkins: failed to find a valid Java installation」の部分です。
Javaがインストールされていないから起動できない
というわけですね、なのでJavaをインストールします。
dnf install java-11-openjdk java-11-openjdk-devel
もう一度Jenkinsを起動します。

お前の顔が見たかったんだよ!