前端自动部署实践——Jenkins的安装与配置

说起来,Jenkins其实和Linux自带的crontab有点像,都是满足特定条件后执行脚本。但是Jenkins触发任务的形式更加灵活,并不局限于定时,所以还是很有用的。

安装

按照惯例,遇到Linux的问题先说环境:系统是Ubuntu16.04,已经提前安装了JDK 1.8,没有用docker,并且已经打开了防火墙。有时候安装好了但访问不了,就是因为防火墙没打开。

其实安装流程很简单,按照官网的流程走一遍就行:

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

如果这么安装能成功,那最好了。但是往往会遇到各种问题。我遇到的报错信息是这样:

Aug 06 22:33:57 iZuf699cacb5hvp8me6ft6Z systemd[1]: Starting LSB: Start Jenkins at boot time...
Aug 06 22:33:57 iZuf699cacb5hvp8me6ft6Z jenkins[24569]: ERROR: No Java executable found in current PATH: /bin:/usr/bin:/sbin:/usr/sbin
Aug 06 22:33:57 iZuf699cacb5hvp8me6ft6Z jenkins[24569]: If you actually have java installed on the system make sure the executable is in the aforementioned path and that 'type -p java' re
Aug 06 22:33:57 iZuf699cacb5hvp8me6ft6Z systemd[1]: jenkins.service: Control process exited, code=exited status=1
Aug 06 22:33:57 iZuf699cacb5hvp8me6ft6Z systemd[1]: Failed to start LSB: Start Jenkins at boot time.
Aug 06 22:33:57 iZuf699cacb5hvp8me6ft6Z systemd[1]: jenkins.service: Unit entered failed state.
Aug 06 22:33:57 iZuf699cacb5hvp8me6ft6Z systemd[1]: jenkins.service: Failed with result 'exit-code'.

一开始我看到Start Jenkins at boot time,以为是端口冲突,因为这个报错是网络问题,而且Jenkins的默认端口是8080,和服务器上已经有的Tomcat冲突了。所以修改Jenkins的配置文件,把端口改成8085:

# /etc/default/jenkins
HTTP_PORT=8085
# /etc/init.d/je
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值