1. Function and advantages
- Continuously and automatically build products
- Monitor regularly executed tasks
- Support extension plug-ins to meet various task requirements
- Support distributed
- Send result notification by configuring e-mail
- 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
- 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
- Install jenkins: sudo rpm -ih jenkins-2.222.1-1.1.noarch.rpm
- 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/
- Modify the port: vim / etc / sysconfig / jenkins >> JENKINS_PORT = "8081"
-
Modify user: vim / etc / sysconfig / jenkins >> JENKINS_USER = "root"
-
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
- Start Jenkins
- Start: service jenkins start
- Stop: service jenkins stop
- Restart: service jenkins restart
- After successful startup, in the window environment, browser: ip: 8081, open Jenkins, as shown below
- 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