安裝Jenkins提示jenkins.service - LSB: Start Jenkins at boot time


JAVA8安裝

tar xf jdk-8u151-linux-x64.tar.gz
mv jdk1.8.0_151/ ../
vim /etc/profile.d/jdk.sh #添加如下內容
export JAVA_HOME=/usr/local/jdk1.8.0_151
export JAVA_BIN=$JAVA_HOME/bin
export PATH=$JAVA_BIN:$PATH
export CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

Jenkins安裝

wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add - #添加key值
sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' #添加apt源
apt-get update #獲取最新版本
apt-get install jenkins #安裝Jenkins

錯誤提示

root@newings:/usr/share# apt-get install jenkins -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  jenkins
0 upgraded, 1 newly installed, 0 to remove and 248 not upgraded.
Need to get 0 B/75.5 MB of archives.
After this operation, 75.8 MB of additional disk space will be used.
Selecting previously unselected package jenkins.
(Reading database ... 180088 files and directories currently installed.)
Preparing to unpack .../jenkins_2.138.2_all.deb ...
Unpacking jenkins (2.138.2) ...
Processing triggers for systemd (229-4ubuntu21.1) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up jenkins (2.138.2) ...
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 五 2018-10-19 15:54:47 CST; 3ms ago
     Docs: man:systemd-sysv-generator(8)
  Process: 43402 ExecStart=/etc/init.d/jenkins start (code=exited, status=1/FAILURE)

10月 19 15:54:47 newings jenkins[43402]:                   see also, -agentlib:jdwp=help and -agentlib:hprof=help
10月 19 15:54:47 newings jenkins[43402]:     -agentpath:<pathname>[=<options>]
10月 19 15:54:47 newings jenkins[43402]:                   load native agent library by full pathname
10月 19 15:54:47 newings jenkins[43402]:     -javaagent:<jarpath>[=<options>]
10月 19 15:54:47 newings jenkins[43402]:                   load Java programming language agent, see java.lang.instrument
10月 19 15:54:47 newings jenkins[43402]:     -splash:<imagepath>
10月 19 15:54:47 newings jenkins[43402]:                   show splash screen with specified image
10月 19 15:54:47 newings jenkins[43402]: See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
10月 19 15:54:47 newings jenkins[43402]: ERROR: No Java executable found in current PATH: /bin:/usr/bin:/sbin:/usr/sbin
10月 19 15:54:47 newings jenkins[43402]: If you actually have java installed on the system make sure the executable is in the aforementioned path and that 'type -p java' ret...cutable path
Hint: Some lines were ellipsized, use -l to show in full.
dpkg: error processing package jenkins (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 jenkins
E: Sub-process /usr/bin/dpkg returned an error code (1)

該錯誤主要原因就是找不到java的bin文件

10月 19 15:54:47 newings jenkins[43402]: ERROR: No Java executable found in current PATH: /bin:/usr/bin:/sbin:/usr/sbin

部分網上資料是這樣操作的,編輯vim /etc/init.d/jenkins插入如下內容

vim /etc/init.d/jenkins
/usr/local/jdk1.8.0_151/bin/java

這樣的方法試過了,沒起任何作用,不知道是我的插入的地方不對還是怎么了。反正錯誤依舊還在。

這樣不行的話,就只能試試軟連接看看能不能用

ln -s /usr/jdk1.8.0_131/bin/java /usr/bin/java

然后卸載Jenkins,再次安裝就正常了

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM