What is Jenkins?
Jenkins is a powerful application that allows continuous integration and continuous delivery of projects, regardless of platform. This is a free source code that can handle any type of build or continuous integration. Integrated Jenkins can be used for a number of testing and deployment techniques.
Jenkins is a software that allows continuous integration. Jenkins is installed on a service where the central build takes place. The flowchart below shows a very simple workflow of how Jenkins works.
What is continuous integration?
Continuous integration is a development practice that requires developers to regularly integrate code into shared repositories. This concept was designed to eliminate the problem of discovery, which later appeared in the building life cycle. Continuous integration requires developers to build frequently. The most common practice is that the build should be triggered whenever a code is submitted.
System requirements? Operating system version:
Jenkins can be installed on Windows, Ubuntu/debian, Redhat/fedora/centos, Mac OS X, OpenSUSE, FReeBSD, OpenBSD, Gentoo systems
Memory:
2 GB RAM (recommended)
Disk space disks:
There is no minimum requirement. It is important to note that because all builds are saved on the Jenkins machine, it must ensure that there is enough disk space available to build the storage.
JDK version:
JDK 1.5 or above
Java container:
The war file can be run in a container that supports servlet2.4/jsp2.0 or later. (An example is Tomcat 5)
Experimental environment
System version: centos7x3.10.0-514.el7.x86_64
Servers: Jenkins and Tomcat
Jenkins Server
ip:192.168.152.170
Java version: Java-1.8.0-openjdk.x86_64 1:1.8.0.181-3.b13.el7_5 (yum installation)
Git version: git.x86_64 0:1.8.3.1-14.el7_5 (yum install)
Jenkins ' War pack: Jenkins.war
Tomcat version: apache-tomcat-9.0.11.tar.gz
Maven version: apache-maven-3.5.4-bin.tar.gz
Tomcat Server:
ip:192.168.152.91
Java version: Java-1.8.0-openjdk.x86_64 1:1.8.0.181-3.b13.el7_5 (yum installation)
Tomcat version: apache-tomcat-9.0.11.tar.gz
Note: The GIT repository here uses GitHub, so it doesn't have to be built separately, if it's in the real world or it's recommended to build a private warehouse, because a shared warehouse is relatively unsafe.
Turn off the firewall and disable power-on self-booting
Systemctl Stop Firewalld.service
Systemctl Disable FIREWALLD
Turn off SELinux
Sed-i ' s/selinux=enforcing/selinux=disabled/g '/etc/sysconfig/selinux
Restart reboot
First, install Jenkins (ip:192.168.152.170)
Jenkins official website
Jenkins Usage Tutorials
Jenkins software download
Note: Here we download the latest war package from the official Jenkins website. Although Jenkins provides various installers such as Windows, Linux, OS x, these installers do not have a war package. Only need to run the command Java-jar Jenkins.war, but I use Tomcat here so you don't need to use this command, remember to download the war package, it is clear whether it is based on Linux system, because the official website has two different war packages, the following selection is based on the right of the Linux system
1. Upload the required installation package to the server
2. Create an Extract directory
Mkdir/usr/local/{tomcat,maven}
Note: This step is to reduce the name of the two software after the decompression of the suffix, but also easy to manage.
3. Install Tomcat's dependency package Java and Tomcat
1) Install Tomcat's dependency package Java
Yum-y Install Java Java-devel
2) Unzip Tomcat to the current directory
Tar zxf apache-tomcat-9.0.11.tar.gz
3) Move all files in the extracted directory to the/usr/local/tomcat/directory
MV apache-tomcat-9.0.11/*/usr/local/tomcat/
4) Start Tomcat
/usr/local/tomcat/bin/startup.sh
5) Verify that Tomcat
Visit URL: http://192.168.152.170:8080/
Note: See above proof start success!
6) Set the TOMCAT environment variable (append the rear)
Vi/etc/profile
Export java_home= '/usr/lib/jvm/jre '
Export catalina_home= '/usr/local/tomcat '
4. Install Jenkins
1) Delete all files in the/usr/local/tomcat/webapps/directory
rm-rf/usr/local/tomcat/webapps/*
2) Move the Jenkins.war to the/usr/local/tomcat/webapps/directory
MV jenkins.war/usr/local/tomcat/webapps/
Note: Because this directory is the Apache Web page display directory, that is to install this tomcat to implement the Jenkins interface management, so the default file here is replaced by Jenkins War package, When Tomcat starts, he automatically extracts a Jenkins directory, where we can directly access the Web page.
Installing jenkins!
3) View Web page display directory
ls/usr/local/tomcat/webapps/
4) Direct access to Web installation Jenkins
Visit URL: http://192.168.152.170:8080/jenkins
Follow the page prompts to view the password and click Continue
Click to select the recommended plug-in installation (you can also select Plug-in installation as required)
such as automatic installation of plug-ins
Feel free to create a user name and password, then click Save and Finish
Note: This must be filled in, otherwise it cannot be saved!
Set the path according to your own habits (I use the default here), then click Save and Finish
Just click to start using Jenkins to complete the installation
See the following proof into the Jenkins Admin interface
5. Install Jenkins's plugin maven
1) Unzip maven to the current directory
Tar zxf apache-maven-3.5.4-bin.tar.gz
2) Move all files in the Maven directory to the/usr/local/maven/directory
MV apache-maven-3.5.4/*/usr/local/maven/
3) Set the environment variables for maven (append)
Vi/etc/profile
Export Maven_home=/usr/local/maven
Export Path=${maven_home}/bin:${path}
4) Make the environment variable effective
Source/etc/profile
5) Verify that MAVEN is installed successfully
6. Install maven dependency and SSH code release plugin (Web installation)
1) Install Maven dependent maven Release plug-in, etc.
Login to Jenkins Web page and click on the left system management
Click Plug-in Management
Click on the optional plugin, then in the upper right corner of the search bar to find the required plug-in, I will choose Maven here
Installing the MAVEN Plugin
Note: This completes the installation of Maven dependent plugins!
2) Install the release plugin publish over SSH
Login to Jenkins Web page and click on the left system management
Click Plug-in Management
Click the optional plugin and find publish over SSH in the upper right corner of the search bar
Installing the Publish over SSH plugin
Note: This completes the publish over SSH plugin installed!
7. Global Tool Configuration Jenkins
Login to Jenkins Web page and click on the left system management
Click Global Tool Configuration
Main configuration maven and JDK and git
Last Click Save
8. Global Setup Jenkins
Login to Jenkins Web page and click on the left system management
Click System Settings
Configure SSH remote push
Last Save to exit
Note: To here Jenkins Server Basic configuration is complete!
Ii. installation of Tomcat (ip:192.168.152.91)
Tomcat official website
Tomcat software Download
About Tomcat
Tomcat是Apache 软件基金会(Apache Software Foundation)的Jakarta 项目中的一个核心项目,由Apache、Sun 和其他一些公司及个人共同开发而成。由于有了Sun 的参与和支持,最新的Servlet 和JSP 规范总是能在Tomcat 中得到体现,Tomcat 5支持最新的Servlet 2.4 和JSP 2.0 规范。因为Tomcat 技术先进、性能稳定,而且免费,因而深受Java 爱好者的喜爱并得到了部分软件开发商的认可,成为目前比较流行的Web 应用服务器。 Tomcat 服务器是一个免费的开放源代码的Web 应用服务器,属于轻量级应用服务器,在中小型系统和并发访问用户不是很多的场合下被普遍使用,是开发和调试JSP 程序的首选。对于一个初学者来说,可以这样认为,当在一台机器上配置好Apache 服务器,可利用它响应HTML(标准通用标记语言下的一个应用)页面的访问请求。实际上Tomcat是Apache 服务器的扩展,但运行时它是独立运行的,所以当你运行tomcat 时,它实际上作为一个与Apache 独立的进程单独运行的。 诀窍是,当配置正确时,Apache 为HTML页面服务,而Tomcat 实际上运行JSP 页面和Servlet。另外,Tomcat和IIS等Web服务器一样,具有处理HTML页面的功能,另外它还是一个Servlet和JSP容器,独立的Servlet容器是Tomcat的默认模式。不过,Tomcat处理静态HTML的能力不如Apache服务器。目前Tomcat最新版本为9.0。
Jenkins One-click Online Java Project