李林超博客
首页
归档
留言
友链
动态
关于
归档
留言
友链
动态
关于
首页
工具
正文
Jenkins安装
Leefs
2020-01-18 AM
2566℃
0条
# Jenkins安装 今天小编不是在踩坑就是在踩坑的路上...... ### 一、安装JDK 因为Jenkins是通过Java开发的,所以在安装Jenkins之前需要先安装JDK 本篇将比在阐述JDK的安装步骤,如果需要可以参考文章:[Linux服务器搭建JavaWEB项目(一)](https://lilinchao.com/archives/349.html) ### 二、Jenkins安装与启动 (1)下载jenkins(此处可能需要修改一下版本号) ``` wget https://pkg.jenkins.io/redhat/jenkins-2.83-1.1.noarch.rpm ``` 或将jenkins-2.83-1.1.noarch.rpm上传至服务器 (2)安装jenkins ``` rpm -ivh jenkins-2.83-1.1.noarch.rpm ``` (3)配置jenkins ``` vi /etc/sysconfig/jenkins ``` 修改用户和端口 ``` JENKINS_USER="root" JENKINS_PORT="8888" ``` (4)启动服务 ``` systemctl start jenkins ps -ef | grep jenkins ``` **此时报如下错误** ```visual basic [root@localhost ~]# systemctl start jenkins Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details. [root@localhost ~]# systemctl status jenkins.service ● jenkins.service - LSB: Jenkins Automation Server Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled) Active: failed (Result: exit-code) since Sun 2020-01-12 03:20:43 EST; 1min 1s ago Docs: man:systemd-sysv-generator(8) Process: 5111 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=1/FAILURE) Jan 12 03:20:43 localhost systemd[1]: Starting LSB: Jenkins Automation Server... Jan 12 03:20:43 localhost runuser[5116]: pam_unix(runuser:session): session opened for user root by (uid=0) Jan 12 03:20:43 localhost jenkins[5111]: Starting Jenkins bash: /usr/bin/java: No such file or directory Jan 12 03:20:43 localhost systemd[1]: jenkins.service: control process exited, code=exited status=1 Jan 12 03:20:43 localhost jenkins[5111]: [FAILED] Jan 12 03:20:43 localhost systemd[1]: Failed to start LSB: Jenkins Automation Server. Jan 12 03:20:43 localhost systemd[1]: Unit jenkins.service entered failed state. Jan 12 03:20:43 localhost systemd[1]: jenkins.service failed. ``` 上方报错的大致意思是java路径找不到 ``` Jan 12 03:20:43 localhost jenkins[5111]: Starting Jenkins bash: /usr/bin/java: No such file or directory ``` 执行如下命令查看Java安装路径 ``` [root@localhost bin]# whereis java java: /home/user/java/jdk1.8.0_181/bin/java ``` 执行命令 ``` [root@localhost bin]# vim /etc/rc.d/init.d/jenkins ``` 在candidates="”最后一个引号前加上Java安装路径 ![Jenkis安装01.png][1] 重新启动Jenkins ``` systemctl start jenkins ``` 此时提醒如下警告信息 ``` [root@localhost bin]# systemctl restart jenkins Warning: jenkins.service changed on disk. Run 'systemctl daemon-reload' to reload units. ``` 按照提示执行systemctl daemon-reload就可以了 (5)访问链接 http://192.168.102.144:8888/ 从/var/lib/jenkins/secrets/initialAdminPassword中获取初始密码串 ![Jenkis安装02.png][2] 执行如下命令 ``` [root@localhost ~]# cat /var/lib/jenkins/secrets/initialAdminPassword 11aa400dd80d4e30a1f84ab6716a3de3 ``` (6)安装插件 ![Jenkis安装03.png][3] **注意** 如果安装完成后无法访问的可以试着开启888端口的防火墙 ``` firewall-cmd --zone=public --add-port=8888/tcp --permanent firewall-cmd --reload ``` 或者关闭防火墙 ``` [root@localhost ~]# firewall-cmd --state #查看防火墙状态 running [root@localhost ~]# systemctl stop firewalld.service #关闭防火墙 [root@localhost ~]# firewall-cmd --state not running ``` [1]: https://lilinchao.com/usr/uploads/2020/01/3518905373.png [2]: https://lilinchao.com/usr/uploads/2020/01/1158320890.png [3]: https://lilinchao.com/usr/uploads/2020/01/2536311310.png
标签:
Linux
,
CentOS
,
Jenkins
非特殊说明,本博所有文章均为博主原创。
如若转载,请注明出处:
https://lilinchao.com/archives/440.html
上一篇
基于SpringBoot的文件上传和下载
下一篇
容器深入研究--SortedMap和LinkedHashMap
评论已关闭
栏目分类
随笔
2
Java
326
大数据
229
工具
31
其它
25
GO
47
NLP
2
标签云
数据结构
ajax
DataX
Java工具类
FileBeat
Ubuntu
HDFS
SpringBoot
Spark SQL
SpringCloudAlibaba
前端
Yarn
数据结构和算法
Kafka
Docker
Hadoop
GET和POST
nginx
Shiro
Spark
队列
人工智能
Livy
Spark Streaming
FastDFS
随笔
Golang
MyBatis
JavaWeb
Spark Core
友情链接
申请
范明明
庄严博客
Mx
陶小桃Blog
虫洞
评论已关闭