Linux configuration series 2 Jenkins

1. Function and advantages

  1. Continuously and automatically build products
  2. Monitor regularly executed tasks
  3. Support extension plug-ins to meet various task requirements
  4. Support distributed
  5. Send result notification by configuring e-mail
  6. Generate JUnit, TestNG and other test reports

2. Environmental preparation

Operating system: centos 7.6; Jenkins: jenkins-2.222.1-1.1.noarch.rpm; JDK version: jdk1.8;

Prerequisite: Install and configure the JDK. For specific steps, please refer to Linux Configuration Series 1 jdk tomcat python

Three, configure Jenkins

Download installation configuration

  1. The browser opens the URL: https://pkg.jenkins.io/redhat-stable/ >> Select the version to download, click download >> Use the Linux remote tool to upload to the server or download the command directly on the server as follows: https: // pkg .jenkins.io / redhat-stable / jenkins-2.222.1-1.1.noarch.rpm
  2. Install jenkins: sudo rpm -ih jenkins-2.222.1-1.1.noarch.rpm

  1. Files generated after successful installation
1.配置文件,如配置端口号
/etc/sysconfig/jenkins 
2.日志文件
/var/log/jenkins/jenkins.log 
3.生成war包
/usr/lib/jenkins/jenkins.war
4.默认的JENKINS_HOME目录
/var/lib/jenkins/       
  1. Modify the port: vim / etc / sysconfig / jenkins >> JENKINS_PORT = "8081"

  1. Modify user: vim / etc / sysconfig / jenkins >> JENKINS_USER = "root"

  2. Configure Java: vim /etc/init.d/jenkins>>candidates increase: /usr/local/java/jdk1.8.0_241/bin/java

Description: /usr/local/java/jdk1.8.0_241/bin/java can be obtained by viewing which java

  1. Start Jenkins
  2. Start: service jenkins start
  3. Stop: service jenkins stop
  4. Restart: service jenkins restart

  1. After successful startup, in the window environment, browser: ip: 8081, open Jenkins, as shown below

  1. Get password: cat / var / lib / jenkins / secrets / initialAdminPassword

Fourth, the problem

问题描述: 启动Jenkin时报错,具体:Restarting jenkins (via systemctl): Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.

Solution: Modify the /etc/init.d/jenkins file and configure the java path into it

Guess you like

Origin www.cnblogs.com/yiwenrong/p/12730176.html