• 安装Jenkins提示jenkins.service


    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,再次安装就正常了

  • 相关阅读:
    Spring Boot启动命令参数详解及源码分析
    面试题-关于Java线程池一篇文章就够了
    Spring Boot中@ConditionalOnProperty使用详解
    Spring Boot通过ImportBeanDefinitionRegistrar动态注入Bean
    Spring Boot 注解之ObjectProvider源码追踪
    软件从业者不可不读的一本书
    SpringBoot之DispatcherServlet详解及源码解析
    书终于交稿了,聊聊写技术书这件事
    Python IDE:pycharm
    python安装
  • 原文地址:https://www.cnblogs.com/Roobbin/p/9817076.html
Copyright © 2020-2023  润新知