Linux-Xshell-Jenkins

1. Agile development and continuous integration (CI)

1. What is agile development

Agile development takes the evolution of user needs as the core and adopts an iterative and step-by-step approach to software development. In agile development, the software project is divided into multiple sub-projects in the early stages of construction, and the results of each sub-project are tested and have the characteristics of being visible, integrable, and runnable. In other words, a large project is divided into multiple small projects that are interrelated but can also be run independently and are completed separately. During this process, the software is always in a usable state.

2. What is continuous integration (CI)

Because the development department maintains multiple versions at the same time, the release and testing of multiple versions requires a lot of manpower, so a professional continuous integration tool is needed to manage continuous repetitive work.

// 1. Party A makes a request

// Feasibility Analysis

// Requirements -> Development -> Test

//bug ZenTao

// bug level high

2. Continuous Integration Tool (CI)

1.Jenkins and Hudson

Jenkins is a continuous integration (CI) tool. It can continuously compile and run your code; run unit tests (UT) or integration tests; send running results to email or display them as reports.

Jenkins originated from Hudson. Hudson continues to move forward on the road of commercial software, while Jenkins is branched from hudson as open source software. Therefore, the current Jenkins and Hudson are very similar, but with their respective development, there have been some differences.

2. Technology combination

Jenkins can integrate GitHub or Subversion. Husband can also integrate GitHub or Subversion. Since the two are the same source of tool software, the operation and guiding ideology are close.

3. Comparison of deployment projects

Comparison of JavaEE project deployment methods

Manual deployment

git ->checkout-> war ->deployment

Automated deployment

The specific embodiment of “automation”: after submitting new code to the repository, it is automatically deployed on the application server, and users or testers immediately use the latest application.

Building the above-mentioned continuous integration environment can automate the entire construction and deployment process, reducing the workload to a great extent. It will not cause any additional burden on programmers’ daily development – after they submit the code, the latest version will be running on the server immediately – everything happens invisibly.

3. Install Jenkins

1. Installation prerequisites

Configure tomcat and jdk11 on the virtual machine (jdk8 is not recommended here because jdk8 is not suitable for jenkins, so jdk11 is recommended)

1.1 jdk11 download and configuration

First install jdk. After successful installation, you will go to the default location for file download. Remember the path to set the environment variable. After the setting is completed, make the configuration file take effect. Finally, enter java -version to check whether the configuration is successful.

①Install jdk

Command: yum install -y java-11-openjdk-headless-11.0.13.0.8-1.el7_9.x86_64 java-11-openjdk-11.0.13.0.8-1.el7_9.x86_64 java-11-openjdk-devel- 11.0.13.0.8-1.el7_9.x86_64

The above picture appears and the installation is successful.

The default installation location for files is: /usr/lib/jvm

②Set environment variables

Command: vim /etc/profile

export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.13.0.8-1.el7_9.x86_64
export JRE_HOME=/usr/lib/jvm/java-11-openjdk-11.0.13.0.8-1.el7_9.x86_64
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
                                                  

OS: The previous jdk1.8 can be uninstalled directly, and there will be no need to write it again~

③Make the configuration file effective

Command: source /etc/profile

④Enter java -version to check whether the configuration is successful

1.2 tomcat installation and startup

First download the compressed package, put it into the specified directory and decompress it. After decompressing, enter the bin directory to start tomcat, and then start the browser to check whether tomcat is started.

①Download

Official website: http://tomcat.apache.org/, select the download version

②Put it into the specified directory to decompress it.

I used the Xftp software to import it directly.

Decompression command: tar -axvf compressed package

③Enter the bin directory and start tomcat

Command: sh startup.sh

④Start the browser to see if tomcat is started

Path: virtual machine IP/8080

2. Install jenkins

1. Download jekins.war

https://www.jenkins.io/download/

https://get.jenkins.io/war-stable/2.222.4/

2. Start jenkins

Place the war in the webapps under tomcat, restart tomcat, and access the ip address: port number/jenkins

①Put the war package into webapps under tomcat

②Restart tomcat

③Access IP address: port number/jenkins

When the picture above appears, it’s a small step towards success.

3. Enter jenkins

Find the password from the server, then install the plugin, create a user, configure the instance, and then you can start using it

②Install plug-in

Failure occurs when installing the plug-in. You can change the default access address of Jenkins and install it again.

Change the default access address of jenkins

Command: vim /root/.jenkins/hudson.model.UpdateCenter.xml

Change https://updates.jenkins.io/update-center.json in the url
Change to https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json
It is the mirror address of Tsinghua University in China.
Or change it to http://updates.jenkins.io/update-center.json, that is, remove the s in https.
Then restart the tomcat service

③Create user

④Instance configuration

⑤Installation successful

⑥Enter and use

Since then, I have successfully entered Jenkins~