在阿里云linux系统下安装jenkins的deb版本时遇到的问题

作者: admin 分类: 环境搭建 发布时间: 2018-09-10 14:35  阅读: 610 views

从官网上下载下来jenkins工具deb版本,上传到阿里云服务器后,准备解压安装配置,但是报错如下

搜索之后说是依赖问题,按照教程执行 apt-get -f install

具体文本如下:

root@iZ23xocuk3vZ:/home/growup# apt-get -f install

Reading package lists… Done

Building dependency tree

Reading state information… Done

Correcting dependencies… Done

The following extra packages will be installed:

daemon

The following NEW packages will be installed:

daemon

0 upgraded, 1 newly installed, 0 to remove and 106 not upgraded.

1 not fully installed or removed.

Need to get 98.2 kB of archives.

After this operation, 287 kB of additional disk space will be used.

Do you want to continue? [Y/n] y

Get:1 http://mirrors.aliyun.com/ubuntu/ trusty/universe daemon amd64 0.6.4-1 [98.2 kB]

Fetched 98.2 kB in 0s (874 kB/s)

Selecting previously unselected package daemon.

(Reading database … 78844 files and directories currently installed.)

Preparing to unpack …/daemon_0.6.4-1_amd64.deb …

Unpacking daemon (0.6.4-1) …

Processing triggers for man-db (2.6.7.1-1ubuntu1) …

Setting up daemon (0.6.4-1) …

Setting up jenkins (2.107.3) …

ERROR: No Java executable found in current PATH: /bin:/usr/bin:/sbin:/usr/sbin

If you actually have java installed on the system make sure the executable is in the aforementioned path and that ‘type -p java’ returns the java executable path

invoke-rc.d: initscript jenkins, action “start” failed.

dpkg: error processing package jenkins (–configure):

subprocess installed post-installation script returned error exit status 1

Processing triggers for ureadahead (0.100.0-16) …

Errors were encountered while processing:

jenkins

E: Sub-process /usr/bin/dpkg returned an error code (1)

这个是说明没有jdk环境,安装jenkins之前需要java环境,我上传了jdk之后还没有配置,先配置下。

在/etc/profile文件中增加

export JAVA_HOME=/home/growup/jdk

export PATH=$PATH:/alidata/server/mysql/bin:/alidata/server/nginx/sbin:/alidata/server/php/sbin:/alidata/server/php/bin:$JAVA_HOME/bin

export CLASSPATH=.:$JAVA_HOME/lib/rt.jar:$JAVA_HOME/lib/tools.jar

后,检查环境变量如下:

root@iZ23xocuk3vZ:/home/growup# java -version

The program ‘java’ can be found in the following packages:

* default-jre

* gcj-4.8-jre-headless

* openjdk-7-jre-headless

* gcj-4.6-jre-headless

* openjdk-6-jre-headless

Try: apt-get install <selected package>

这是个异常信息,后经查证,原来是修改配置之后,linxu下资源文件需要重新加载下。

执行 source profile之后,jdk配置成功,如下

 

但执行apt-get -f install的时候还是有错误

If you actually have java installed on the system make sure the executable is in the aforementioned path and that ‘type -p java’ returns the java executable path

invoke-rc.d: initscript jenkins, action “start” failed.

type -p java 可以看到有java的路径,但是jetkins在启动的时候还会报找不到java的错误,也就是系统已经配置好java路径了,但是jetkins找不到。

打开etc/init.d/jenkins文件,可以看到头部指定的path路径没有包含java_home。应该是在第一次安装的时候,系统读取了jdk未安装时的路径。修改配置再试下

配置修改之后,终于启动成功了,截图如下:

文本如下:

root@iZ23xocuk3vZ:/home/growup# apt-get -f install

Reading package lists… Done

Building dependency tree

Reading state information… Done

E: The package jenkins needs to be reinstalled, but I can’t find an archive for it.

root@iZ23xocuk3vZ:/home/growup# dpkg -i jenkins_2.107.3_all.deb

(Reading database … 78852 files and directories currently installed.)

Preparing to unpack jenkins_2.107.3_all.deb …

Correct java version found

* Stopping Jenkins Automation Server jenkins Invalid –pidfile argument: ‘/var/run/jenkins/jenkins.pid’ (Parent directory does not exist)

usage: daemon [options] [–] [cmd arg…]

options:

 

-h, –help – Print a help message then exit

-V, –version – Print a version message then exit

-v, –verbose[=level] – Set the verbosity level

-d, –debug[=level] – Set the debugging level

 

-C, –config=path – Specify the configuration file

-N, –noconfig – Bypass the system configuration file

-n, –name=name – Guarantee a single named instance

-X, –command=cmd – Specify the client command as an option

-P, –pidfiles=/dir – Override standard pidfile location

-F, –pidfile=/path – Override standard pidfile name and location

 

-u, –user=user[:group] – Run the client as user[:group]

-R, –chroot=path – Run the client with path as root

-D, –chdir=path – Run the client in directory path

-m, –umask=umask – Run the client with the given umask

-e, –env=”var=val” – Set a client environment variable

-i, –inherit – Inherit environment variables

-U, –unsafe – Allow execution of unsafe executable

-S, –safe – Deny execution of unsafe executable

-c, –core – Allow core file generation

 

-r, –respawn – Respawn the client when it terminates

-a, –acceptable=# – Minimum acceptable client duration (seconds)

-A, –attempts=# – Respawn # times on error before delay

-L, –delay=# – Delay between spawn attempt bursts (seconds)

-M, –limit=# – Maximum number of spawn attempt bursts

–idiot – Idiot mode (trust root with the above)

 

-f, –foreground – Run the client in the foreground

-p, –pty[=noecho] – Allocate a pseudo terminal for the client

 

-l, –errlog=spec – Send daemon’s error output to syslog or file

-b, –dbglog=spec – Send daemon’s debug output to syslog or file

-o, –output=spec – Send client’s output to syslog or file

-O, –stdout=spec – Send client’s stdout to syslog or file

-E, –stderr=spec – Send client’s stderr to syslog or file

 

–running – Check if a named daemon is running

–restart – Restart a named daemon client

–stop – Terminate a named daemon process

[ OK ]

Unpacking jenkins (2.107.3) over (2.107.3) …

Setting up jenkins (2.107.3) …

Correct java version found

* Starting Jenkins Automation Server jenkins [ OK ]

Processing triggers for ureadahead (0.100.0-16) …

root@iZ23xocuk3vZ:/home/growup#

 

折腾到这里,感觉用war包方式应该比较方便,本身是一个项目只要在tomcat下部署启动就好了,deb算是在linux系统中植入一个服务。

最终的访问效果。

使用参考地址:

https://www.cnblogs.com/jwrwst/p/6520114.html


   原创文章,转载请标明本文链接: 在阿里云linux系统下安装jenkins的deb版本时遇到的问题

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!

发表评论

电子邮件地址不会被公开。 必填项已用*标注