Building a production CICD environment based on Jenkins and installing jenkins

Table of contents

Introduction to Jenkins

Install and configure Jenkins


Introduction to Jenkins


Jenkins is an open source continuous integration tool written in Java. After a dispute with Oracle, the project became independent from the Hudson Project. Official website: https://jenkins.io/.

Jenkins provides continuous integration services for software development. It runs in a Servlet container (Tomcat). It supports software configuration management (SCM) tools (including AccuRev SCM, CVS, Subversion , Git , Perforce, Clearcase, and RTC) and can execute projects based on Apache Ant and Apache Maven, as well as arbitrary Shell scripts and Windows batch commands. The main developer of Jenkins is Kosuke Kawaguchi. Jenkins is free software released under the MIT license.

Jenkins can monitor problems in the continuous integration process in real time, provide detailed log files and reminder functions, and can also use charts to vividly display the trend and stability of project construction.

Jenkins includes the following features:

  • Easy to install: There is only one jenkins.war. After downloading the file from the official website, you can run it directly without additional installation or database installation;
  • Easy to configure: Provides a friendly GUI configuration interface;
  • Change support: Jenkins can obtain and generate a code update list from the code repository (SVN/Git), and output it to the compilation output information;
  • Supports permanent links: Users access Jenkins through the Web, and the link addresses of these Web pages are
  • It is a permanent link address, which can be used directly in various documents;
  • Integrated Email/RSS/IM: When an integration is completed, the integration results can be collected in real time through these tools (it takes a certain amount of time to build an integration. With this function, you can do other things while waiting for the results) ;
  • JUnit/TestNG test report: It is used to provide detailed test report function in the form of charts and other forms;
  • Support distributed build: Jenkins can distribute integrated build and other work to multiple computers for completion;
  • File fingerprint information: Jenkins will save the jars files generated by building the integration and which version was used to build the integration;
  • Support third-party plug-ins: Jenkins supports third-party plug-ins, which makes Jenkins more and more powerful.

Install and configure Jenkins


Prepare a machine

192.168.200.111

Turn off firewall

Change name

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# iptables -F
[root@localhost ~]# setenforce 0
[root@localhost ~]# hostname jenkins
[root@localhost ~]# bash

[ root@jenkins ~]# tar xf jdk-17_linux-x64_bin.tar.gz

[root@jenkins ~]# mv jdk-17.0.8  /usr/local/java
[root@jenkins ~]# vim /etc/profile

export JAVA_HOME=/usr/local/java

export PATH=$JAVA_HOME/bin:$PATH

export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar

 

[root@jenkins ~]# rm -rf /usr/bin/java

[root@jenkins ~]# source /etc/profile

[root@jenkins ~]# java -version

 You can go to the Tsinghua University open source mirror station to download the version required for Jenkins.

Tsinghua University open source software mirror station: https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat/

[root@jenkins ~]# rpm -ivh jenkins-2.401-1.1.noarch.rpm

[root@jenkins ~]# jenkins start [Start]

 At the bottom is the password

Open another terminal

[root@jenkins ~]# netstat -lnpt | grep java

[root@jenkins ~]# rpm -ql jenkins

/etc/init.d/jenkins          #Startup file

/etc/logrotate.d/jenkins # Log splitting configuration file

/etc/sysconfig/jenkins       # jenkins main configuration file

/usr/lib/jenkins           # Store the war package directory

/usr/lib/jenkins/jenkins.war  # war package

/usr/sbin/rcjenkins # Command

/var/cache/jenkins # war package decompression directory jenkins web code directory

/var/lib/jenkins           # jenkins working directory

/var/log/jenkins # Log

Configuration file description

[root@jenkins ~]# grep "^[a-Z]" /etc/sysconfig/jenkins

JENKINS_HOME="/var/lib/jenkins" #jenkins working directory

JENKINS_JAVA_CMD=""

JENKINS_USER="jenkins" # jenkinx start user

JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true"

JENKINS_PORT="8080" # Port

JENKINS_LISTEN_ADDRESS=""

JENKINS_HTTPS_PORT=""

JENKINS_HTTPS_KEYSTORE=""

JENKINS_HTTPS_KEYSTORE_PASSWORD=""

JENKINS_HTTPS_LISTEN_ADDRESS=""

JENKINS_DEBUG_LEVEL="5"

JENKINS_ENABLE_ACCESS_LOG="no"

JENKINS_HANDLER_MAX="100" # Maximum connection

JENKINS_HANDLER_IDLE="20"

JENKINS_ARGS=""

 

Access the local IP plus 8080 port 192.168.200.112:8080

Enter the password you just generated

 

 

 

 

 

 

Install Jenkins necessary plug-ins


On the Jenkins homepage, click Manage Jenkins on the left > > Manage Plugins > > Optional plug-ins, enter the Publish Over SSH and Maven Integration plug-ins to be installed in the filter search box , and check the check box on the left, and click "Direct installation" will start the plug-in installation operation.

 

 

 

 

 

 

jenkins is installed

Guess you like

Origin blog.csdn.net/2302_77750172/article/details/132406987