Simple setup steps for Jenkins under Linux environment

Source: Internet
Author: User

Brief introduction

Jenkins is an open source software project designed to provide an open and easy-to-use software platform that makes continuous software integration possible. This is a Java-based development tool.

For a variety of reasons, recently began to contact, decided to study. Jenkins more than one way to build, a personal summary of one of them, the content of the article is relatively simple, shortcomings, welcome correction.


The JDK should be needless to say, I'm sure you'll find it.


Maven http://maven.apache.org/download.cgi


Install the software as follows:

Jdk-8u131-linux-x64.tar.gz

Apache-maven-3.5.0-bin.tar.gz


Environment:

[Email protected]]# uname-a

Linux node02.cn 2.6.32-642.el6.x86_64 # 17:27:01 UTC 2018 x86_64 x86_64 x86_64 gnu/linux

[[email protected] jdk]# free-m 
            total      used       free    shared    buffers    cached 
mem:      & nbsp   1861        511      1350          0    &NBSP ;   10        356 
-/+ buffers/cache:        143      17 17&NBSP,
swap:        1023          0      1023 
[[ Email protected]]# 
  
[[email protected] ~]# service iptables stop   or   Systemctl Stop Firewalld  [ ok  ]
iptables:setting chains to policy accept:filter          [  ok ] 


iptables:flushing firewall rules: [OK]


iptables:unloading modules: [OK]


[Email protected] ~]# Setenforce 0
[Email protected] ~]#


First, configure the JDK

[Email protected] jdk]# pwd
/data/jdk
[[email protected] jdk]# ls
Jdk-8u131-linux-x64.tar.gz


Unpack the JDK installation package:

[Email protected] jdk]# tar zxvf jdk-8u131-linux-x64.tar.gz
[[email protected] jdk]# ls
jdk1.8.0_131 jdk-8u131-linux-x64.tar.gz
[Email protected] jdk]# CD jdk1.8.0_131/

[Email protected] jdk1.8.0_131]# pwd
/data/jdk/jdk1.8.0_131


[[email protected] jdk1.8.0_131]# ls
Bin DB javafx-src.zip Lib man release Thirdpartylicensereadme-javafx.txt
COPYRIGHT include JRE LICENSE readme.html src.zip THIRDPARTYLICENSEREADME.txt
[Email protected] jdk1.8.0_131]#


Create an environment variable file: (For ease of maintenance, create an app's environment variable file below)

[Email protected] jdk1.8.0_131]# vim/etc/profile.d/java-jdk.sh
[email protected] jdk1.8.0_131]# cat!$
cat/etc/profile.d/java-jdk.sh
Export java_home=/data/jdk/jdk1.8.0_131
Export path= $JAVA _home/bin: $PATH
Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar


After the deposit exits, use the source to take effect:

[Email protected] jdk1.8.0_131]# source!$
source/etc/profile.d/java-jdk.sh


To test the Java environment:

[Email protected] jdk1.8.0_131]# java-version
Java Version "1.8.0_131"
Java (TM) SE Runtime Environment (build 1.8.0_131-B11)
Java HotSpot (TM) 64-bit Server VM (build 25.131-b11, Mixed mode)
[Email protected] jdk1.8.0_131]#


Second, configure Maven

[Email protected] maven]# pwd
/data/maven
[[email protected] maven]# ls
Apache-maven-3.5.0-bin.tar.gz


Extract:

[Email protected] maven]# tar zxvf apache-maven-3.5.0-bin.tar.gz ^c
[[email protected] maven]# ls
apache-maven-3.5.0 apache-maven-3.5.0-bin.tar.gz
[Email protected] maven]# CD apache-maven-3.5.0
[[email protected] apache-maven-3.5.0]# ls
Bin Boot conf lib LICENSE NOTICE README.txt


Configure and take effect environment variables:

[Email protected] apache-maven-3.5.0]# vim/etc/profile.d/maven.sh
[Email protected] apache-maven-3.5.0]# source!$
source/etc/profile.d/maven.sh
[Email protected] apache-maven-3.5.0]# cat/etc/profile.d/maven.sh
Export maven_home=/data/maven/apache-maven-3.5.0
Export path= $MAVEN _home/bin: $PATH
[Email protected] apache-maven-3.5.0]#


Test:

[Email protected] apache-maven-3.5.0]# mvn-v
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04t03:39:06+08:00)
Maven Home:/data/maven/apache-maven-3.5.0
Java version:1.8.0_131, Vendor:oracle Corporation
Java Home:/data/jdk/jdk1.8.0_131/jre
Default Locale:en_us, Platform Encoding:utf-8
OS name: "Linux", Version: "2.6.32-642.el6.x86_64", Arch: "AMD64", Family: "Unix"
[Email protected] apache-maven-3.5.0]#

Configuration is successful!


Third, install Jenkins:

[Email protected] ~]# Wget-o/etc/yum.repos.d/jenkins.repo Http://pkg.jenkins-ci.org/RedHat/jenkins.repo
[Email protected] ~]# rpm--import Http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
[email protected] ~]# Yum Clean all
[[email protected] ~]# Yum Install Jenkins
[Email protected] ~]#


Configure Jenkins:
Modify the configuration file for Jenkins

[Email protected] ~]# Vim/etc/sysconfig/jenkins #默认端口是8080
* # Port Jenkins is listening on.
# Set To-1 to disable
55 #
jenkins_port= "8080"
57
# # Type:string
# # # Default: ""
# # Servicerestart:jenkins
61 #
# IP Address Jenkins listens on for HTTP requests.
All interfaces (0.0.0.0).
64 #
Jenkins_listen_address= ""
.

Modify the service script for Jenkins

[[email protected] ~]# vim/etc/init.d/jenkins 
.  
 64 # Search usable Java as/usr/bin/ Java might not-minimal version required by jenkins. 
 65 # See Http://www.nabble.com/guinea-pigs-wan Ted-----hudson-rpm-for-redhat-linux-td25673707.html 
 66 candidates= " 
 67/etc/ Alternatives/java
 68/usr/lib/jvm/java-1.8.0/bin/java
 69/usr/lib/jvm/jre-1.8.0/bin/java
 70/usr/lib/jvm/java-1.7.0/bin/java
 71/usr/lib/jvm/jre-1.7.0/bin/java
 72/usr/bin/java &NBSP
 73/data/jdk/jdk1.8.0_131/bin/java      #添加内容--Specify your Java path  
 74 " &NBSP
 75 for candidate in $candidates  ,
 76 do
 77  [-X $JENKINS _java_cmd "] && Amp Break
 78  jenkins_java_cmd= "$candidate"
.

Start the Jenkins service:
[[Email protected] ~]# Service Jenkins start
Starting Jenkins [OK]
[Email protected] ~]#



Visit the test for a moment:




Start interface Prompt password generation location:

[Email protected] ~]# Cat/var/lib/jenkins/secrets/initialadminpassword


Paste in the input box



Next, choose the recommended plug-in installation:



To start installing plugins:



After the installation is complete, you will be prompted to create the user:



Welcome interface:



Next you can create a task:



Simple setup steps for Jenkins under Linux environment

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.