I. Environment configuration

OS version

[root@VM_0_11_centos /]# rpm -qa | grep centos-releaseCentos - release - 7-4.1708. El7. Centos. X86_64Copy the code

Java version

[root@VM_0_11_centos /]# java -version
openjdk version "1.8.0 comes with _181"
OpenJDK Runtime Environment (build 1.8.0_181-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
Copy the code

Maven version

[root@VM_0_11_centos /]# mvn -vApache Maven 3.0.5 (Red Hat 3.0.5-17) Maven Home: /usr/share/maven Java version: 1.8.0_181, vendor: Oracle Corporation Java Home: /usr/lib/jvm/java-1.8.0-openJDK-1.8.0.181-3.b13.el7_5.x86_64 / JRE Default locale: en_US, platform encoding: UTF-8 OS name:"linux", version: "3.10.0-693. El7. X86_64", arch: "amd64", family: "unix"
Copy the code

The Git version

[root@VM_0_11_centos /]# git --versionThe git version 1.8.3.1Copy the code

Second, the installation

Java installation

Yum install Java -- 1.8.0 comes with its x86_64Copy the code

Maven installation

yum install maven
Copy the code

Git installed

yum install git
Copy the code

Jenkins installation

IO /redhat-stab…

rpm -ivh xxx.npm
Copy the code

Once the installation is complete, check Jenkins’ directory

whereis jenkins
Copy the code

Console output

[root@VM_0_11_centos /]# whereis jenkins
jenkins: /usr/lib/jenkins
Copy the code

Default Jenkins configuration file in /etc/sysconfig/jenkins

Start the Jenkins

service jenkins start
Copy the code

Close the Jenkins

service jenkins stop
Copy the code

Jenkins deploys the Maven project

Only the default port for Jenkins startup is 8080. We can access Jenkins directly through the browser on the premise that the server security group opens port 8080 (or modify the port in the /etc/sysconfig/Jenkins configuration file ourselves)

http://xxxxxx:8080
Copy the code

Entering Jenkins for the first time will take you through several steps

  • Enter the administrator password, which can be seen from the file prompted on the page
  • Download the default plugin and click on the official recommendation button to continue
  • Set the account password and email address
  • Log in to

This brings us to Jenkins’ Dashboard page

Are you excited to see this? By default, you will need to install the Jenkins Maven plugin.

Install the Jenkins-Maven plugin Maven Integration

On the home page, click System Management on the right

2. Configure global tools

And then we’re going to do some tool configuration

Go to System Administration again and click Global Tool Configuration from the list

SAVE

3. Configure task information

After the first two steps, Jenkins was ready to start work, but we needed to tell the task what to do and how to do it before they could actually serve us.

For example? Where does the project we’re building come from? By what means or instructions? Without further ado, start creating a new task, and it’s a Maven project

Task Information Configuration

Pre Steps
Post Steps

After simple configuration, click Save to complete the task configuration editing!

Then things are simple, you can see a task list on the home page, select your task and click enter

Seeing success at the bottom means the project has been successfully deployed!