Installation and configuration of Jenkins under Linux-1

Source: Internet
Author: User

Version requirements: Linux CentOS 6.8 tomcat8.5.9 (not available) JDK 8u141 Jenkins 2.107.1

Introduction

?? Continuous integration (CI) is the cornerstone of modern software development, and it changes the team's understanding of the entire development process. A good CI architecture enables you to find and fix bugs faster from development to deployment, ultimately bringing more value to your customers. Each professional development team, whether playing or small should adopt CI.

?? Continuous integration is a software that monitors changes in your version control system. This tool automatically compiles and tests your app whenever the code changes. If an error occurs, the tool immediately notifies the developer, so the developer can fix the problem immediately. It can also automatically monitor code quality and test coverage. Visual code quality metrics encourage developers to continually improve their code

?? Continuous deployment (continuous Deployment) is the automated deployment of each successful build directly into the production environment.
?? Continuous release (continuous Delivery) is slightly different from continuous deployment (continuous Deployment). The continuously released version has all the automated tests and other quality testing tools that can be fully automated in a click-through deployment to the production environment and can be used directly by the user. However, this process is not automatic, it is determined by the business of the best release time rather than it is published directly.

1: Install 1.1, install JDK, and configure environment variables
// 安装jdk    [[email protected] local]# rpm -ivh jdk-8u77-linux-x64.rpm//配置环境变量[[email protected] local]# cat /etc/profile.d/jdk.sh    export JDK_HOME=/usr/java/default    export PATH=$JDK_HOME/bin:$PATH
1.2. Configure Jenkins
//      http://mirrors.jenkins.io/war-stable/创建目录 mkdir /usr/local/jenkins进入目录 cd !$下载     wget  http://mirrors.jenkins.io/war-stable/2.107.1/jenkins.war启动     nohup java –jar jenkins.war &
1.3. Visit
   防火墙放出8080端口 使用ip+端口+服务名直接访问  工作目录:/root/.jenkins  如果想修改密码什么的就在这个文件下    http://xxxx:8080/jenkins/// 密码  cat /root/.jenkins/secrets/initialAdminPassword
1.4. Install Maven
// maven下载http://mirror.bit.edu.cn/apache/mavenwget http://mirror.bit.edu.cn/apache/maven/maven-3/3.5.3/binaries/apache-maven-3.5.3-bin.tar.gz// 安装maven cd /usr/localtar xf apache-maven-3.5.2-bin.tar.gz && ln -sv apache-maven-3.5.2 maven    "maven" -> "apache-maven-3.5.2"// 配置环境变量echo "export PATH=$PATH:/usr/local/maven/bin" > /etc/profile.d/maven.sh && source /etc/profile.d/maven.sh//  查看版本[[email protected] local]# mvn --versionApache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T15:58:13+08:00)Maven home: /usr/local/mavenJava version: 1.8.0_77, vendor: Oracle CorporationJava home: /usr/java/jdk1.8.0_77/jreDefault locale: zh_CN, platform encoding: UTF-8OS name: "linux", version: "2.6.32-642.el6.x86_64", arch: "amd64", family: "unix"
1.5. Install Git
安装说明: http://blog.51cto.com/xiong51/2088755
2: Configure Jenkins_web interface Configuration
2.1. Configure Maven

System Management---Global tool configuration (Maven configuration):


2.2. Configure Git

2.3. To configure JDK, be sure to use JDK

3. MAVEN project configuration
3.1 Installing the Jenkins Plugin

Menu path: System Management-Manage the jenkins-management plug-in.

安装以下插件:   1、 Maven Integration plugin   2、 Subversion Plugin   3、 Checkstyle Plugin   4、 Findbugs Plugin   5、 PMD Plugin   6、 Warnings Plugin   7、 Maven Info Plugin   8、 Maven Repository Scheduled Cleanup Plugin   9、 Unleash Maven Plugin   10、 Maven Invoker plugin
3.2 Example: Configuring Jenkins to support Maven automatic compilation (GIT)

Create a new Git repository to store our Java code git installation: http://blog.51cto.com/xiong51/2088755





Submit the source code to git, when submitted there is a pom.xml

Click on save to build immediately.

Click Build and look at the console information to see the status, you must first modify the MAVEN mirror address

Complete information

3.3 Example: Configuring Jenkins to support Maven auto-compilation (SVN)




The SVN directory must be the two directories and the Pom.xml file,

Manually put the. War package under Tomcat and then modify the configuration file to start directly

4. Example
4.1:jenkins remote Automatic deployment using the Publish over SSH plugin

Links: http://blog.51cto.com/xiong51/2091739

FAQF.1, dependency package not resolved, read Maven central repository failed

Workaround:
Replace MAVEN domestic Mirror address
To modify the MAVEN configuration file:
Source Installation Address:/usr/local/maven/conf/settings.xml
Yum should be: Rpm-qi maven view settings.xml path modification Mirror

F.2, git permissions error (returned status code 128:stdout:)

Workaround:
Because the Local. Ssh/id_rsa.pub is updated and needs to be added to the id_rsa.pub content of Jenkins in/home/git/.ssh/authorized_keys on the GIT server

F.3, Ojdbc14-10.2.0.4.0.jar could not find artifact

Solution:
Find this directory/root/.m2/repository/com/oracle/ojdbc14/10.2.0.4.0 copy the Ojdbc14-10.2.0.4.0.ja in and rebuild it.
: Link: Https://pan.baidu.com/s/1NXoju53Nl7j3yHzR5tLkmQ Password: 37MR

Installation and configuration of Jenkins under Linux-1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.