当前位置:网站首页>[One step in place] Jenkins installation, deployment, startup (complete tutorial)
[One step in place] Jenkins installation, deployment, startup (complete tutorial)
2022-08-04 04:58:00 【Soft Test Small Watermelon】
一、测试环境
- Linux系统 Centos 7
二、安装步骤:
1、安装jdk
我安装的是jdk8,此处就不多说了,自己百度哈,很简单
2、安装jenkins
First of all, in turn, perform the following three commands:
2.1、导入镜像:
[[email protected] ~]# 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、导入公钥
[[email protected] ~]# sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
2.3、安装jenkins:
[[email protected] ~]# 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、修改配置文件
[[email protected] ~]# 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
[[email protected] ~]# 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的启动状态
[[email protected] ~]# 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.
Appear this kind of circumstance of the solution is:
修改 jenkins 的配置文件中使用的 jdk 路径
[[email protected] ~]# echo $JAVA_HOME
/usr/java/jdk1.8.0_191
[[email protected] ~]# vi /etc/init.d/jenkins
注意:这里echo $JAVA_HOME 出来的路径,Must have to start the path behind(/bin/java)
2.7、重启并查看 jenkins 状态
systemctl daemon-reload
systemctl restart jenkins
我的 jenkins After start-up is like this:
[[email protected] docker]# systemctl daemon-reload
[[email protected] docker]# systemctl restart jenkins
[[email protected] 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 ]
[[email protected] ~]# lsof -i:8091
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 23832 jenkins 160u IPv4 11605726 0t0 TCP *:jamlink (LISTEN)
好了,Has said that at this time Jenkins Successfully installed and started a success!
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 Into one of the following three addresses can be:
# Modify the update address(One can):
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
And then restart and see jenkins 状态:
[[email protected] ~]# vi hudson.model.UpdateCenter.xml
[[email protected] ~]# systemctl daemon-reload
[[email protected] ~]# systemctl restart jenkins
[[email protected] ~]# systemctl status jenkins
查看密码:
cat /var/lib/jenkins/secrets/initialAdminPassword
And then directly choose recommend installing plug-ins,Or directly to the next step is the thing!
2.9、设置jenkin语言为中文
需要的话,Also you can set the language to Chinese
- 1、系统管理->插件管理->可用插件:安装Locale Plugin插件(https://wiki.jenkins.io/display/JENKINS/Locale+Plugin),重启;
- 2、If there is no search to the plugin,Website directly(https://github.com/jenkinsci/locale-plugin或者https://updates.jenkins.io/download/plugins/locale/)下载安装:
系统管理->插件管理->高级->上传插件,安装重启; - 3、系统管理->系统管理->locale language->输入zh_CN
最新版本的jenkins,即使设置了zh_CNIt could also be in both Chinese and English to mix the wind, Because there is no for all the latest version of the content is translated into Chinese.
三、卸载
[[email protected] ~]# 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
[[email protected] ~]# 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
[[email protected] ~]# rpm -ql jenkins
package jenkins is not installed
[[email protected] ~]# find / -iname jenkins | xargs -n 1000 rm -rf
[[email protected] ~]#
边栏推荐
- How to systematically plan and learn software testing?
- Chapter 5 C programming expert thinking 5.4 alert Interpositioning of links
- 7-1 LVS+NAT 负载均衡群集,NAT模式部署
- 3000 words, is take you understand machine learning!
- 2023年PMP考试会用新版教材吗?回复来了!
- 2003. 每棵子树内缺失的最小基因值 DFS
- 10 Convolutional Neural Networks for Deep Learning 3
- 8. Haproxy builds a web cluster
- For Qixi Festival, I made a confession envelope with code
- [Skill] Using Sentinel to achieve priority processing of requests
猜你喜欢
Converts XML tags to TXT format (voc conversion for yolo convenient training)
深度学习21天——卷积神经网络(CNN):实现mnist手写数字识别(第1天)
2022年软件测试——精选金融银行面试真题
How to simplify the automation of modern e-procurement?
深度学习21天——准备(环境配置)
PL/SQL Some Advanced Fundamental
[C language advanced] program environment and preprocessing
el-Select 选择器 底部固定
42. 接雨水
文件系统的简单操作
随机推荐
C Expert Programming Chapter 4 The Shocking Fact: Arrays and Pointers Are Not the Same 4.3 What is a Declaration and What is a Definition
使用Patroni回调脚本绑定VIP的坑
System design. How to design a spike system (full version transfer)
How to dynamically add script dependent scripts
The Shell function
go module的介绍与应用
Hangdian Multi-School-Slipper- (tree map conversion + virtual point mapping)
Bolb analysis of image processing (1)
Turn: Management is the love of possibility, and managers must have the courage to break into the unknown
【流程图】
深度学习之 10 卷积神经网络3
图像处理之Bolb分析(一)
Cache pool of unity framework
[SemiDrive source code analysis] [MailBox inter-core communication] 47 - Analysis of RPMSG_IPCC_RPC mode limit size of single transmission and limit bandwidth test
【评价类模型】Topsis法(优劣解距离法)
mysql索引笔记
深度学习21天——卷积神经网络(CNN):实现mnist手写数字识别(第1天)
C专家编程 第5章 对链接的思考 5.3 函数库链接的5个特殊秘密
42. 接雨水
Tensors - Application Cases