Ubuntu安装Jenkins和OpenJDK

@hanq  2020年10月20日 13:22

参照https://www.jenkins.io/doc/book/installing/linux/的介绍,直接执行命令:

wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > \
    /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins

安装完成,运行报错:

Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.
invoke-rc.d: initscript jenkins, action "start" failed.
● jenkins.service - LSB: Start Jenkins at boot time
   Loaded: loaded (/etc/init.d/jenkins; bad; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2020-10-20 13:15:31 CST; 4ms ago
     Docs: man:systemd-sysv-generator(8)
  Process: 16888 ExecStart=/etc/init.d/jenkins start (code=exited, status=1/FAILURE)

Oct 20 13:15:31 systemd[1]: Starting LSB: Start Jenkins at boot time...
Oct 20 13:15:31 jenkins[16888]: ERROR: No Java executable found in current PATH: /bin:/usr/bi...sbin
Oct 20 13:15:31 jenkins[16888]: If you actually have java installed on the system make sure t...path
Oct 20 13:15:31 systemd[1]: jenkins.service: Control process exited, code=exited status=1
Oct 20 13:15:31 systemd[1]: Failed to start LSB: Start Jenkins at boot time.
Oct 20 13:15:31 systemd[1]: jenkins.service: Unit entered failed state.
Oct 20 13:15:31 systemd[1]: jenkins.service: Failed with result 'exit-code'.

是没有装JDK的原因,所以直接运行:

sudo apt-get install openjdk-8-jdk

安装完成后,使用java -version查看版本

执行:service jenkins start,进入web安装过程


添加新评论