1. Install Jenkins (to prepare Java environment, must jdk8 and above)
Download JDK 1.8, upload to CENTOS7 system
Decompression: TAR-ZXVF jdk-8u181-linux-x64.tar.gz
Save:
mkdir/usr/local/jdk/
MV jdk1.8.0_181/*/usr/local/jdk/
To configure environment variables:
Vi/etc/profile
Java_home=/usr/local/jdk
Jre_home= $JAVA _home/jre
Path= $PATH: $JAVA _home/bin: $JRE _home/bin
Classpath=: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar: $JRE _home/lib/dt.jar
Export Java_home jre_home PATH CLASSPATH
Reload Environment configuration: source/etc/profile
Download Jenkins:wget Http://mirrors.jenkins.io/war/latest/jenkins.war
Background start: Nohup java-jar Jenkins.war >temp.txt &
2. Environmental preparedness
Git install:
Download the installation package: Wget https://www.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz
Dependency Package: Yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-extutils-makemaker
Decompression: TAR-ZXVF git-2.9.5.tar.gz
Access unpacking: CD git-2.9.5/p>
Compile: Make prefix=/usr/local/git all
Installation: Make Prefix=/usr/local/git install
MAVEN Installation:
Download the installation package: Wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
Decompression: TAR-ZXVF apache-maven-3.3.9-bin.tar.gz
Move to the specified directory: MV Apache-maven-3.3.9/usr/local/maven
Configuring Environment variables: vim/etc/profile
M2_home=/usr/local/maven
Export Path=${m2_home}/bin:${path}
Reload Environment configuration: source/etc/profile
3. Start, configure
Enter the password under the hint path, install the default plugin, set the Admin user, determine the Jenkins root path
"System Management", "Global Tool Configuration":
"System Management", "plug-in Management":
"Safe Restart Plugin"//Restart Jenkins system
"Maven Integration Plugin"//the plugin is installed to create a MAVEN project
"Git plugin"//from remote pull to replace code
"Publish over SSH"//ssh telnet
"SSH Plugin"//ssh Log on to a remote server to perform the necessary scripts
"System Management", "Global Security Configuration":
System Management, System settings:
"SSH Remote hosts":
"Mail Settings":
"Publish over SSH":
4. Create a Build task
"New Task":
Task Name--build Maven task--Confirm
Note: Firewall-cmd--zone=public--add-port=80/tcp--permanent (--permanent permanent, no failure after this parameter restart)
Firewall-cmd--reload re-loading
Firewall-cmd--zone=public--remove-port=80/tcp--permanent Delete
Firewall-cmd--zone=public--query-port=80/tcp View
Firewall-cmd--state See if Firewall is running
Firewall-cmd--list-services See which ports are currently open
Firewall-cmd--get-services See what other services are available to open
Firewall-cmd--zone=public--list-ports View all open ports
Install and configure Jenkins (CentOS 7 64-bit)