阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

CentOS7下Jenkins 服务器的安装

205次阅读
没有评论

共计 5427 个字符,预计需要花费 14 分钟才能阅读完成。

安装环境:CentOS 7

安装方式 yum 安装

安装 jenkins 需要首先配置 jdk

配置 yum 源

wget -O /etc/yum.repos.d/jenkins.repo http://jenkins-ci.org/RedHat/jenkins.repo

导入公钥

rpm –import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key

安装

yum install jenkins -y

查看安装后生成的文件

/usr/lib/jenkins/jenkins.war ## jenkins 安装目录,WAR 包会放在这里

/etc/sysconfig/jenkins  ## 配置文件

## Path:        Development/Jenkins
## Description: Jenkins Continuous Integration Server
## Type:        string
## Default:    “/var/lib/jenkins”
## ServiceRestart: jenkins
#
# Directory where Jenkins store its configuration and working
# files (checkouts, build reports, artifacts, …).
#
JENKINS_HOME=”/var/lib/jenkins”    ###jenkins 安装目录,WAR 包会放在这里
 
## Type:        string
## Default:    “”
## ServiceRestart: jenkins
#
# Java executable to run Jenkins
# When left empty, we’ll try to find the suitable Java.
#
JENKINS_JAVA_CMD=””
 
## Type:        string
## Default:    “jenkins”
## ServiceRestart: jenkins
#
# Unix user account that runs the Jenkins daemon
# Be careful when you change this, as you need to update
# permissions of $JENKINS_HOME and /var/log/jenkins.
#
JENKINS_USER=”jenkins”
 
## Type:        string
## Default: “false”
## ServiceRestart: jenkins
#
# Whether to skip potentially long-running chown at the
# $JENKINS_HOME location. Do not enable this, “true”, unless
# you know what you’re doing. See JENKINS-23273.
#
#JENKINS_INSTALL_SKIP_CHOWN=”false”
 
## Type: string
## Default:    “-Djava.awt.headless=true”
## ServiceRestart: jenkins
#
# Options to pass to java when running Jenkins.
#
JENKINS_JAVA_OPTIONS=”-Djava.awt.headless=true”
 
## Type:        integer(0:65535)
## Default:    8080
## ServiceRestart: jenkins
#
# Port Jenkins is listening on.
# Set to -1 to disable
#
JENKINS_PORT=”8080″
 
## Type:        string
## Default:    “”
## ServiceRestart: jenkins
#
# IP address Jenkins listens on for HTTP requests.
# Default is all interfaces (0.0.0.0).
#
JENKINS_LISTEN_ADDRESS=””
 
## Type:        integer(0:65535)
## Default:    “”
## ServiceRestart: jenkins
#
# HTTPS port Jenkins is listening on.
# Default is disabled.
#
JENKINS_HTTPS_PORT=””
 
## Type:        string
## Default:    “”
## ServiceRestart: jenkins
#
# Path to the keystore in JKS format (as created by the JDK ‘keytool’).
# Default is disabled.
#
JENKINS_HTTPS_KEYSTORE=””
 
## Type:        string
## Default:    “”
## ServiceRestart: jenkins
#
# Password to access the keystore defined in JENKINS_HTTPS_KEYSTORE.
# Default is disabled.
#
JENKINS_HTTPS_KEYSTORE_PASSWORD=””
 
## Type:        string
## Default:    “”
## ServiceRestart: jenkins
#
# IP address Jenkins listens on for HTTPS requests.
# Default is disabled.
#
JENKINS_HTTPS_LISTEN_ADDRESS=””
 
 
## Type:        integer(1:9)
## Default:    5
## ServiceRestart: jenkins
#
# Debug level for logs — the higher the value, the more verbose.
# 5 is INFO.
#
JENKINS_DEBUG_LEVEL=”5″
 
## Type:        yesno
## Default:    no
## ServiceRestart: jenkins
#
# Whether to enable access logging or not.
#
JENKINS_ENABLE_ACCESS_LOG=”no”
 
## Type:        integer
## Default:    100
## ServiceRestart: jenkins
#
# Maximum number of HTTP worker threads.
#
JENKINS_HANDLER_MAX=”100″
 
## Type:        integer
## Default:    20
## ServiceRestart: jenkins
#
# Maximum number of idle HTTP worker threads.
#
JENKINS_HANDLER_IDLE=”20″
 
## Type:        string
## Default:    “”
## ServiceRestart: jenkins
#
# Pass arbitrary arguments to Jenkins.
# Full option list: java -jar jenkins.war –help
#
JENKINS_ARGS=””

             

