Jenkins的安装、部署、启动(完整教程)
测试环境
- Linux系统 Centos 7
安装步骤:
1、安装jdk
我安装的是jdk8,此处就不多说了,自己百度哈,很简单
2、安装jenkins
首先依次执行如下三个命令:
2.1、导入镜像:
[root@centos7 ~]# sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
--2019-12-24 17:59:44-- https://pkg.jenkins.io/redhat-stable/jenkins.repo
Resolving pkg.jenkins.io (pkg.jenkins.io)... 52.202.51.185
Connecting to pkg.jenkins.io (pkg.jenkins.io)|52.202.51.185|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 85
Saving to: ‘/etc/yum.repos.d/jenkins.repo’
100%[=====================================================================================================================================================>] 85 --.-K/s in 0s
2019-12-24 18:00:47 (17.4 MB/s) - ‘/etc/yum.repos.d/jenkins.repo’ saved [85/85]
2.2、导入公钥
[root@centos7 ~]# sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
2.3、安装jenkins:
[root@centos7 ~]# yum install jenkins
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package jenkins.noarch 0:2.204.1-1.1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================
Installing:
jenkins noarch 2.204.1-1.1 jenkins 60 M
Transaction Summary
===============================================================================================================================================================================================
Install 1 Package
Total download size: 60 M
Installed size: 61 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
jenkins-2.204.1-1.1.noarch.rpm FAILED
http://pkg.jenkins.io/redhat-stable/jenkins-2.204.1-1.1.noarch.rpm: [Errno 12] Timeout on http://pkg.jenkins.io/redhat-stable/jenkins-2.204.1-1.1.noarch.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
Trying other mirror.
jenkins-2.204.1-1.1.noarch.rpm FAILED
http://pkg.jenkins.io/redhat-stable/jenkins-2.204.1-1.1.noarch.rpm: [Errno 12] Timeout on http://pkg.jenkins.io/redhat-stable/jenkins-2.204.1-1.1.noarch.rpm: (28, 'Connection timed out after 30001 milliseconds')
Trying other mirror.
jenkins-2.204.1-1.1.noarch.rpm | 60 MB 00:04:26
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows:
authconfig-6.2.8-30.el7.x86_64 has missing requires of newt-python
Installing : jenkins-2.204.1-1.1.noarch 1/1
Verifying : jenkins-2.204.1-1.1.noarch 1/1
Installed:
jenkins.noarch 0:2.204.1-1.1
Complete!
2.4、修改配置文件
[root@centos7 ~]# vi /etc/sysconfig/jenkins
修改这部分:
## Default: 8080
## ServiceRestart: jenkins
#
# Port Jenkins is listening on.
# Set to -1 to disable
#
JENKINS_PORT="8091"
## Type: string
## Default: ""
## ServiceRestart: jenkins
2.5、启动jenkins
[root@centos7 ~]# 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.
2.6、查看jenkins的启动状态
[root@centos7 ~]# systemctl status jenkins
● jenkins.service - LSB: Jenkins Automation Server
Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2019-12-24 18:12:05 CST; 11s ago
Docs: man:systemd-sysv-generator(8)
Process: 23175 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=1/FAILURE)
Dec 24 18:12:05 centos7 systemd[1]: Starting LSB: Jenkins Automation Server...
Dec 24 18:12:05 centos7 runuser[23180]: pam_unix(runuser:session): session opened for user jenkins by (uid=0)
Dec 24 18:12:05 centos7 jenkins[23175]: Starting Jenkins bash: /usr/bin/java: Is a directory
Dec 24 18:12:05 centos7 systemd[1]: jenkins.service: control process exited, code=exited status=1
Dec 24 18:12:05 centos7 jenkins[23175]: [FAILED]
Dec 24 18:12:05 centos7 systemd[1]: Failed to start LSB: Jenkins Automation Server.
Dec 24 18:12:05 centos7 systemd[1]: Unit jenkins.service entered failed state.
Dec 24 18:12:05 centos7 systemd[1]: jenkins.service failed.
出现这种情况的解决办法是:
修改 jenkins 的配置文件中使用的 jdk 路径
[root@centos7 ~]# echo $JAVA_HOME
/usr/java/jdk1.8.0_191
[root@centos7 ~]# vi /etc/init.d/jenkins
注意:这里echo $JAVA_HOME 出来的路径,后面一定跟启动路径(/bin/java)
2.7、重启并查看 jenkins 状态
systemctl daemon-reload
systemctl restart jenkins
我的 jenkins 启动后是这样子的:
[root@centos7 docker]# systemctl daemon-reload
[root@centos7 docker]# systemctl restart jenkins
[root@centos7 docker]# systemctl status jenkins
● jenkins.service - LSB: Jenkins Automation Server
Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled)
Active: active (running) since Tue 2019-12-24 18:16:08 CST; 12s ago
Docs: man:systemd-sysv-generator(8)
Process: 23787 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/jenkins.service
└─23832 /software/jdk1.8.0_191/bin/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/var/lib/jenkins -jar /usr/lib/jenkins/jenkins.war --logfile=/v...
Dec 24 18:16:02 centos7 systemd[1]: Starting LSB: Jenkins Automation Server...
Dec 24 18:16:02 centos7 runuser[23792]: pam_unix(runuser:session): session opened for user jenkins by (uid=0)
Dec 24 18:16:08 centos7 runuser[23792]: pam_unix(runuser:session): session closed for user jenkins
Dec 24 18:16:08 centos7 systemd[1]: Started LSB: Jenkins Automation Server.
Dec 24 18:16:08 centos7 jenkins[23787]: Starting Jenkins [ OK ]
[root@centos7 ~]# lsof -i:8091
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 23832 jenkins 160u IPv4 11605726 0t0 TCP *:jamlink (LISTEN)
好了,此时已经表示 Jenkins 顺利安装并启动成功了!
2.8、访问浏览器: http://localhost:8091/ 出现如下提示:
Please wait while Jenkins is getting ready to work...
解决办法:
进入jenkins的工作目录(/var/lib/jenkins/),打开 hudson.model.UpdateCenter.xml
把 http://updates.jenkins-ci.org/update-center.json 改成如下三个地址之一均可:
# 修改更新地址(到其中一种即可):
http://mirror.xmission.com/jenkins/updates/update-center.json
http://updates.jenkins.io/update-center.json
https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json
http://mirror.esuni.jp/jenkins/updates/update-center.json
然后重启并查看 jenkins 状态:
[root@centos7 ~]# vi hudson.model.UpdateCenter.xml
[root@centos7 ~]# systemctl daemon-reload
[root@centos7 ~]# systemctl restart jenkins
[root@centos7 ~]# systemctl status jenkins
查看密码:
cat /var/lib/jenkins/secrets/initialAdminPassword
然后直接选推荐安装的插件,或者直接下一步就完事儿了!
2.9、设置jenkin语言为中文
需要的话,还可以设置语言为中文
- 1、系统管理->插件管理->可用插件:安装Locale Plugin插件(https://wiki.jenkins.io/display/JENKINS/Locale+Plugin),重启;
- 2、如果没有搜索到这个插件,就直接官网(https://github.com/jenkinsci/locale-plugin或者https://updates.jenkins.io/download/plugins/locale/)下载安装:
系统管理->插件管理->高级->上传插件,安装重启; - 3、系统管理->系统管理->locale language->输入zh_CN
最新版本的jenkins,即使设置了zh_CN也有可能是中英文混搭风, 因为最新版本没有针对所有内容都翻译成中文。
卸载
[root@centos7 ~]# rpm -e jenkins
warning: /etc/sysconfig/jenkins saved as /etc/sysconfig/jenkins.rpmsave
warning: /etc/init.d/jenkins saved as /etc/init.d/jenkins.rpmsave
[root@centos7 ~]# systemctl stop jenkins
Failed to stop jenkins.service: Access denied
See system logs and 'systemctl status jenkins.service' for details.
Failed to get load state of jenkins.service: Access denied
[root@centos7 ~]# rpm -ql jenkins
package jenkins is not installed
[root@centos7 ~]# find / -iname jenkins | xargs -n 1000 rm -rf
[root@centos7 ~]#
Jenkins的安装、部署、启动(完整教程)的更多相关文章
- 【阿里云产品公测】阿里云ACE部署通用完整教程及评测
[阿里云产品公测]阿里云ACE部署通用完整教程及评测 作者:阿里云用户bailimei ACE应该是目前在公测的服务中应用最广泛的一项服务.在公测云引擎ACE前曾使用过新浪SAE,而ACE给我的最初印 ...
- redis的安装部署启动停止<17.3.21已更新>
--------------------------------------------------------- 启动redis时使用下面两条命令: redis-server /etc/redis. ...
- Jenkins自动化部署最完整教程
1.概述 Jenkins 是一个可扩展的持续集成引擎.主要用于持续.自动地构建/测试软件项目.监控一些定时执行的任务.Jenkins用Java语言编写,可在Tomcat等流行的servlet容器中运行 ...
- Jenkins 的安装部署
一.Windows环境中安装Jenkins 原文:http://www.cnblogs.com/yangxia-test/p/4354328.html 在最简单的情况下,Jenkins 只需要两个步骤 ...
- Kettle-6.1安装部署及使用教程
一.Kettle概念 Kettle是一款国外开源的ETL工具,纯java编写,可以在Window.Linux.Unix上运行,绿色无需安装,数据抽取高效稳定. Kettle 中文名称叫水壶,该项目的主 ...
- Jenkins的安装、启动和配置
一.Jenkins的安装 1.前提条件:已经成功安装了JDK,因为jenkins是一款基于Java的持续集成工具. 2.准备工具:下载一个jenkins的war包. 3.启动方法:如把jenkins. ...
- Docker下Jenkins的安装部署、更新
一.下载Jenkins镜像 docker pull jenkins/jenkins 二.创建挂载文件 mkdir /srv/jenkins chown -R : /srv/jenkins 三.启动Do ...
- Docker部署LNMP完整教程
在Docker中部署LNMP环境可以分为以下几个步骤: 安装Docker 创建镜像 创建Dockerfile build Docerfile 复制/修改配置文件 运行镜像,并映射端口 为了方便分布式部 ...
- Jrebel热部署配置完整教程(IntelliJ IDEA、Jrebel、spring boot、springboot、eclipse、Tomcat)
标签:IntelliJ IDEA.Jrebel.spring boot.springboot.eclipse.Tomcat1.安装插件并激活插件安装参考:http://blog.csdn.net/u0 ...
随机推荐
- restful风格接口和spring的运用
Restful风格的API是一种软件架构风格,设计风格而不是标准,只是提供了一组设计原则和约束条件.它主要用于客户端和服务器交互类的软件.基于这个风格设计的软件可以更简洁,更有层次,更易于实现缓存等机 ...
- 使用Docker搭建Cloudera Hadoop 环境搭建
单节点 单节点:https://hub.docker.com/r/cloudera/quickstart/ 相关命令 docker pull cloudera/quickstart:latest do ...
- JS中数据结构之栈
1.栈的基本介绍 栈是一种高效的数据结构,因为数据只能在栈顶添加或删除,所以这样的操作很快,而且容易实现. 栈是一种特殊的列表,栈内的元素只能通过列表的一端访问,这一端称为栈顶.栈被称为一种后入先出( ...
- java使用开源类库Tesseract实现图片识别
Tesseract-OCR支持中文识别,并且开源和提供全套的训练工具,是快速低成本开发的首选. Tess4J则是Tesseract在Java PC上的应用 Tesseract的OCR引擎最先由HP实验 ...
- Ant Design Pro (中后台系统)教程
一.概念:https://pro.ant.design/docs/getting-started-cn(官方网站) 1.Ant Design Pro 是什么: https://www.cnblogs ...
- codeforces 111A/112C Petya and Inequiations
题目:Petya and Inequiations传送门: http://codeforces.com/problemset/problem/111/A http://codeforces.com/p ...
- [CSP-S模拟测试]:赤壁情(DP)
前赤壁赋 壬戌之秋,七月既望,苏子与客泛舟游于赤壁之下.清风徐来,水波不兴.举酒属客,诵明月之诗,歌窈窕之章.少焉,月出于东山之上,徘徊于斗牛之间.白露横江,水光接天.纵一苇之所如,凌万顷之茫然.浩浩 ...
- 尽量用类型化的常量替代预处理器的 #DEFINE 方法
类型化常量 (TYPED CONSTANTS) #define ANIMATION_DURATION 0.3 这是一个预处理器指令,当编译器在代码中发现有 ANIMATION_DURATION 时,就 ...
- C# foreach和for比较
foreach优点: 1.语句更简洁 2.不需要强制类型转换(比如输出的时候要进行一下乘运算) 3.多维数组遍历只需一行代码 4.不用对索引进行检查 缺点: 1.不能对数据进行修改 参考:https: ...
- winform防止输入法对扫码的干扰
把textbox的imemode的属性设为disable,就强制只能录入英文和半角符号,防止了中文输入法等的干扰. 参考:https://blog.csdn.net/jhycjhyc/article/ ...