51Testing软件测试论坛

标题: Jenkins环境搭建 [打印本页]

作者: 测试积点老人    时间: 2018-12-20 14:17
标题: Jenkins环境搭建

1,安装

    centos下:

  1. yum install jenkins
复制代码

如果没有jenkins库 需要先添加库

  1. $ wget -O /etc/yum.repos.d/jenkins.repo http://jenkins-ci.org/redhat/jenkins.repo
  2. $ rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
复制代码

2,启动

    jenkins安装好以后

  1. service jenkins start
复制代码

查看jenkins启动状态

  1. service jenkins status
复制代码

如果没有启动可能是端口占用,jenkins默认的启动端口为8080

修改启动端口:

jenkins的war包存放在/usr/lib/jenkins目录下,配置文件jenkins在/etc/sysconfig有个jenkins文件,修改端口为8888

ubuntu上该文件在 /etc/default/jenkins

  1. ## Type: integer(0:65535)

  2. ## Default: 8080

  3. ## ServiceRestart: jenkins

  4. #

  5. # Port Jenkins is listening on.

  6. # Set to -1 to disable

  7. #

  8. JENKINS_PORT="8888"
复制代码

可以看到jenkins的主目录

  1. ## Path: Development/Jenkins
  2. ## Description: Jenkins Continuous Integration Server
  3. ## Type: string
  4. ## Default: "/var/lib/jenkins"
  5. ## ServiceRestart: jenkins
  6. #
  7. # Directory where Jenkins store its configuration and working
  8. # files (checkouts, build reports, artifacts, ...).
  9. #
  10. JENKINS_HOME="/var/lib/jenkins"
复制代码

建议修改一处配置增加一个参数

  1. -Dhudson.util.ProcessTree.disable=<span class="hljs-keyword" style="box-sizing: inherit;">true</span>
复制代码

以后会用到:

  1. ## Type: string
  2. ## Default:     "-Djava.awt.headless=true"
  3. ## ServiceRestart: jenkins
  4. #
  5. # Options to pass to java when running Jenkins.
  6. #
  7. JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Dhudson.util.P
  8. rocessTree.disable=true"
复制代码

3,修改密码:

启动成功以后访问:

  1. 192.168.1.90:8888
复制代码

进入密码登陆页面:第一次进入,随机密码在配置文件中

  1. /var/lib/jenkins/secrets/initialAdminPassword
复制代码



作者: Miss_love    时间: 2021-1-5 14:55
支持下




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2