/var/lib/jenkins/  ## 默认的 JENKINS_HOME

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 -rw-r–r–  1 jenkins jenkins  1592 Feb 27 09:14 config.xml
-rw-r–r–  1 jenkins jenkins  159 Feb 27 09:14 hudson.model.UpdateCenter.xml
-rw-r–r–  1 jenkins jenkins  370 Feb 27 09:19 hudson.plugins.git.GitTool.xml
-rw——-  1 jenkins jenkins  1712 Feb 27 09:14 identity.key.enc
-rw-r–r–  1 jenkins jenkins    4 Feb 27 09:24 jenkins.install.InstallUtil.lastExecVersion
-rw-r–r–  1 jenkins jenkins    4 Feb 27 09:24 jenkins.install.UpgradeWizard.state
drwxr-xr-x  2 jenkins jenkins  4096 Feb 27 09:14 jobs
drwxr-xr-x  3 jenkins jenkins  4096 Feb 27 09:14 logs
-rw-r–r–  1 jenkins jenkins  907 Feb 27 09:14 nodeMonitors.xml
drwxr-xr-x  2 jenkins jenkins  4096 Feb 27 09:14 nodes
drwxr-xr-x 72 jenkins jenkins 12288 Feb 27 09:20 plugins
-rw-r–r–  1 jenkins jenkins    64 Feb 27 09:14 secret.key
-rw-r–r–  1 jenkins jenkins    0 Feb 27 09:14 secret.key.not-so-secret
drwx——  4 jenkins jenkins  4096 Feb 27 09:24 secrets
drwxr-xr-x  2 jenkins jenkins  4096 Feb 27 09:19 updates
drwxr-xr-x  2 jenkins jenkins  4096 Feb 27 09:14 userContent
drwxr-xr-x  3 jenkins jenkins  4096 Feb 27 09:24 users
drwxr-xr-x  2 jenkins jenkins  4096 Feb 27 09:19 workflow-libs

/etc/rc.d/init.d/jenkins    ## 启东脚本

               

/var/log/jenkins/jenkins.log:Jenkins  ## 日志文件

     

启动 jenkins 服务

systemctl start jenkins

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.

启动失败 查看 报错信息

 Starting LSB: Jenkins Continuous Integration Server…

Starting Jenkins bash: /usr/bin/java: No such file or directory

Feb 27 09:03:12 test-bcliunx-3 jenkins: [FAILED]

没有找到 java 命令

查看 java 命令

/opt/jdk1.7.0_51/bin/java

解决方法修改 jenkins 启动脚本

vim /etc/rc.d/init.d/jenkins

添加下面的文件

CentOS7 下 Jenkins 服务器的安装

启动 jenkis

systemctl start jenkins

web 登录测试

http://ip:8080/

根据提示输入密码

安装所需要的插件

登录成功后设置管理员密码

登录成功后界面如下所示

CentOS7 下 Jenkins 服务器的安装

局域网内利用 GitLab+Jenkins 自动生成 GitBook 并发布 (Nginx)  http://www.linuxidc.com/Linux/2016-05/131136.htm

Linux+Git+Maven+Jenkins+Neuxs 自动化编译环境搭建 http://www.linuxidc.com/Linux/2016-02/128652.htm

在 CentOS 7 上安装 Jenkins  http://www.linuxidc.com/Linux/2016-11/137548.htm

CentOS6 安装 Jenkins  http://www.linuxidc.com/Linux/2016-05/131365.htm

使用 Jenkins 配置 Git+Maven 的自动化构建 http://www.linuxidc.com/Linux/2016-02/128641.htm

Jenkins+Maven+Git 搭建持续集成和自动化部署的配置手记 http://www.linuxidc.com/Linux/2015-06/118606.htm

Jenkins 的分布式构建及部署——节点  http://www.linuxidc.com/Linux/2015-05/116903.htm

Jenkins+Gitlab+Sonar 代码检查平台搭建  http://www.linuxidc.com/Linux/2017-01/139900.htm

在 Fedora 21 上搭建 Jenkins+SonarQube 的 Maven 项目自动化测试平台  http://www.linuxidc.com/Linux/2017-02/140780.htm

Jenkins 的详细介绍 :请点这里
Jenkins 的下载地址 :请点这里

本文永久更新链接地址 :http://www.linuxidc.com/Linux/2017-02/141119.htm

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-21发表,共计5427字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中