Gerrit代碼審計系統實戰-Gerrit 2.15.14版本快速搭建

         Gerrit代碼審計系統實戰-Gerrit 2.15.14版本快速搭建 
css

                                      做者:尹正傑html

版權聲明:原創做品,謝絕轉載!不然將追究法律責任。java

 

 

一.Gerrit版本選擇node

1>.查看Gerrit官網python

    Gerrit官方地址:https://www.gerritcodereview.com/

2>.查看Gerrit幫助文檔mysql

    官方地址:https://www.gerritcodereview.com/project-configuration.html

3>.Gerrit版本的選擇linux

  雖然說主流的Gerrit版本是2.15系列,但官網已經發布了3.0.0系列,所以,咱們在安裝和使用Gerrit時候,咱們會同時學習Gerrit和Gerrit這兩個版本。
    關於Gerrit2.15.x 下載地址::https://www.gerritcodereview.com/2.15.html
    關於Gerrit3.0.x下載地址:https://www.gerritcodereview.com/3.0.html

  本片博客主要演示gerrit2.15.14版本的安裝,而gerrit3.0.0版本的安裝可參考我以前的筆記:https://www.cnblogs.com/yinzhengjie/p/11007383.html.

 

 

二.安裝OpenJDKgit

1>.查看CentOS的yum源支持的openjdk版本web

[root@node201.yinzhengjie.org.cn ~]# yum search jdk
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: ftp.riken.jp
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
===================================================== N/S matched: jdk ======================================================
copy-jdk-configs.noarch : JDKs configuration files copier
java-1.6.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.6.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.6.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.6.0-openjdk-javadoc.x86_64 : OpenJDK API Documentation
java-1.6.0-openjdk-src.x86_64 : OpenJDK Source Bundle
java-1.7.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.7.0-openjdk-accessibility.x86_64 : OpenJDK accessibility connector
java-1.7.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.7.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.7.0-openjdk-headless.x86_64 : The OpenJDK runtime environment without audio and video support
java-1.7.0-openjdk-javadoc.noarch : OpenJDK API Documentation
java-1.7.0-openjdk-src.x86_64 : OpenJDK Source Bundle
java-1.8.0-openjdk.i686 : OpenJDK Runtime Environment
java-1.8.0-openjdk.x86_64 : OpenJDK Runtime Environment 8
java-1.8.0-openjdk-accessibility.i686 : OpenJDK accessibility connector
java-1.8.0-openjdk-accessibility.x86_64 : OpenJDK accessibility connector
java-1.8.0-openjdk-accessibility-debug.i686 : OpenJDK accessibility connector for packages with debug on
java-1.8.0-openjdk-accessibility-debug.x86_64 : OpenJDK 8 accessibility connector for packages with debug on
java-1.8.0-openjdk-debug.i686 : OpenJDK Runtime Environment with full debug on
java-1.8.0-openjdk-debug.x86_64 : OpenJDK Runtime Environment 8 with full debug on
java-1.8.0-openjdk-demo.i686 : OpenJDK Demos
java-1.8.0-openjdk-demo.x86_64 : OpenJDK Demos 8
java-1.8.0-openjdk-demo-debug.i686 : OpenJDK Demos with full debug on
java-1.8.0-openjdk-demo-debug.x86_64 : OpenJDK Demos 8 with full debug on
java-1.8.0-openjdk-devel.i686 : OpenJDK Development Environment
java-1.8.0-openjdk-devel.x86_64 : OpenJDK Development Environment 8
java-1.8.0-openjdk-devel-debug.i686 : OpenJDK Development Environment with full debug on
java-1.8.0-openjdk-devel-debug.x86_64 : OpenJDK Development Environment 8 with full debug on
java-1.8.0-openjdk-headless.i686 : OpenJDK Runtime Environment
java-1.8.0-openjdk-headless.x86_64 : OpenJDK Headless Runtime Environment 8
java-1.8.0-openjdk-headless-debug.i686 : OpenJDK Runtime Environment with full debug on
java-1.8.0-openjdk-headless-debug.x86_64 : OpenJDK Runtime Environment with full debug on
java-1.8.0-openjdk-javadoc.noarch : OpenJDK 8 API documentation
java-1.8.0-openjdk-javadoc-debug.noarch : OpenJDK 8 API documentation for packages with debug on
java-1.8.0-openjdk-javadoc-zip.noarch : OpenJDK 8 API documentation compressed in single archive
java-1.8.0-openjdk-javadoc-zip-debug.noarch : OpenJDK 8 API documentation compressed in single archive for packages with
                                            : debug on
java-1.8.0-openjdk-src.i686 : OpenJDK Source Bundle
java-1.8.0-openjdk-src.x86_64 : OpenJDK Source Bundle 8
java-1.8.0-openjdk-src-debug.i686 : OpenJDK Source Bundle for packages with debug on
java-1.8.0-openjdk-src-debug.x86_64 : OpenJDK Source Bundle 8 for packages with debug on
java-11-openjdk.i686 : OpenJDK Runtime Environment 11
java-11-openjdk.x86_64 : OpenJDK Runtime Environment 11
java-11-openjdk-debug.i686 : OpenJDK Runtime Environment 11 with full debug on
java-11-openjdk-debug.x86_64 : OpenJDK Runtime Environment 11 with full debug on
java-11-openjdk-demo.i686 : OpenJDK Demos 11
java-11-openjdk-demo.x86_64 : OpenJDK Demos 11
java-11-openjdk-demo-debug.i686 : OpenJDK Demos 11 with full debug on
java-11-openjdk-demo-debug.x86_64 : OpenJDK Demos 11 with full debug on
java-11-openjdk-devel.i686 : OpenJDK Development Environment 11
java-11-openjdk-devel.x86_64 : OpenJDK Development Environment 11
java-11-openjdk-devel-debug.i686 : OpenJDK Development Environment 11 with full debug on
java-11-openjdk-devel-debug.x86_64 : OpenJDK Development Environment 11 with full debug on
java-11-openjdk-headless.i686 : OpenJDK Headless Runtime Environment 11
java-11-openjdk-headless.x86_64 : OpenJDK Headless Runtime Environment 11
java-11-openjdk-headless-debug.i686 : OpenJDK Runtime Environment with full debug on
java-11-openjdk-headless-debug.x86_64 : OpenJDK Runtime Environment with full debug on
java-11-openjdk-javadoc.i686 : OpenJDK 11 API documentation
java-11-openjdk-javadoc.x86_64 : OpenJDK 11 API documentation
java-11-openjdk-javadoc-debug.i686 : OpenJDK 11 API documentation for packages with debug on
java-11-openjdk-javadoc-debug.x86_64 : OpenJDK 11 API documentation for packages with debug on
java-11-openjdk-javadoc-zip.i686 : OpenJDK 11 API documentation compressed in single archive
java-11-openjdk-javadoc-zip.x86_64 : OpenJDK 11 API documentation compressed in single archive
java-11-openjdk-javadoc-zip-debug.i686 : OpenJDK 11 API documentation compressed in single archive for packages with debug on
java-11-openjdk-javadoc-zip-debug.x86_64 : OpenJDK 11 API documentation compressed in single archive for packages with debug
                                         : on
java-11-openjdk-jmods.i686 : JMods for OpenJDK 11
java-11-openjdk-jmods.x86_64 : JMods for OpenJDK 11
java-11-openjdk-jmods-debug.i686 : JMods for OpenJDK 11 with full debug on
java-11-openjdk-jmods-debug.x86_64 : JMods for OpenJDK 11 with full debug on
java-11-openjdk-src.i686 : OpenJDK Source Bundle 11
java-11-openjdk-src.x86_64 : OpenJDK Source Bundle 11
java-11-openjdk-src-debug.i686 : OpenJDK Source Bundle for packages with debug on
java-11-openjdk-src-debug.x86_64 : OpenJDK Source Bundle 11 for packages with debug on
java-latest-openjdk.x86_64 : OpenJDK Runtime Environment 12
java-latest-openjdk-debug.x86_64 : OpenJDK Runtime Environment 12 with full debug on
java-latest-openjdk-demo.x86_64 : OpenJDK Demos 12
java-latest-openjdk-demo-debug.x86_64 : OpenJDK Demos 12 with full debug on
java-latest-openjdk-devel.x86_64 : OpenJDK Development Environment 12
java-latest-openjdk-devel-debug.x86_64 : OpenJDK Development Environment 12 with full debug on
java-latest-openjdk-headless.x86_64 : OpenJDK Headless Runtime Environment 12
java-latest-openjdk-headless-debug.x86_64 : OpenJDK Runtime Environment with full debug on
java-latest-openjdk-javadoc.x86_64 : OpenJDK 12 API documentation
java-latest-openjdk-javadoc-debug.x86_64 : OpenJDK 12 API documentation for packages with debug on
java-latest-openjdk-javadoc-zip.x86_64 : OpenJDK 12 API documentation compressed in single archive
java-latest-openjdk-javadoc-zip-debug.x86_64 : OpenJDK 12 API documentation compressed in single archive for packages with
                                             : debug on
java-latest-openjdk-jmods.x86_64 : JMods for OpenJDK 12
java-latest-openjdk-jmods-debug.x86_64 : JMods for OpenJDK 12 with full debug on
java-latest-openjdk-src.x86_64 : OpenJDK Source Bundle 12
java-latest-openjdk-src-debug.x86_64 : OpenJDK Source Bundle 12 for packages with debug on
ldapjdk-javadoc.noarch : Javadoc for ldapjdk
icedtea-web.x86_64 : Additional Java components for OpenJDK - Java browser plug-in and Web Start implementation
ldapjdk.noarch : The Mozilla LDAP Java SDK
openprops.noarch : An improved java.util.Properties from OpenJDK

  Name and summary matches only, use "search all" for everything.
[root@node201.yinzhengjie.org.cn ~]# 
[root@node201.yinzhengjie.org.cn ~]# yum search jdk

2>.安裝OpenJDK1.8sql

[root@node201.yinzhengjie.org.cn ~]# yum -y install java-1.8.0-openjdk-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                                                  | 8.1 kB  00:00:00     
 * base: mirrors.aliyun.com
 * epel: mirrors.yun-idc.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                                                  | 3.6 kB  00:00:00     
epel                                                                                                  | 5.3 kB  00:00:00     
extras                                                                                                | 3.4 kB  00:00:00     
updates                                                                                               | 3.4 kB  00:00:00     
(1/2): epel/x86_64/updateinfo                                                                         | 976 kB  00:00:00     
(2/2): epel/x86_64/primary_db                                                                         | 6.7 MB  00:00:03     
Resolving Dependencies
--> Running transaction check
---> Package java-1.8.0-openjdk-devel.x86_64 1:1.8.0.212.b04-0.el7_6 will be installed
--> Processing Dependency: java-1.8.0-openjdk(x86-64) = 1:1.8.0.212.b04-0.el7_6 for package: 1:java-1.8.0-openjdk-devel-1.8.0.212.b04-0.el7_6.x86_64
--> Processing Dependency: libjvm.so()(64bit) for package: 1:java-1.8.0-openjdk-devel-1.8.0.212.b04-0.el7_6.x86_64
--> Processing Dependency: libjava.so()(64bit) for package: 1:java-1.8.0-openjdk-devel-1.8.0.212.b04-0.el7_6.x86_64
--> Running transaction check
---> Package java-1.8.0-openjdk.x86_64 1:1.8.0.212.b04-0.el7_6 will be installed
--> Processing Dependency: xorg-x11-fonts-Type1 for package: 1:java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64
--> Processing Dependency: libgif.so.4()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64
---> Package java-1.8.0-openjdk-headless.x86_64 1:1.8.0.212.b04-0.el7_6 will be installed
--> Processing Dependency: tzdata-java >= 2015d for package: 1:java-1.8.0-openjdk-headless-1.8.0.212.b04-0.el7_6.x86_64
--> Processing Dependency: copy-jdk-configs >= 3.3 for package: 1:java-1.8.0-openjdk-headless-1.8.0.212.b04-0.el7_6.x86_64
--> Processing Dependency: pcsc-lite-libs(x86-64) for package: 1:java-1.8.0-openjdk-headless-1.8.0.212.b04-0.el7_6.x86_64
--> Processing Dependency: lksctp-tools(x86-64) for package: 1:java-1.8.0-openjdk-headless-1.8.0.212.b04-0.el7_6.x86_64
--> Processing Dependency: jpackage-utils for package: 1:java-1.8.0-openjdk-headless-1.8.0.212.b04-0.el7_6.x86_64
--> Running transaction check
---> Package copy-jdk-configs.noarch 0:3.3-10.el7_5 will be installed
---> Package giflib.x86_64 0:4.1.6-9.el7 will be installed
---> Package javapackages-tools.noarch 0:3.4.1-11.el7 will be installed
--> Processing Dependency: python-javapackages = 3.4.1-11.el7 for package: javapackages-tools-3.4.1-11.el7.noarch
---> Package lksctp-tools.x86_64 0:1.0.17-2.el7 will be installed
---> Package pcsc-lite-libs.x86_64 0:1.8.8-8.el7 will be installed
---> Package tzdata-java.noarch 0:2019a-1.el7 will be installed
---> Package xorg-x11-fonts-Type1.noarch 0:7.5-9.el7 will be installed
--> Processing Dependency: ttmkfdir for package: xorg-x11-fonts-Type1-7.5-9.el7.noarch
--> Processing Dependency: ttmkfdir for package: xorg-x11-fonts-Type1-7.5-9.el7.noarch
--> Running transaction check
---> Package python-javapackages.noarch 0:3.4.1-11.el7 will be installed
--> Processing Dependency: python-lxml for package: python-javapackages-3.4.1-11.el7.noarch
---> Package ttmkfdir.x86_64 0:3.0.9-42.el7 will be installed
--> Running transaction check
---> Package python-lxml.x86_64 0:3.2.1-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================
 Package                                 Arch               Version                                Repository           Size
=============================================================================================================================
Installing:
 java-1.8.0-openjdk-devel                x86_64             1:1.8.0.212.b04-0.el7_6                updates             9.8 M
Installing for dependencies:
 copy-jdk-configs                        noarch             3.3-10.el7_5                           base                 21 k
 giflib                                  x86_64             4.1.6-9.el7                            base                 40 k
 java-1.8.0-openjdk                      x86_64             1:1.8.0.212.b04-0.el7_6                updates             270 k
 java-1.8.0-openjdk-headless             x86_64             1:1.8.0.212.b04-0.el7_6                updates              32 M
 javapackages-tools                      noarch             3.4.1-11.el7                           base                 73 k
 lksctp-tools                            x86_64             1.0.17-2.el7                           base                 88 k
 pcsc-lite-libs                          x86_64             1.8.8-8.el7                            base                 34 k
 python-javapackages                     noarch             3.4.1-11.el7                           base                 31 k
 python-lxml                             x86_64             3.2.1-4.el7                            base                758 k
 ttmkfdir                                x86_64             3.0.9-42.el7                           base                 48 k
 tzdata-java                             noarch             2019a-1.el7                            updates             187 k
 xorg-x11-fonts-Type1                    noarch             7.5-9.el7                              base                521 k

Transaction Summary
=============================================================================================================================
Install  1 Package (+12 Dependent packages)

Total download size: 44 M
Installed size: 149 M
Downloading packages:
(1/13): giflib-4.1.6-9.el7.x86_64.rpm                                                                 |  40 kB  00:00:00     
(2/13): javapackages-tools-3.4.1-11.el7.noarch.rpm                                                    |  73 kB  00:00:00     
(3/13): copy-jdk-configs-3.3-10.el7_5.noarch.rpm                                                      |  21 kB  00:00:00     
(4/13): java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64.rpm                                           | 270 kB  00:00:00     
(5/13): lksctp-tools-1.0.17-2.el7.x86_64.rpm                                                          |  88 kB  00:00:00     
java-1.8.0-openjdk-headless-1. FAILED                                          
http://mirrors.cloud.aliyuncs.com/centos/7/updates/x86_64/Packages/java-1.8.0-openjdk-headless-1.8.0.212.b04-0.el7_6.x86_64.rpm: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; Unknown error"
Trying other mirror.
(6/13): pcsc-lite-libs-1.8.8-8.el7.x86_64.rpm                                                         |  34 kB  00:00:00     
python-javapackages-3.4.1-11.e FAILED                                          
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/Packages/python-javapackages-3.4.1-11.el7.noarch.rpm: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; Unknown error"
Trying other mirror.
(7/13): ttmkfdir-3.0.9-42.el7.x86_64.rpm                                                              |  48 kB  00:00:00     
(8/13): tzdata-java-2019a-1.el7.noarch.rpm                                                            | 187 kB  00:00:00     
(9/13): xorg-x11-fonts-Type1-7.5-9.el7.noarch.rpm                                                     | 521 kB  00:00:01     
(10/13): python-javapackages-3.4.1-11.el7.noarch.rpm                                                  |  31 kB  00:00:00     
(11/13): python-lxml-3.2.1-4.el7.x86_64.rpm                                                           | 758 kB  00:00:02     
(12/13): java-1.8.0-openjdk-devel-1.8.0.212.b04-0.el7_6.x86_64.rpm                                    | 9.8 MB  00:00:05     
(13/13): java-1.8.0-openjdk-headless-1.8.0.212.b04-0.el7_6.x86_64.rpm                                 |  32 MB  00:00:18     
-----------------------------------------------------------------------------------------------------------------------------
Total                                                                                        2.2 MB/s |  44 MB  00:00:19     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : ttmkfdir-3.0.9-42.el7.x86_64                                                                             1/13 
  Installing : xorg-x11-fonts-Type1-7.5-9.el7.noarch                                                                    2/13 
  Installing : lksctp-tools-1.0.17-2.el7.x86_64                                                                         3/13 
  Installing : pcsc-lite-libs-1.8.8-8.el7.x86_64                                                                        4/13 
  Installing : tzdata-java-2019a-1.el7.noarch                                                                           5/13 
  Installing : python-lxml-3.2.1-4.el7.x86_64                                                                           6/13 
  Installing : python-javapackages-3.4.1-11.el7.noarch                                                                  7/13 
  Installing : javapackages-tools-3.4.1-11.el7.noarch                                                                   8/13 
  Installing : copy-jdk-configs-3.3-10.el7_5.noarch                                                                     9/13 
  Installing : 1:java-1.8.0-openjdk-headless-1.8.0.212.b04-0.el7_6.x86_64                                              10/13 
  Installing : giflib-4.1.6-9.el7.x86_64                                                                               11/13 
  Installing : 1:java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64                                                       12/13 
  Installing : 1:java-1.8.0-openjdk-devel-1.8.0.212.b04-0.el7_6.x86_64                                                 13/13 
  Verifying  : 1:java-1.8.0-openjdk-devel-1.8.0.212.b04-0.el7_6.x86_64                                                  1/13 
  Verifying  : giflib-4.1.6-9.el7.x86_64                                                                                2/13 
  Verifying  : xorg-x11-fonts-Type1-7.5-9.el7.noarch                                                                    3/13 
  Verifying  : copy-jdk-configs-3.3-10.el7_5.noarch                                                                     4/13 
  Verifying  : python-javapackages-3.4.1-11.el7.noarch                                                                  5/13 
  Verifying  : python-lxml-3.2.1-4.el7.x86_64                                                                           6/13 
  Verifying  : tzdata-java-2019a-1.el7.noarch                                                                           7/13 
  Verifying  : pcsc-lite-libs-1.8.8-8.el7.x86_64                                                                        8/13 
  Verifying  : javapackages-tools-3.4.1-11.el7.noarch                                                                   9/13 
  Verifying  : 1:java-1.8.0-openjdk-headless-1.8.0.212.b04-0.el7_6.x86_64                                              10/13 
  Verifying  : 1:java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64                                                       11/13 
  Verifying  : lksctp-tools-1.0.17-2.el7.x86_64                                                                        12/13 
  Verifying  : ttmkfdir-3.0.9-42.el7.x86_64                                                                            13/13 

Installed:
  java-1.8.0-openjdk-devel.x86_64 1:1.8.0.212.b04-0.el7_6                                                                    

Dependency Installed:
  copy-jdk-configs.noarch 0:3.3-10.el7_5                   giflib.x86_64 0:4.1.6-9.el7                                      
  java-1.8.0-openjdk.x86_64 1:1.8.0.212.b04-0.el7_6        java-1.8.0-openjdk-headless.x86_64 1:1.8.0.212.b04-0.el7_6       
  javapackages-tools.noarch 0:3.4.1-11.el7                 lksctp-tools.x86_64 0:1.0.17-2.el7                               
  pcsc-lite-libs.x86_64 0:1.8.8-8.el7                      python-javapackages.noarch 0:3.4.1-11.el7                        
  python-lxml.x86_64 0:3.2.1-4.el7                         ttmkfdir.x86_64 0:3.0.9-42.el7                                   
  tzdata-java.noarch 0:2019a-1.el7                         xorg-x11-fonts-Type1.noarch 0:7.5-9.el7                          

Complete!
[root@node201.yinzhengjie.org.cn ~]# 
[root@node201.yinzhengjie.org.cn ~]# yum -y install java-1.8.0-openjdk-devel

3>.查看JDK版本

[root@node201.yinzhengjie.org.cn ~]# 
[root@node201.yinzhengjie.org.cn ~]# which java
/usr/bin/java
[root@node201.yinzhengjie.org.cn ~]# 
[root@node201.yinzhengjie.org.cn ~]# java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
[root@node201.yinzhengjie.org.cn ~]# 

 

三.安裝git

1>.下載git安裝包(強烈不推薦你們使用yum方式安裝,建議你們使用源碼安裝git,這種方式不推薦使用,由於它默認安裝的版本是1.8.3,它和gerrit集成並不太友好,尤爲是gerrit3.0.0版本。

[root@node201.yinzhengjie.org.cn ~]# yum -y install wget
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirrors.yun-idc.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package wget.x86_64 0:1.14-18.el7_6.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================
 Package                  Arch                       Version                               Repository                   Size
=============================================================================================================================
Installing:
 wget                     x86_64                     1.14-18.el7_6.1                       updates                     547 k

Transaction Summary
=============================================================================================================================
Install  1 Package

Total download size: 547 k
Installed size: 2.0 M
Downloading packages:
wget-1.14-18.el7_6.1.x86_64.rpm                                                                       | 547 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : wget-1.14-18.el7_6.1.x86_64                                                                               1/1 
  Verifying  : wget-1.14-18.el7_6.1.x86_64                                                                               1/1 

Installed:
  wget.x86_64 0:1.14-18.el7_6.1                                                                                              

Complete!
[root@node201.yinzhengjie.org.cn ~]# 
[root@node201.yinzhengjie.org.cn ~]# yum -y install wget      #安裝Linux系統的下載工具
[root@node201.yinzhengjie.org.cn ~]# wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.12.2.tar.gz

2>.安裝git依賴包

[root@node201.yinzhengjie.org.cn ~]# wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.12.2.tar.gz
--2019-06-17 06:03:29--  https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.12.2.tar.gz
Resolving mirrors.edge.kernel.org (mirrors.edge.kernel.org)... 147.75.101.1, 2604:1380:2001:3900::1
Connecting to mirrors.edge.kernel.org (mirrors.edge.kernel.org)|147.75.101.1|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6389118 (6.1M) [application/x-gzip]
Saving to: ‘git-2.12.2.tar.gz’

100%[===================================================================================>] 6,389,118    148KB/s   in 49s    

2019-06-17 06:04:20 (127 KB/s) - ‘git-2.12.2.tar.gz’ saved [6389118/6389118]

[root@node201.yinzhengjie.org.cn ~]# yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Package perl-ExtUtils-MakeMaker-6.68-3.el7.noarch already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package expat-devel.x86_64 0:2.1.0-10.el7_3 will be installed
---> Package gcc.x86_64 0:4.8.5-36.el7_6.2 will be installed
--> Processing Dependency: libgomp = 4.8.5-36.el7_6.2 for package: gcc-4.8.5-36.el7_6.2.x86_64
--> Processing Dependency: cpp = 4.8.5-36.el7_6.2 for package: gcc-4.8.5-36.el7_6.2.x86_64
--> Processing Dependency: libgcc >= 4.8.5-36.el7_6.2 for package: gcc-4.8.5-36.el7_6.2.x86_64
--> Processing Dependency: libmpfr.so.4()(64bit) for package: gcc-4.8.5-36.el7_6.2.x86_64
--> Processing Dependency: libmpc.so.3()(64bit) for package: gcc-4.8.5-36.el7_6.2.x86_64
---> Package gettext-devel.x86_64 0:0.19.8.1-2.el7 will be installed
--> Processing Dependency: gettext-common-devel = 0.19.8.1-2.el7 for package: gettext-devel-0.19.8.1-2.el7.x86_64
--> Processing Dependency: git for package: gettext-devel-0.19.8.1-2.el7.x86_64
---> Package libcurl-devel.x86_64 0:7.29.0-51.el7 will be installed
---> Package openssl-devel.x86_64 1:1.0.2k-16.el7_6.1 will be installed
--> Processing Dependency: openssl-libs(x86-64) = 1:1.0.2k-16.el7_6.1 for package: 1:openssl-devel-1.0.2k-16.el7_6.1.x86_64
--> Processing Dependency: krb5-devel(x86-64) for package: 1:openssl-devel-1.0.2k-16.el7_6.1.x86_64
---> Package zlib-devel.x86_64 0:1.2.7-18.el7 will be installed
--> Running transaction check
---> Package cpp.x86_64 0:4.8.5-36.el7_6.2 will be installed
---> Package gettext-common-devel.noarch 0:0.19.8.1-2.el7 will be installed
---> Package git.x86_64 0:1.8.3.1-20.el7 will be installed
--> Processing Dependency: perl-Git = 1.8.3.1-20.el7 for package: git-1.8.3.1-20.el7.x86_64
--> Processing Dependency: rsync for package: git-1.8.3.1-20.el7.x86_64
--> Processing Dependency: perl(Term::ReadKey) for package: git-1.8.3.1-20.el7.x86_64
--> Processing Dependency: perl(Git) for package: git-1.8.3.1-20.el7.x86_64
--> Processing Dependency: perl(Error) for package: git-1.8.3.1-20.el7.x86_64
---> Package krb5-devel.x86_64 0:1.15.1-37.el7_6 will be installed
--> Processing Dependency: libkadm5(x86-64) = 1.15.1-37.el7_6 for package: krb5-devel-1.15.1-37.el7_6.x86_64
--> Processing Dependency: krb5-libs(x86-64) = 1.15.1-37.el7_6 for package: krb5-devel-1.15.1-37.el7_6.x86_64
--> Processing Dependency: libverto-devel for package: krb5-devel-1.15.1-37.el7_6.x86_64
--> Processing Dependency: libselinux-devel for package: krb5-devel-1.15.1-37.el7_6.x86_64
--> Processing Dependency: libcom_err-devel for package: krb5-devel-1.15.1-37.el7_6.x86_64
--> Processing Dependency: keyutils-libs-devel for package: krb5-devel-1.15.1-37.el7_6.x86_64
---> Package libgcc.x86_64 0:4.8.5-36.el7 will be updated
---> Package libgcc.x86_64 0:4.8.5-36.el7_6.2 will be an update
---> Package libgomp.x86_64 0:4.8.5-36.el7 will be updated
---> Package libgomp.x86_64 0:4.8.5-36.el7_6.2 will be an update
---> Package libmpc.x86_64 0:1.0.1-3.el7 will be installed
---> Package mpfr.x86_64 0:3.1.1-4.el7 will be installed
---> Package openssl-libs.x86_64 1:1.0.2k-16.el7 will be updated
--> Processing Dependency: openssl-libs(x86-64) = 1:1.0.2k-16.el7 for package: 1:openssl-1.0.2k-16.el7.x86_64
---> Package openssl-libs.x86_64 1:1.0.2k-16.el7_6.1 will be an update
--> Running transaction check
---> Package keyutils-libs-devel.x86_64 0:1.5.8-3.el7 will be installed
---> Package krb5-libs.x86_64 0:1.15.1-34.el7 will be updated
---> Package krb5-libs.x86_64 0:1.15.1-37.el7_6 will be an update
---> Package libcom_err-devel.x86_64 0:1.42.9-13.el7 will be installed
---> Package libkadm5.x86_64 0:1.15.1-37.el7_6 will be installed
---> Package libselinux-devel.x86_64 0:2.5-14.1.el7 will be installed
--> Processing Dependency: libsepol-devel(x86-64) >= 2.5-10 for package: libselinux-devel-2.5-14.1.el7.x86_64
--> Processing Dependency: pkgconfig(libsepol) for package: libselinux-devel-2.5-14.1.el7.x86_64
--> Processing Dependency: pkgconfig(libpcre) for package: libselinux-devel-2.5-14.1.el7.x86_64
---> Package libverto-devel.x86_64 0:0.2.5-4.el7 will be installed
---> Package openssl.x86_64 1:1.0.2k-16.el7 will be updated
---> Package openssl.x86_64 1:1.0.2k-16.el7_6.1 will be an update
---> Package perl-Error.noarch 1:0.17020-2.el7 will be installed
---> Package perl-Git.noarch 0:1.8.3.1-20.el7 will be installed
---> Package perl-TermReadKey.x86_64 0:2.30-20.el7 will be installed
---> Package rsync.x86_64 0:3.1.2-6.el7_6.1 will be installed
--> Running transaction check
---> Package libsepol-devel.x86_64 0:2.5-10.el7 will be installed
---> Package pcre-devel.x86_64 0:8.32-17.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================
 Package                             Arch                  Version                              Repository              Size
=============================================================================================================================
Installing:
 expat-devel                         x86_64                2.1.0-10.el7_3                       base                    57 k
 gcc                                 x86_64                4.8.5-36.el7_6.2                     updates                 16 M
 gettext-devel                       x86_64                0.19.8.1-2.el7                       base                   320 k
 libcurl-devel                       x86_64                7.29.0-51.el7                        base                   302 k
 openssl-devel                       x86_64                1:1.0.2k-16.el7_6.1                  updates                1.5 M
 zlib-devel                          x86_64                1.2.7-18.el7                         base                    50 k
Installing for dependencies:
 cpp                                 x86_64                4.8.5-36.el7_6.2                     updates                5.9 M
 gettext-common-devel                noarch                0.19.8.1-2.el7                       base                   410 k
 git                                 x86_64                1.8.3.1-20.el7                       updates                4.4 M
 keyutils-libs-devel                 x86_64                1.5.8-3.el7                          base                    37 k
 krb5-devel                          x86_64                1.15.1-37.el7_6                      updates                271 k
 libcom_err-devel                    x86_64                1.42.9-13.el7                        base                    31 k
 libkadm5                            x86_64                1.15.1-37.el7_6                      updates                178 k
 libmpc                              x86_64                1.0.1-3.el7                          base                    51 k
 libselinux-devel                    x86_64                2.5-14.1.el7                         base                   187 k
 libsepol-devel                      x86_64                2.5-10.el7                           base                    77 k
 libverto-devel                      x86_64                0.2.5-4.el7                          base                    12 k
 mpfr                                x86_64                3.1.1-4.el7                          base                   203 k
 pcre-devel                          x86_64                8.32-17.el7                          base                   480 k
 perl-Error                          noarch                1:0.17020-2.el7                      base                    32 k
 perl-Git                            noarch                1.8.3.1-20.el7                       updates                 55 k
 perl-TermReadKey                    x86_64                2.30-20.el7                          base                    31 k
 rsync                               x86_64                3.1.2-6.el7_6.1                      updates                404 k
Updating for dependencies:
 krb5-libs                           x86_64                1.15.1-37.el7_6                      updates                803 k
 libgcc                              x86_64                4.8.5-36.el7_6.2                     updates                102 k
 libgomp                             x86_64                4.8.5-36.el7_6.2                     updates                158 k
 openssl                             x86_64                1:1.0.2k-16.el7_6.1                  updates                493 k
 openssl-libs                        x86_64                1:1.0.2k-16.el7_6.1                  updates                1.2 M

Transaction Summary
=============================================================================================================================
Install  6 Packages (+17 Dependent packages)
Upgrade             (  5 Dependent packages)

Total download size: 34 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/28): expat-devel-2.1.0-10.el7_3.x86_64.rpm                                                         |  57 kB  00:00:00     
(2/28): gettext-devel-0.19.8.1-2.el7.x86_64.rpm                                                       | 320 kB  00:00:00     
(3/28): gettext-common-devel-0.19.8.1-2.el7.noarch.rpm                                                | 410 kB  00:00:00     
(4/28): gcc-4.8.5-36.el7_6.2.x86_64.rpm                                                               |  16 MB  00:00:08     
(5/28): keyutils-libs-devel-1.5.8-3.el7.x86_64.rpm                                                    |  37 kB  00:00:00     
(6/28): git-1.8.3.1-20.el7.x86_64.rpm                                                                 | 4.4 MB  00:00:02     
(7/28): krb5-devel-1.15.1-37.el7_6.x86_64.rpm                                                         | 271 kB  00:00:00     
(8/28): libcom_err-devel-1.42.9-13.el7.x86_64.rpm                                                     |  31 kB  00:00:00     
(9/28): krb5-libs-1.15.1-37.el7_6.x86_64.rpm                                                          | 803 kB  00:00:00     
(10/28): libcurl-devel-7.29.0-51.el7.x86_64.rpm                                                       | 302 kB  00:00:00     
(11/28): libgcc-4.8.5-36.el7_6.2.x86_64.rpm                                                           | 102 kB  00:00:00     
(12/28): libgomp-4.8.5-36.el7_6.2.x86_64.rpm                                                          | 158 kB  00:00:00     
(13/28): libkadm5-1.15.1-37.el7_6.x86_64.rpm                                                          | 178 kB  00:00:00     
(14/28): libselinux-devel-2.5-14.1.el7.x86_64.rpm                                                     | 187 kB  00:00:00     
(15/28): libmpc-1.0.1-3.el7.x86_64.rpm                                                                |  51 kB  00:00:00     
(16/28): libsepol-devel-2.5-10.el7.x86_64.rpm                                                         |  77 kB  00:00:00     
(17/28): mpfr-3.1.1-4.el7.x86_64.rpm                                                                  | 203 kB  00:00:00     
(18/28): libverto-devel-0.2.5-4.el7.x86_64.rpm                                                        |  12 kB  00:00:00     
(19/28): openssl-1.0.2k-16.el7_6.1.x86_64.rpm                                                         | 493 kB  00:00:00     
(20/28): openssl-devel-1.0.2k-16.el7_6.1.x86_64.rpm                                                   | 1.5 MB  00:00:00     
(21/28): perl-Error-0.17020-2.el7.noarch.rpm                                                          |  32 kB  00:00:00     
(22/28): openssl-libs-1.0.2k-16.el7_6.1.x86_64.rpm                                                    | 1.2 MB  00:00:00     
(23/28): perl-Git-1.8.3.1-20.el7.noarch.rpm                                                           |  55 kB  00:00:00     
(24/28): perl-TermReadKey-2.30-20.el7.x86_64.rpm                                                      |  31 kB  00:00:00     
(25/28): rsync-3.1.2-6.el7_6.1.x86_64.rpm                                                             | 404 kB  00:00:00     
(26/28): zlib-devel-1.2.7-18.el7.x86_64.rpm                                                           |  50 kB  00:00:00     
(27/28): cpp-4.8.5-36.el7_6.2.x86_64.rpm                                                              | 5.9 MB  00:00:14     
(28/28): pcre-devel-8.32-17.el7.x86_64.rpm                                                            | 480 kB  00:00:02     
-----------------------------------------------------------------------------------------------------------------------------
Total                                                                                        2.1 MB/s |  34 MB  00:00:15     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : 1:openssl-libs-1.0.2k-16.el7_6.1.x86_64                                                                  1/33 
  Updating   : krb5-libs-1.15.1-37.el7_6.x86_64                                                                         2/33 
  Installing : mpfr-3.1.1-4.el7.x86_64                                                                                  3/33 
  Installing : libmpc-1.0.1-3.el7.x86_64                                                                                4/33 
  Installing : 1:perl-Error-0.17020-2.el7.noarch                                                                        5/33 
  Installing : cpp-4.8.5-36.el7_6.2.x86_64                                                                              6/33 
  Installing : libkadm5-1.15.1-37.el7_6.x86_64                                                                          7/33 
  Installing : libsepol-devel-2.5-10.el7.x86_64                                                                         8/33 
  Installing : gettext-common-devel-0.19.8.1-2.el7.noarch                                                               9/33 
  Updating   : libgomp-4.8.5-36.el7_6.2.x86_64                                                                         10/33 
  Updating   : libgcc-4.8.5-36.el7_6.2.x86_64                                                                          11/33 
  Installing : zlib-devel-1.2.7-18.el7.x86_64                                                                          12/33 
  Installing : perl-TermReadKey-2.30-20.el7.x86_64                                                                     13/33 
  Installing : libverto-devel-0.2.5-4.el7.x86_64                                                                       14/33 
  Installing : libcom_err-devel-1.42.9-13.el7.x86_64                                                                   15/33 
  Installing : rsync-3.1.2-6.el7_6.1.x86_64                                                                            16/33 
  Installing : perl-Git-1.8.3.1-20.el7.noarch                                                                          17/33 
  Installing : git-1.8.3.1-20.el7.x86_64                                                                               18/33 
  Installing : pcre-devel-8.32-17.el7.x86_64                                                                           19/33 
  Installing : libselinux-devel-2.5-14.1.el7.x86_64                                                                    20/33 
  Installing : keyutils-libs-devel-1.5.8-3.el7.x86_64                                                                  21/33 
  Installing : krb5-devel-1.15.1-37.el7_6.x86_64                                                                       22/33 
  Installing : 1:openssl-devel-1.0.2k-16.el7_6.1.x86_64                                                                23/33 
  Installing : gettext-devel-0.19.8.1-2.el7.x86_64                                                                     24/33 
  Installing : gcc-4.8.5-36.el7_6.2.x86_64                                                                             25/33 
  Updating   : 1:openssl-1.0.2k-16.el7_6.1.x86_64                                                                      26/33 
  Installing : libcurl-devel-7.29.0-51.el7.x86_64                                                                      27/33 
  Installing : expat-devel-2.1.0-10.el7_3.x86_64                                                                       28/33 
  Cleanup    : 1:openssl-1.0.2k-16.el7.x86_64                                                                          29/33 
  Cleanup    : 1:openssl-libs-1.0.2k-16.el7.x86_64                                                                     30/33 
  Cleanup    : krb5-libs-1.15.1-34.el7.x86_64                                                                          31/33 
  Cleanup    : libgomp-4.8.5-36.el7.x86_64                                                                             32/33 
  Cleanup    : libgcc-4.8.5-36.el7.x86_64                                                                              33/33 
  Verifying  : gettext-devel-0.19.8.1-2.el7.x86_64                                                                      1/33 
  Verifying  : keyutils-libs-devel-1.5.8-3.el7.x86_64                                                                   2/33 
  Verifying  : pcre-devel-8.32-17.el7.x86_64                                                                            3/33 
  Verifying  : gcc-4.8.5-36.el7_6.2.x86_64                                                                              4/33 
  Verifying  : rsync-3.1.2-6.el7_6.1.x86_64                                                                             5/33 
  Verifying  : libcom_err-devel-1.42.9-13.el7.x86_64                                                                    6/33 
  Verifying  : krb5-devel-1.15.1-37.el7_6.x86_64                                                                        7/33 
  Verifying  : expat-devel-2.1.0-10.el7_3.x86_64                                                                        8/33 
  Verifying  : libverto-devel-0.2.5-4.el7.x86_64                                                                        9/33 
  Verifying  : perl-TermReadKey-2.30-20.el7.x86_64                                                                     10/33 
  Verifying  : zlib-devel-1.2.7-18.el7.x86_64                                                                          11/33 
  Verifying  : krb5-libs-1.15.1-37.el7_6.x86_64                                                                        12/33 
  Verifying  : perl-Git-1.8.3.1-20.el7.noarch                                                                          13/33 
  Verifying  : libgcc-4.8.5-36.el7_6.2.x86_64                                                                          14/33 
  Verifying  : libgomp-4.8.5-36.el7_6.2.x86_64                                                                         15/33 
  Verifying  : gettext-common-devel-0.19.8.1-2.el7.noarch                                                              16/33 
  Verifying  : 1:openssl-1.0.2k-16.el7_6.1.x86_64                                                                      17/33 
  Verifying  : 1:perl-Error-0.17020-2.el7.noarch                                                                       18/33 
  Verifying  : git-1.8.3.1-20.el7.x86_64                                                                               19/33 
  Verifying  : 1:openssl-libs-1.0.2k-16.el7_6.1.x86_64                                                                 20/33 
  Verifying  : libmpc-1.0.1-3.el7.x86_64                                                                               21/33 
  Verifying  : libsepol-devel-2.5-10.el7.x86_64                                                                        22/33 
  Verifying  : 1:openssl-devel-1.0.2k-16.el7_6.1.x86_64                                                                23/33 
  Verifying  : libkadm5-1.15.1-37.el7_6.x86_64                                                                         24/33 
  Verifying  : mpfr-3.1.1-4.el7.x86_64                                                                                 25/33 
  Verifying  : libcurl-devel-7.29.0-51.el7.x86_64                                                                      26/33 
  Verifying  : libselinux-devel-2.5-14.1.el7.x86_64                                                                    27/33 
  Verifying  : cpp-4.8.5-36.el7_6.2.x86_64                                                                             28/33 
  Verifying  : libgcc-4.8.5-36.el7.x86_64                                                                              29/33 
  Verifying  : 1:openssl-libs-1.0.2k-16.el7.x86_64                                                                     30/33 
  Verifying  : 1:openssl-1.0.2k-16.el7.x86_64                                                                          31/33 
  Verifying  : libgomp-4.8.5-36.el7.x86_64                                                                             32/33 
  Verifying  : krb5-libs-1.15.1-34.el7.x86_64                                                                          33/33 

Installed:
  expat-devel.x86_64 0:2.1.0-10.el7_3    gcc.x86_64 0:4.8.5-36.el7_6.2              gettext-devel.x86_64 0:0.19.8.1-2.el7  
  libcurl-devel.x86_64 0:7.29.0-51.el7   openssl-devel.x86_64 1:1.0.2k-16.el7_6.1   zlib-devel.x86_64 0:1.2.7-18.el7       

Dependency Installed:
  cpp.x86_64 0:4.8.5-36.el7_6.2                              gettext-common-devel.noarch 0:0.19.8.1-2.el7                    
  git.x86_64 0:1.8.3.1-20.el7                                keyutils-libs-devel.x86_64 0:1.5.8-3.el7                        
  krb5-devel.x86_64 0:1.15.1-37.el7_6                        libcom_err-devel.x86_64 0:1.42.9-13.el7                         
  libkadm5.x86_64 0:1.15.1-37.el7_6                          libmpc.x86_64 0:1.0.1-3.el7                                     
  libselinux-devel.x86_64 0:2.5-14.1.el7                     libsepol-devel.x86_64 0:2.5-10.el7                              
  libverto-devel.x86_64 0:0.2.5-4.el7                        mpfr.x86_64 0:3.1.1-4.el7                                       
  pcre-devel.x86_64 0:8.32-17.el7                            perl-Error.noarch 1:0.17020-2.el7                               
  perl-Git.noarch 0:1.8.3.1-20.el7                           perl-TermReadKey.x86_64 0:2.30-20.el7                           
  rsync.x86_64 0:3.1.2-6.el7_6.1                            

Dependency Updated:
  krb5-libs.x86_64 0:1.15.1-37.el7_6      libgcc.x86_64 0:4.8.5-36.el7_6.2             libgomp.x86_64 0:4.8.5-36.el7_6.2     
  openssl.x86_64 1:1.0.2k-16.el7_6.1      openssl-libs.x86_64 1:1.0.2k-16.el7_6.1     

Complete!
[root@node201.yinzhengjie.org.cn ~]# 
[root@node201.yinzhengjie.org.cn ~]# yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker

3>.配置git的安裝路徑

[root@node201.yinzhengjie.org.cn ~]# ll
total 6240
-rw-r--r-- 1 root root 6389118 Mar 24  2017 git-2.12.2.tar.gz
[root@node201.yinzhengjie.org.cn ~]# 
[root@node201.yinzhengjie.org.cn ~]# tar -zxf git-2.12.2.tar.gz 
[root@node201.yinzhengjie.org.cn ~]# 
[root@node201.yinzhengjie.org.cn ~]# cd git-2.12.2
[root@node201.yinzhengjie.org.cn ~/git-2.12.2]# 
[root@node201.yinzhengjie.org.cn ~/git-2.12.2]# ll | wc -l
370
[root@node201.yinzhengjie.org.cn ~/git-2.12.2]# 
[root@node201.yinzhengjie.org.cn ~/git-2.12.2]# 
[root@node201.yinzhengjie.org.cn ~/git-2.12.2]# ll | grep configure
-rwxr-x---  1 110493 5000 247637 Mar 24  2017 configure
-rw-rw-r--  1 root   root  35929 Mar 24  2017 configure.ac
[root@node201.yinzhengjie.org.cn ~/git-2.12.2]# 
[root@node201.yinzhengjie.org.cn ~/git-2.12.2]# ./configure prefix=/yinzhengjie/softwares/git/
configure: Setting lib to 'lib' (the default)
configure: Will try -pthread then -lpthread to enable POSIX Threads.
configure: CHECKS for site configuration
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for size_t... yes
checking for working alloca.h... yes
checking for alloca... yes
configure: CHECKS for programs
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking for inline... inline
checking if linker supports -R... no
checking if linker supports -Wl,-rpath,... yes
checking for gar... no
checking for ar... ar
checking for gtar... gtar
checking for gnudiff... no
checking for gdiff... no
checking for diff... diff
checking for asciidoc... no
Using 'grep -a' for sane_grep
configure: CHECKS for libraries
checking for SHA1_Init in -lcrypto... yes
checking for curl_global_init in -lcurl... yes
checking for curl-config... curl-config
checking if Curl supports SSL... yes
checking for XML_ParserCreate in -lexpat... yes
checking for iconv in -lc... yes
checking for deflateBound in -lz... yes
checking for socket in -lc... yes
checking for inet_ntop... yes
checking for inet_pton... yes
checking for hstrerror... yes
checking for basename in -lc... yes
checking for gettext in -lc... yes
checking libintl.h usability... yes
checking libintl.h presence... yes
checking for libintl.h... yes
configure: CHECKS for header files
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/poll.h usability... yes
checking sys/poll.h presence... yes
checking for sys/poll.h... yes
checking for inttypes.h... (cached) yes
checking for old iconv()... no
configure: CHECKS for typedefs, structures, and compiler characteristics
checking for socklen_t... yes
checking for struct itimerval... yes
checking for struct stat.st_mtimespec.tv_nsec... no
checking for struct stat.st_mtim.tv_nsec... yes
checking for struct dirent.d_type... yes
checking for struct passwd.pw_gecos... yes
checking for struct sockaddr_storage... yes
checking for struct addrinfo... yes
checking for getaddrinfo... yes
checking for library containing getaddrinfo... none required
checking whether the platform regex supports REG_STARTEND... yes
checking whether system succeeds to read fopen'ed directory... no
checking whether snprintf() and/or vsnprintf() return bogus value... no
checking whether the platform uses typical file type bits... yes
configure: CHECKS for library functions
checking libgen.h usability... yes
checking libgen.h presence... yes
checking for libgen.h... yes
checking paths.h usability... yes
checking paths.h presence... yes
checking for paths.h... yes
checking libcharset.h usability... no
checking libcharset.h presence... no
checking for libcharset.h... no
checking for strings.h... (cached) yes
checking for locale_charset in -liconv... no
checking for locale_charset in -lcharset... no
checking for clock_gettime... yes
checking for library containing clock_gettime... none required
checking for CLOCK_MONOTONIC... yes
checking for setitimer... yes
checking for library containing setitimer... none required
checking for strcasestr... yes
checking for library containing strcasestr... none required
checking for memmem... yes
checking for library containing memmem... none required
checking for strlcpy... no
checking for uintmax_t... yes
checking for strtoumax... yes
checking for library containing strtoumax... none required
checking for setenv... yes
checking for library containing setenv... none required
checking for unsetenv... yes
checking for library containing unsetenv... none required
checking for mkdtemp... yes
checking for library containing mkdtemp... none required
checking for initgroups... yes
checking for library containing initgroups... none required
checking for getdelim... yes
checking for library containing getdelim... none required
checking for BSD sysctl... no
checking for POSIX Threads with ''... no
checking for POSIX Threads with '-mt'... no
checking for POSIX Threads with '-pthread'... yes
configure: creating ./config.status
config.status: creating config.mak.autogen
config.status: executing config.mak.autogen commands
[root@node201.yinzhengjie.org.cn ~/git-2.12.2]# echo $?
0
[root@node201.yinzhengjie.org.cn ~/git-2.12.2]# 
[root@node201.yinzhengjie.org.cn ~/git-2.12.2]# ./configure prefix=/yinzhengjie/softwares/git/

3>.編譯git

[root@node201.yinzhengjie.org.cn ~/git-2.12.2]# make -j 4
......
    BUILTIN git-rm
    BUILTIN git-send-pack
    BUILTIN git-shortlog
    BUILTIN git-show-branch
    BUILTIN git-show-ref
    BUILTIN git-stripspace
    BUILTIN git-submodule--helper
    BUILTIN git-symbolic-ref
    BUILTIN git-tag
    BUILTIN git-unpack-file
    BUILTIN git-unpack-objects
    BUILTIN git-update-index
    BUILTIN git-update-ref
    BUILTIN git-update-server-info
    BUILTIN git-upload-archive
    BUILTIN git-var
    BUILTIN git-verify-commit
    BUILTIN git-verify-pack
    BUILTIN git-verify-tag
    BUILTIN git-worktree
    BUILTIN git-write-tree
    BUILTIN git-cherry
    BUILTIN git-cherry-pick
    BUILTIN git-format-patch
    BUILTIN git-fsck-objects
    BUILTIN git-init
    BUILTIN git-merge-subtree
    BUILTIN git-show
    BUILTIN git-stage
    BUILTIN git-status
    BUILTIN git-whatchanged
    SUBDIR git-gui
GITGUI_VERSION = 0.20.0.44.gccc98
    * new locations or Tcl/Tk interpreter
    MSGFMT    po/de.msg     MSGFMT po/pt_pt.msg     MSGFMT    po/vi.msg     MSGFMT    po/hu.msg 520 translated.
550 translated.
    MSGFMT    po/nb.msg 514 translated.
543 translated.
    MSGFMT    po/sv.msg     MSGFMT    po/fr.msg     MSGFMT    po/it.msg 474 translated, 39 untranslated.
547 translated.
    MSGFMT    po/ja.msg 519 translated, 1 untranslated.
520 translated.
    MSGFMT po/pt_br.msg     MSGFMT    po/bg.msg     MSGFMT    po/ru.msg 546 translated, 1 untranslated.
520 translated.
    MSGFMT po/zh_cn.msg     MSGFMT    po/el.msg 565 translated.
520 translated.
    GEN git-gui
    INDEX lib/
366 translated, 7 fuzzy, 17 untranslated.
    * tclsh failed; using unoptimized loading
381 translated, 4 fuzzy, 6 untranslated.
    SUBDIR gitk-git
Generating catalog po/de.msg
Generating catalog po/pt_pt.msg
msgfmt --statistics --tcl po/de.po -l de -d po/
msgfmt --statistics --tcl po/pt_pt.po -l pt_pt -d po/
    * new Tcl/Tk interpreter location
Generating catalog po/vi.msg
Generating catalog po/ca.msg
msgfmt --statistics --tcl po/vi.po -l vi -d po/
307 translated messages.
msgfmt --statistics --tcl po/ca.po -l ca -d po/
311 translated messages.
Generating catalog po/hu.msg
msgfmt --statistics --tcl po/hu.po -l hu -d po/
307 translated messages.
Generating catalog po/es.msg
Generating catalog po/sv.msg
307 translated messages.
msgfmt --statistics --tcl po/es.po -l es -d po/
msgfmt --statistics --tcl po/sv.po -l sv -d po/
Generating catalog po/fr.msg
msgfmt --statistics --tcl po/fr.po -l fr -d po/
277 translated messages, 18 fuzzy translations, 12 untranslated messages.
Generating catalog po/it.msg
msgfmt --statistics --tcl po/it.po -l it -d po/
184 translated messages, 46 fuzzy translations, 77 untranslated messages.
311 translated messages.
Generating catalog po/ja.msg
Generating catalog po/pt_br.msg
msgfmt --statistics --tcl po/ja.po -l ja -d po/
msgfmt --statistics --tcl po/pt_br.po -l pt_br -d po/
311 translated messages.
Generating catalog po/bg.msg
274 translated messages, 17 fuzzy translations, 16 untranslated messages.
msgfmt --statistics --tcl po/bg.po -l bg -d po/
Generating catalog po/ru.msg
msgfmt --statistics --tcl po/ru.po -l ru -d po/
279 translated messages, 16 fuzzy translations, 12 untranslated messages.
311 translated messages.
    GEN gitk-wish
311 translated messages.
317 translated messages.
    SUBDIR perl
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git/SVN/Editor.pm >blib/lib/Git/SVN/Editor.pm
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git/SVN/Migration.pm >blib/lib/Git/SVN/Migration.pm
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git/SVN/Log.pm >blib/lib/Git/SVN/Log.pm
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git/SVN.pm >blib/lib/Git/SVN.pm
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git/SVN/Memoize/YAML.pm >blib/lib/Git/SVN/Memoize/YAML.pm
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git/SVN/Ra.pm >blib/lib/Git/SVN/Ra.pm
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git/I18N.pm >blib/lib/Git/I18N.pm
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git/SVN/Prompt.pm >blib/lib/Git/SVN/Prompt.pm
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git/SVN/GlobSpec.pm >blib/lib/Git/SVN/GlobSpec.pm
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git/SVN/Fetcher.pm >blib/lib/Git/SVN/Fetcher.pm
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git/IndexInfo.pm >blib/lib/Git/IndexInfo.pm
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git/SVN/Utils.pm >blib/lib/Git/SVN/Utils.pm
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git.pm >blib/lib/Git.pm
Manifying blib/man3/Git::SVN::Editor.3pm
Manifying blib/man3/Git::SVN::Memoize::YAML.3pm
Manifying blib/man3/Git::SVN::Ra.3pm
Manifying blib/man3/Git::I18N.3pm
Manifying blib/man3/Git::SVN::Prompt.3pm
Manifying blib/man3/Git::SVN::Fetcher.3pm
Manifying blib/man3/Git::SVN::Utils.3pm
Manifying blib/man3/Git.3pm
    SUBDIR templates
[root@node201.yinzhengjie.org.cn ~/git-2.12.2]#
[root@node201.yinzhengjie.org.cn ~/git-2.12.2]# make -j 4

4>.安裝git

[root@node201.yinzhengjie.org.cn ~/git-2.12.2]# make install
    SUBDIR perl
/usr/bin/perl Makefile.PL PREFIX='/yinzhengjie/softwares/git' INSTALL_BASE='' --localedir='/yinzhengjie/softwares/git/share/locale'
Writing perl.mak for Git
    GEN git-add--interactive
    GEN git-archimport
    GEN git-cvsexportcommit
    GEN git-cvsimport
    GEN git-cvsserver
    GEN git-send-email
    GEN git-svn
    SUBDIR git-gui
    SUBDIR gitk-git
    SUBDIR perl
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git/SVN/Editor.pm >blib/lib/Git/SVN/Editor.pm
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git/SVN/Migration.pm >blib/lib/Git/SVN/Migration.pm
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git/SVN/Log.pm >blib/lib/Git/SVN/Log.pm
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git/SVN.pm >blib/lib/Git/SVN.pm
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git/SVN/Memoize/YAML.pm >blib/lib/Git/SVN/Memoize/YAML.pm
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git/SVN/Ra.pm >blib/lib/Git/SVN/Ra.pm
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git/I18N.pm >blib/lib/Git/I18N.pm
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git/SVN/Prompt.pm >blib/lib/Git/SVN/Prompt.pm
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git/SVN/GlobSpec.pm >blib/lib/Git/SVN/GlobSpec.pm
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git/SVN/Fetcher.pm >blib/lib/Git/SVN/Fetcher.pm
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git/IndexInfo.pm >blib/lib/Git/IndexInfo.pm
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git/SVN/Utils.pm >blib/lib/Git/SVN/Utils.pm
/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></yinzhengjie/softwares/git/share/locale>" <Git.pm >blib/lib/Git.pm
    SUBDIR templates
install -d -m 755 '/yinzhengjie/softwares/git/bin'
install -d -m 755 '/yinzhengjie/softwares/git/libexec/git-core'
install   git-credential-store git-daemon git-fast-import git-http-backend git-imap-send git-sh-i18n--envsubst git-shell git-show-index git-upload-pack git-remote-testsvn git-http-fetch git-http-push git-credential-cache git-credential-cache--daemon git-remote-http git-remote-https git-remote-ftp git-remote-ftps git-bisect git-difftool--helper git-filter-branch git-merge-octopus git-merge-one-file git-merge-resolve git-mergetool git-quiltimport git-rebase git-request-pull git-stash git-submodule git-web--browse git-add--interactive git-archimport git-cvsexportcommit git-cvsimport git-cvsserver git-send-email git-svn git-p4 git-instaweb '/yinzhengjie/softwares/git/libexec/git-core'
install -m 644  git-mergetool--lib git-parse-remote git-rebase--am git-rebase--interactive git-rebase--merge git-sh-setup git-sh-i18n '/yinzhengjie/softwares/git/libexec/git-core'
install git git-upload-pack git-receive-pack git-upload-archive git-shell git-cvsserver '/yinzhengjie/softwares/git/bin'
make -C templates DESTDIR='' install
make[1]: Entering directory `/root/git-2.12.2/templates'
install -d -m 755 '/yinzhengjie/softwares/git/share/git-core/templates'
(cd blt && gtar cf - .) | \
(cd '/yinzhengjie/softwares/git/share/git-core/templates' && umask 022 && gtar xof -)
make[1]: Leaving directory `/root/git-2.12.2/templates'
install -d -m 755 '/yinzhengjie/softwares/git/libexec/git-core/mergetools'
install -m 644 mergetools/* '/yinzhengjie/softwares/git/libexec/git-core/mergetools'
install -d -m 755 '/yinzhengjie/softwares/git/share/locale'
(cd po/build/locale && gtar cf - .) | \
(cd '/yinzhengjie/softwares/git/share/locale' && umask 022 && gtar xof -)
make -C perl prefix='/yinzhengjie/softwares/git' DESTDIR='' install
make[1]: Entering directory `/root/git-2.12.2/perl'
make[2]: Entering directory `/root/git-2.12.2/perl'
Installing /yinzhengjie/softwares/git/share/perl5/Git.pm
Installing /yinzhengjie/softwares/git/share/perl5/Git/SVN.pm
Installing /yinzhengjie/softwares/git/share/perl5/Git/I18N.pm
Installing /yinzhengjie/softwares/git/share/perl5/Git/IndexInfo.pm
Installing /yinzhengjie/softwares/git/share/perl5/Git/SVN/Editor.pm
Installing /yinzhengjie/softwares/git/share/perl5/Git/SVN/Migration.pm
Installing /yinzhengjie/softwares/git/share/perl5/Git/SVN/Log.pm
Installing /yinzhengjie/softwares/git/share/perl5/Git/SVN/Ra.pm
Installing /yinzhengjie/softwares/git/share/perl5/Git/SVN/Prompt.pm
Installing /yinzhengjie/softwares/git/share/perl5/Git/SVN/GlobSpec.pm
Installing /yinzhengjie/softwares/git/share/perl5/Git/SVN/Fetcher.pm
Installing /yinzhengjie/softwares/git/share/perl5/Git/SVN/Utils.pm
Installing /yinzhengjie/softwares/git/share/perl5/Git/SVN/Memoize/YAML.pm
Installing /yinzhengjie/softwares/git/share/man/man3/Git::SVN::Editor.3pm
Installing /yinzhengjie/softwares/git/share/man/man3/Git::SVN::Memoize::YAML.3pm
Installing /yinzhengjie/softwares/git/share/man/man3/Git::SVN::Ra.3pm
Installing /yinzhengjie/softwares/git/share/man/man3/Git::I18N.3pm
Installing /yinzhengjie/softwares/git/share/man/man3/Git::SVN::Prompt.3pm
Installing /yinzhengjie/softwares/git/share/man/man3/Git::SVN::Fetcher.3pm
Installing /yinzhengjie/softwares/git/share/man/man3/Git::SVN::Utils.3pm
Installing /yinzhengjie/softwares/git/share/man/man3/Git.3pm
Appending installation info to /yinzhengjie/softwares/git/lib64/perl5/perllocal.pod
make[2]: Leaving directory `/root/git-2.12.2/perl'
make[1]: Leaving directory `/root/git-2.12.2/perl'
make -C gitweb install
make[1]: Entering directory `/root/git-2.12.2/gitweb'
make[2]: Entering directory `/root/git-2.12.2'
make[2]: `GIT-VERSION-FILE' is up to date.
make[2]: Leaving directory `/root/git-2.12.2'
    GEN gitweb.cgi
    GEN static/gitweb.js
install -d -m 755 '/yinzhengjie/softwares/git/share/gitweb'
install -m 755 gitweb.cgi '/yinzhengjie/softwares/git/share/gitweb'
install -d -m 755 '/yinzhengjie/softwares/git/share/gitweb/static'
install -m 644 static/gitweb.js static/gitweb.css static/git-logo.png static/git-favicon.png '/yinzhengjie/softwares/git/share/gitweb/static'
make[1]: Leaving directory `/root/git-2.12.2/gitweb'
make -C gitk-git install
make[1]: Entering directory `/root/git-2.12.2/gitk-git'
install -d -m 755 '/yinzhengjie/softwares/git/bin'
install -m 755 gitk-wish '/yinzhengjie/softwares/git/bin'/gitk
install -d -m 755 '/yinzhengjie/softwares/git/share/gitk/lib/msgs'
install -m 644 po/de.msg '/yinzhengjie/softwares/git/share/gitk/lib/msgs' &&  install -m 644 po/ja.msg '/yinzhengjie/softwares/git/share/gitk/lib/msgs' &&  install -m 644 po/sv.msg '/yinzhengjie/softwares/git/share/gitk/lib/msgs' &&  install -m 644 po/it.msg '/yinzhengjie/softwares/git/share/gitk/lib/msgs' &&  install -m 644 po/hu.msg '/yinzhengjie/softwares/git/share/gitk/lib/msgs' &&  install -m 644 po/pt_pt.msg '/yinzhengjie/softwares/git/share/gitk/lib/msgs' &&  install -m 644 po/fr.msg '/yinzhengjie/softwares/git/share/gitk/lib/msgs' &&  install -m 644 po/pt_br.msg '/yinzhengjie/softwares/git/share/gitk/lib/msgs' &&  install -m 644 po/ru.msg '/yinzhengjie/softwares/git/share/gitk/lib/msgs' &&  install -m 644 po/ca.msg '/yinzhengjie/softwares/git/share/gitk/lib/msgs' &&  install -m 644 po/vi.msg '/yinzhengjie/softwares/git/share/gitk/lib/msgs' &&  install -m 644 po/bg.msg '/yinzhengjie/softwares/git/share/gitk/lib/msgs' &&  install -m 644 po/es.msg '/yinzhengjie/softwares/git/share/gitk/lib/msgs' && true
make[1]: Leaving directory `/root/git-2.12.2/gitk-git'
make -C git-gui gitexecdir='/yinzhengjie/softwares/git/libexec/git-core' install
make[1]: Entering directory `/root/git-2.12.2/git-gui'
  DEST /yinzhengjie/softwares/git/libexec/git-core
    INSTALL 755 git-gui
    INSTALL 755 git-gui--askpass
    LINK        git-citool -> git-gui
  DEST /yinzhengjie/softwares/git/share/git-gui/lib
    INSTALL 644 tclIndex
    INSTALL 644 themed.tcl
    INSTALL 644 line.tcl
    INSTALL 644 console.tcl
    INSTALL 644 checkout_op.tcl
    INSTALL 644 transport.tcl
    INSTALL 644 remote_add.tcl
    INSTALL 644 browser.tcl
    INSTALL 644 tools.tcl
    INSTALL 644 branch_checkout.tcl
    INSTALL 644 spellcheck.tcl
    INSTALL 644 status_bar.tcl
    INSTALL 644 diff.tcl
    INSTALL 644 remote.tcl
    INSTALL 644 choose_font.tcl
    INSTALL 644 option.tcl
    INSTALL 644 mergetool.tcl
    INSTALL 644 tools_dlg.tcl
    INSTALL 644 search.tcl
    INSTALL 644 shortcut.tcl
    INSTALL 644 branch_rename.tcl
    INSTALL 644 class.tcl
    INSTALL 644 remote_branch_delete.tcl
    INSTALL 644 choose_repository.tcl
    INSTALL 644 about.tcl
    INSTALL 644 blame.tcl
    INSTALL 644 branch.tcl
    INSTALL 644 win32.tcl
    INSTALL 644 sshkey.tcl
    INSTALL 644 branch_create.tcl
    INSTALL 644 commit.tcl
    INSTALL 644 branch_delete.tcl
    INSTALL 644 index.tcl
    INSTALL 644 encoding.tcl
    INSTALL 644 logo.tcl
    INSTALL 644 date.tcl
    INSTALL 644 choose_rev.tcl
    INSTALL 644 database.tcl
    INSTALL 644 error.tcl
    INSTALL 644 merge.tcl
    INSTALL 644 git-gui.ico
    INSTALL 644 win32_shortcut.js
  DEST /yinzhengjie/softwares/git/share/git-gui/lib/msgs
    INSTALL 644 pt_br.msg
    INSTALL 644 hu.msg
    INSTALL 644 zh_cn.msg
    INSTALL 644 de.msg
    INSTALL 644 sv.msg
    INSTALL 644 it.msg
    INSTALL 644 ja.msg
    INSTALL 644 pt_pt.msg
    INSTALL 644 fr.msg
    INSTALL 644 ru.msg
    INSTALL 644 el.msg
    INSTALL 644 vi.msg
    INSTALL 644 bg.msg
    INSTALL 644 nb.msg
make[1]: Leaving directory `/root/git-2.12.2/git-gui'
bindir=$(cd '/yinzhengjie/softwares/git/bin' && pwd) && \
execdir=$(cd '/yinzhengjie/softwares/git/libexec/git-core' && pwd) && \
{ test "$bindir/" = "$execdir/" || \
  for p in git git-shell git-upload-pack git-cvsserver; do \
        rm -f "$execdir/$p" && \
        test -z "" && \
        ln "$bindir/$p" "$execdir/$p" 2>/dev/null || \
        cp "$bindir/$p" "$execdir/$p" || exit; \
  done; \
} && \
for p in git-receive-pack git-upload-archive; do \
        rm -f "$bindir/$p" && \
        test -z "" && \
        ln "$bindir/git" "$bindir/$p" 2>/dev/null || \
        ln -s "git" "$bindir/$p" 2>/dev/null || \
        cp "$bindir/git" "$bindir/$p" || exit; \
done && \
for p in  git-add git-am git-annotate git-apply git-archive git-bisect--helper git-blame git-branch git-bundle git-cat-file git-check-attr git-check-ignore git-check-mailmap git-check-ref-format git-checkout-index git-checkout git-clean git-clone git-column git-commit-tree git-commit git-config git-count-objects git-credential git-describe git-diff-files git-diff-index git-diff-tree git-diff git-difftool git-fast-export git-fetch-pack git-fetch git-fmt-merge-msg git-for-each-ref git-fsck git-gc git-get-tar-commit-id git-grep git-hash-object git-help git-index-pack git-init-db git-interpret-trailers git-log git-ls-files git-ls-remote git-ls-tree git-mailinfo git-mailsplit git-merge git-merge-base git-merge-file git-merge-index git-merge-ours git-merge-recursive git-merge-tree git-mktag git-mktree git-mv git-name-rev git-notes git-pack-objects git-pack-redundant git-pack-refs git-patch-id git-prune-packed git-prune git-pull git-push git-read-tree git-receive-pack git-reflog git-remote git-remote-ext git-remote-fd git-repack git-replace git-rerere git-reset git-rev-list git-rev-parse git-revert git-rm git-send-pack git-shortlog git-show-branch git-show-ref git-stripspace git-submodule--helper git-symbolic-ref git-tag git-unpack-file git-unpack-objects git-update-index git-update-ref git-update-server-info git-upload-archive git-var git-verify-commit git-verify-pack git-verify-tag git-worktree git-write-tree git-cherry git-cherry-pick git-format-patch git-fsck-objects git-init git-merge-subtree git-show git-stage git-status git-whatchanged; do \
        rm -f "$execdir/$p" && \
        test -z "" && \
        ln "$execdir/git" "$execdir/$p" 2>/dev/null || \
        ln -s "git" "$execdir/$p" 2>/dev/null || \
        cp "$execdir/git" "$execdir/$p" || exit; \
done && \
remote_curl_aliases="git-remote-https git-remote-ftp git-remote-ftps" && \
for p in $remote_curl_aliases; do \
        rm -f "$execdir/$p" && \
        test -z "" && \
        ln "$execdir/git-remote-http" "$execdir/$p" 2>/dev/null || \
        ln -s "git-remote-http" "$execdir/$p" 2>/dev/null || \
        cp "$execdir/git-remote-http" "$execdir/$p" || exit; \
done && \
./check_bindir "z$bindir" "z$execdir" "$bindir/git-add"
[root@node201.yinzhengjie.org.cn ~/git-2.12.2]# echo $?
0
[root@node201.yinzhengjie.org.cn ~/git-2.12.2]# 
[root@node201.yinzhengjie.org.cn ~/git-2.12.2]# make install

5>.爲git配置環境變量

[root@node201.yinzhengjie.org.cn ~]# tail -3 /etc/profile
#ADD git PATH by yinzhengjie
GIT_HOME=/yinzhengjie/softwares/git
PATH=$PATH:$GIT_HOME/bin
[root@node201.yinzhengjie.org.cn ~]# 
[root@node201.yinzhengjie.org.cn ~]# 
[root@node201.yinzhengjie.org.cn ~]# source /etc/profile
[root@node201.yinzhengjie.org.cn ~]# 
[root@node201.yinzhengjie.org.cn ~]# git version
git version 2.12.2
[root@node201.yinzhengjie.org.cn ~]# 

 6>.配置Git

[root@node201.yinzhengjie.org.cn ~]# git config --list                            #查看全局配置信息,等效於"git config -l"
[root@node201.yinzhengjie.org.cn ~]# 
[root@node201.yinzhengjie.org.cn ~]# 
[root@node201.yinzhengjie.org.cn ~]# git config --global user.name "yinzhengjie"                   #提交git用戶信息,即配置使用者git的用戶
[root@node201.yinzhengjie.org.cn ~]# 
[root@node201.yinzhengjie.org.cn ~]# git config --global user.email "y1053419035@qq.com"          #提交郵箱,即配置git使用的郵箱
[root@node201.yinzhengjie.org.cn ~]# 
[root@node201.yinzhengjie.org.cn ~]# git config --global color.ui true                      #顯示語法高亮
[root@node201.yinzhengjie.org.cn ~]# 
[root@node201.yinzhengjie.org.cn ~]# git config --list         
user.name=yinzhengjie
user.email=y1053419035@qq.com
color.ui=true
[root@node201.yinzhengjie.org.cn ~]#


  關於git命令的基本使用博主推薦閱讀:https://www.cnblogs.com/yinzhengjie/p/9545646.html

 

四.三.安裝MySQL數據庫(若是你要是用Gerrit默認的數據庫則不須要執行這一步)

  安裝Mysql 5.7詳情請參考:https://www.cnblogs.com/yinzhengjie/p/10371899.html
[root@node201.yinzhengjie.org.cn ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.25-log MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
mysql> SELECT USER();                                                  #查看當前登錄用戶
+----------------+
| USER()         |
+----------------+
| root@localhost |
+----------------+
row in set (0.01 sec)

mysql> 
mysql> 
mysql> CREATE DATABASE gerrit DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;          #建立數據庫,並制定默認的字符編碼及排序規則
Query OK, 1 row affected (0.00 sec)

mysql> 
mysql> CREATE USER gerrit@'172.30.1.20%' IDENTIFIED WITH mysql_native_password BY 'yinzhengjie';      #建立一個'gerrit'@'172.30.1.20%'的用戶
Query OK, 0 rows affected (0.00 sec)

mysql> 
mysql> GRANT ALL PRIVILEGES ON gerrit.* TO gerrit@'172.30.1.20%';                        #爲咱們剛剛建立的用戶受權。
Query OK, 0 rows affected (0.00 sec)

mysql> 
mysql> FLUSH PRIVILEGES;                                                 #刷新權限。
Query OK, 0 rows affected (0.00 sec)

mysql> 
mysql> SELECT user,host,plugin FROM mysql.user;                                   #查看建立的用戶是否在user列表
+---------------+--------------+-----------------------+
| user          | host         | plugin                |
+---------------+--------------+-----------------------+
| root          | localhost    | mysql_native_password |
| mysql.session | localhost    | mysql_native_password |
| mysql.sys     | localhost    | mysql_native_password |
| gerrit        | 172.30.1.20% | mysql_native_password |
+---------------+--------------+-----------------------+
rows in set (0.00 sec)

mysql> 
mysql> QUIT
Bye
You have new mail in /var/spool/mail/root
[root@node201.yinzhengjie.org.cn ~]#
[root@node203.yinzhengjie.org.cn ~]# mysql -ugerrit -h node201.yinzhengjie.org.cn -pyinzhengjie
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.25-log MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| gerrit             |
+--------------------+
2 rows in set (0.00 sec)

mysql> 
mysql> QUIT
Bye
[root@node203.yinzhengjie.org.cn ~]# 
[root@node203.yinzhengjie.org.cn ~]# mysql -ugerrit -h node201.yinzhengjie.org.cn -pyinzhengjie      #測試連通性

 

五.部署Gerrit

1>.建立gerrit用戶

[root@node201.yinzhengjie.org.cn ~]# useradd -d /yinzhengjie/softwares/gerrit gerrit
[root@node201.yinzhengjie.org.cn ~]# 
[root@node201.yinzhengjie.org.cn ~]# ll /yinzhengjie/softwares/gerrit/
total 0
[root@node201.yinzhengjie.org.cn ~]# 
[root@node201.yinzhengjie.org.cn ~]# ll -d /yinzhengjie/softwares/gerrit/
drwx------ 2 gerrit gerrit 62 Jun 17 06:15 /yinzhengjie/softwares/gerrit/
[root@node201.yinzhengjie.org.cn ~]# 

2>.切換到gerrit的家目錄

[root@node201.yinzhengjie.org.cn ~]# su gerrit
[gerrit@node201.yinzhengjie.org.cn /root]$ cd
[gerrit@node201.yinzhengjie.org.cn ~]$ 
[gerrit@node201.yinzhengjie.org.cn ~]$ pwd
/yinzhengjie/softwares/gerrit
[gerrit@node201.yinzhengjie.org.cn ~]$ 
[gerrit@node201.yinzhengjie.org.cn ~]$ ll
total 0
[gerrit@node201.yinzhengjie.org.cn ~]$ 

3>.下載Gerrit2.15.14版本

[gerrit@node201.yinzhengjie.org.cn ~]# wget https://gerrit-releases.storage.googleapis.com/gerrit-2.15.14.war

4>.安裝Gerrit

[gerrit@node201.yinzhengjie.org.cn ~]$ mkdir soft && mv gerrit-2.15.14.war soft/ && cd soft
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ 
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ ll
total 72204
-rw-r--r-- 1 gerrit gerrit 73935344 Jun 17 05:17 gerrit-2.15.14.war
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ 
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ java -jar gerrit-2.15.14.war init 
Using secure store: com.google.gerrit.server.securestore.DefaultSecureStore
[2019-06-17 06:24:32,976] [main] INFO  com.google.gerrit.server.config.GerritServerConfigProvider : No /yinzhengjie/softwares/gerrit/./etc/gerrit.config; assuming defaults

*** Gerrit Code Review 2.15.14
*** 


*** Git Repositories
*** 

Location of Git repositories   [git]:         #指定gerrit存儲庫的位置,咱們能夠自定義存儲路徑,之後咱們在Gerrit上建立的存儲庫都會在咱們指定的這個路徑中。

*** SQL Database
*** 

Database server type           [h2]: ?        #默認使用h2數據庫,我並不推薦你們使用我們不熟悉的數據庫,所以咱們能夠輸入"?"查看gerrit都支持哪些數據庫
       Supported options are:
         db2
         derby
         h2
         hana
         jdbc
         mariadb
         maxdb
         mysql
         oracle
         postgresql
Database server type           [h2]: mysql     #咱們這裏選擇MySQL數據庫,咱們在前面已經安裝了數據庫並配置了相應的權限

Gerrit Code Review is not shipped with MySQL Connector/J 5.1.43    
**  This library is required for your configuration. **
Download and install it now [Y/n]? y        #這裏是在詢問咱們是否要下載MySQL的鏈接器,想必你們也都知道他是幹嗎的,沒錯,就是連接數據庫用的驅動包而已,所以咱們這裏要輸入"y"他會自動去下載
Downloading https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.43/mysql-connector-java-5.1.43.jar ... OK
Checksum mysql-connector-java-5.1.43.jar OK    #很顯然,這裏提示驅動下載完成啦
Server hostname                [localhost]: node201.yinzhengjie.org.cn    #這裏輸入MySQL的主機名
Server port                    [(mysql default)]: 3306              #這裏輸入MySQL的默認端口
Database name                  [reviewdb]: gerrit                 #這裏輸入MySQL的存放數據的數據庫名稱
Database username              [gerrit]:                         #這裏輸入MySQL的用戶名,默認就是gerrit,沒錯,咱們建立用戶時指定的yoghurt就是Gerrit,所以這裏回車便可
gerrit's password              :                           #這裏須要輸入2次連接數據庫的密碼
              confirm password : 

*** Index
*** 

Type                           [lucene/?]:      #選擇索引類型,咱們默認使用lucene便可,若是不知道使用
       Supported options are:
         lucene
         elasticsearch

*** User Authentication
*** 

Authentication method          [openid/?]: ?    #查看支持的認證類型
       Supported options are:
         openid
         openid_sso
         http
         http_ldap
         client_ssl_cert_ldap
         ldap
         ldap_bind
         custom_extension
         development_become_any_account
         oauth
Authentication method          [openid/?]: development_become_any_account    #第一次安裝咱們選擇這種模式,用這種模式咱們能夠去整一個管理員。
Enable signed push support     [y/N]? n      #是否啓用簽名的推送支持

*** Review Labels
*** 

Install Verified label         [y/N]? y     #安裝已驗證標籤,即進行校驗。

*** Email Delivery
*** 

SMTP server hostname           [localhost]: smtp.qq.com      #輸入自動發送郵箱的SMTP服務器
SMTP server port               [(default)]: 465           #465/994是SSL協議端口,25是非SSL協議端口
SMTP encryption                [none/?]: SSL             #若是上一步輸入的是465/994,此處輸入SSL,不然直接回車便可
SMTP username                  [gerrit]: y1053419035@qq.com    #這裏的SMTP的用戶名爲你用來發送郵箱的帳號
y1053419035@qq.com's password  :                    #須要輸入2受權碼驗證,注意,它是郵箱的受權碼,而非郵箱密碼!QQ郵箱有獲取受權碼的連接教程,感興趣的小夥伴能夠戳進去看看。
              confirm password : 

*** Container Process
*** 

Run as                         [gerrit]:               #指定運行gerrite程序的運行用戶,默認是當前用戶,咱們默認便可
Java runtime                   [/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre]:     #JAVA的運行環境,若是它識別有誤,你能夠只當你服務器的運行環境
Copy gerrit-2.15.14.war to ./bin/gerrit.war [Y/n]? Y        #拷貝gerrit安裝包
Copying gerrit-2.15.14.war to ./bin/gerrit.war

*** SSH Daemon
*** 

Listen on address              [*]: node201.yinzhengjie.org.cn  #指定SSH後臺服務器的監聽地址
Listen on port                 [29418]:                #只當SSH後臺服務的端口號
Generating SSH host key ... rsa... dsa... ed25519... ecdsa 256... ecdsa 384... ecdsa 521... done

*** HTTP Daemon
*** 

Behind reverse proxy           [y/N]? N                  #是否使用反向代理
Use SSL (https://)             [y/N]? N                  #不使用SSL
Listen on address              [*]: node201.yinzhengjie.org.cn    #指定gerrit監聽地址
Listen on port                 [8080]:                    #只當gerrit的服務端口
Canonical URL                  [http://node201.yinzhengjie.org.cn:8080/]:   http://172.30.1.201:8080    #指定訪問的URL,咱們默認也是能夠的

*** Cache
*** 


*** Plugins
*** 

Installing plugins.
Install plugin commit-message-length-validator version v2.15.14 [y/N]? Y    #接下來就是詢問咱們是否安裝插件,一路輸入"Y"便可~
Installed commit-message-length-validator v2.15.14
Install plugin download-commands version v2.15.14 [y/N]? Y
Installed download-commands v2.15.14
Install plugin hooks version v2.15.14 [y/N]? Y
Installed hooks v2.15.14
Install plugin replication version v2.15.14 [y/N]? Y
Installed replication v2.15.14
Install plugin reviewnotes version v2.15.14 [y/N]? Y
Installed reviewnotes v2.15.14
Install plugin singleusergroup version v2.15.14 [y/N]? Y
Installed singleusergroup v2.15.14
Initializing plugins.

*** Experimental features
*** 

Enable any experimental features [y/N]? Y
Default to PolyGerrit UI       [Y/n]? Y
Enable GWT UI                  [Y/n]? Y

Mon Jun 17 08:34:53 EDT 2019 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Mon Jun 17 08:34:54 EDT 2019 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Mon Jun 17 08:34:55 EDT 2019 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

*** Gerrit Administrator
*** 

Create administrator user      [Y/n]? Y         #是否建立管理員用哦過戶
username                       [admin]:         #指定用戶名,默認是admin
name                           [Administrator]: 
HTTP password                  [secret]: admin    #指定HTTP的密碼
public SSH key file            []: 
email                          [admin@example.com]: y1053419035@qq.com  #指定郵箱地址
Initialized /yinzhengjie/softwares/gerrit/soft
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ 
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ 

  若是你使用的MySQL 5.7版本做爲Gerrit的數據庫可能會拋出如下異常:(手動建立出對應的表後,咱們就會)

mysql> CREATE TABLE account_group_by_id_aud (added_by INT DEFAULT 0 NOT NULL, removed_by INT, removed_on TIMESTAMP NULL DEFAULT NULL, group_id INT DEFAULT 0 NOT NULL, include_uuid VARCHAR(255) BINARY DEFAULT '' NOT NULL, added_on TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY(group_id,include_uuid,added_on));
Query OK, 0 rows affected (0.01 sec)

mysql> 
mysql>  CREATE TABLE account_group_members_audit (added_by INT DEFAULT 0 NOT NULL, removed_by INT, removed_on TIMESTAMP NULL DEFAULT NULL, account_id INT DEFAULT 0 NOT NULL, group_id INT DEFAULT 0 NOT NULL, added_on TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY(account_id,group_id,added_on));
Query OK, 0 rows affected (0.01 sec)

mysql> 
mysql> 



參考連接:https://my.oschina.net/hopeMan/blog/1543780
mysql> CREATE TABLE changes (change_key VARCHAR(60) BINARY DEFAULT '' NOT NULL, created_on TIMESTAMP NOT NULL, last_updated_on TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, owner_account_id INT DEFAULT 0 NOT NULL, dest_project_name VARCHAR(255) BINARY DEFAULT '' NOT NULL, dest_branch_name VARCHAR(255) BINARY DEFAULT '' NOT NULL, status CHAR(1) DEFAULT ' ' NOT NULL, current_patch_set_id INT DEFAULT 0 NOT NULL, subject VARCHAR(255) BINARY DEFAULT '' NOT NULL, topic VARCHAR(255) BINARY, original_subject VARCHAR(255) BINARY, submission_id VARCHAR(255) BINARY, note_db_state TEXT, row_version INT DEFAULT 0 NOT NULL, change_id INT DEFAULT 0 NOT NULL ,PRIMARY KEY(change_id));
Query OK, 0 rows affected (0.01 sec)

mysql> 
解決方案:手動建立失敗的表(詳情請戳我)

 

[gerrit@node201.yinzhengjie.org.cn ~/soft]$ java -jar gerrit-2.15.14.war init  -d review-site      #使用-d參數會指定安裝的文件都存在在當前目錄的review-site的包中,不然他會把所偶的文件都解壓到當前目錄中喲~

 

六.啓動Gerrit服務

1>.運行啓動命令

[gerrit@node201.yinzhengjie.org.cn ~/soft]$ ./bin/gerrit.sh  status
Checking arguments to Gerrit Code Review:
  GERRIT_SITE            =  /yinzhengjie/softwares/gerrit/soft
  GERRIT_CONFIG          =  /yinzhengjie/softwares/gerrit/soft/etc/gerrit.config
  GERRIT_PID             =  /yinzhengjie/softwares/gerrit/soft/logs/gerrit.pid
  GERRIT_TMP             =  /yinzhengjie/softwares/gerrit/soft/tmp
  GERRIT_WAR             =  /yinzhengjie/softwares/gerrit/soft/bin/gerrit.war
  GERRIT_FDS             =  1024
  GERRIT_USER            =  gerrit
  GERRIT_STARTUP_TIMEOUT =  90
  JAVA                   =  /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/bin/java
  JAVA_OPTIONS           =  
  RUN_EXEC               =  /usr/bin/perl -e '$x=$ENV{JAVA};exec $x @ARGV;die $!' -- GerritCodeReview
  RUN_ARGS               =  -jar /yinzhengjie/softwares/gerrit/soft/bin/gerrit.war daemon -d /yinzhengjie/softwares/gerrit/soft

[gerrit@node201.yinzhengjie.org.cn ~/soft]$ 
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ ./bin/gerrit.sh status      #啓動前
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ ./bin/gerrit.sh  start
Starting Gerrit Code Review: WARNING: Could not adjust Gerrit's process for the kernel's out-of-memory killer.
         This may be caused by ./bin/gerrit.sh not being run as root.
         Consider changing the OOM score adjustment manually for Gerrit's PID=33791 with e.g.:
         echo '-1000' | sudo tee /proc/33791/oom_score_adj
OK
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ 
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ ./bin/gerrit.sh  status
Checking arguments to Gerrit Code Review:
  GERRIT_SITE            =  /yinzhengjie/softwares/gerrit/soft
  GERRIT_CONFIG          =  /yinzhengjie/softwares/gerrit/soft/etc/gerrit.config
  GERRIT_PID             =  /yinzhengjie/softwares/gerrit/soft/logs/gerrit.pid
  GERRIT_TMP             =  /yinzhengjie/softwares/gerrit/soft/tmp
  GERRIT_WAR             =  /yinzhengjie/softwares/gerrit/soft/bin/gerrit.war
  GERRIT_FDS             =  1024
  GERRIT_USER            =  gerrit
  GERRIT_STARTUP_TIMEOUT =  90
  JAVA                   =  /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/bin/java
  JAVA_OPTIONS           =  
  RUN_EXEC               =  /usr/bin/perl -e '$x=$ENV{JAVA};exec $x @ARGV;die $!' -- GerritCodeReview
  RUN_ARGS               =  -jar /yinzhengjie/softwares/gerrit/soft/bin/gerrit.war daemon -d /yinzhengjie/softwares/gerrit/soft

Gerrit running pid=33791
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ 
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ ./bin/gerrit.sh status     #啓動後

2>.查看運行狀態

[gerrit@node201.yinzhengjie.org.cn ~/soft]$ ss -ntl
State      Recv-Q Send-Q                                   Local Address:Port                                                  Peer Address:Port              
LISTEN     0      50                                        172.30.1.201:29418                                                            *:*                  
LISTEN     0      50                                        172.30.1.201:8080                                                             *:*                  
LISTEN     0      128                                                  *:22                                                               *:*                  
LISTEN     0      100                                          127.0.0.1:25                                                               *:*                  
LISTEN     0      80                                                  :::3306                                                            :::*                  
LISTEN     0      128                                                 :::22                                                              :::*                  
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ 
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ 

3>.訪問WebUI

 

七.製做gerrit systemd啓動腳本

1>.編寫腳本

[root@node201.yinzhengjie.org.cn ~]# cat /usr/lib/systemd/system/gerrit.service
[Unit]
Description=Web based code review and project management for Git based projects
After=network.target

[Service]
Type=forking
User=gerrit
EnvironmentFile=/yinzhengjie/softwares/gerrit/soft/etc/gerrit.config
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=gerrit
ExecStart=/yinzhengjie/softwares/gerrit/soft/bin/gerrit.sh start
ExecStop=/yinzhengjie/softwares/gerrit/soft/bin/gerrit.sh stop
PIDFile=/yinzhengjie/softwares/gerrit/soft/logs/gerrit.pid

[Install]
WantedBy=multi-user.target
[root@node201.yinzhengjie.org.cn ~]# 

2>.添加權限

[root@node201.yinzhengjie.org.cn ~]# ll /usr/lib/systemd/system/gerrit.service
-rw-r--r-- 1 root root 505 Jun 18 07:48 /usr/lib/systemd/system/gerrit.service
[root@node201.yinzhengjie.org.cn ~]# 
[root@node201.yinzhengjie.org.cn ~]# 
[root@node201.yinzhengjie.org.cn ~]# chmod u+x /usr/lib/systemd/system/gerrit.service
[root@node201.yinzhengjie.org.cn ~]# 
[root@node201.yinzhengjie.org.cn ~]# ll /usr/lib/systemd/system/gerrit.service
-rwxr--r-- 1 root root 505 Jun 18 07:48 /usr/lib/systemd/system/gerrit.service
[root@node201.yinzhengjie.org.cn ~]# 

3>.中止Gerrit服務

[gerrit@node201.yinzhengjie.org.cn ~/soft]$ ./bin/gerrit.sh stop
Stopping Gerrit Code Review: OK
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ 
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ 
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ ./bin/gerrit.sh status
Checking arguments to Gerrit Code Review:
  GERRIT_SITE            =  /yinzhengjie/softwares/gerrit/soft
  GERRIT_CONFIG          =  /yinzhengjie/softwares/gerrit/soft/etc/gerrit.config
  GERRIT_PID             =  /yinzhengjie/softwares/gerrit/soft/logs/gerrit.pid
  GERRIT_TMP             =  /yinzhengjie/softwares/gerrit/soft/tmp
  GERRIT_WAR             =  /yinzhengjie/softwares/gerrit/soft/bin/gerrit.war
  GERRIT_FDS             =  1024
  GERRIT_USER            =  gerrit
  GERRIT_STARTUP_TIMEOUT =  90
  JAVA                   =  /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/bin/java
  JAVA_OPTIONS           =  
  RUN_EXEC               =  /usr/bin/perl -e '$x=$ENV{JAVA};exec $x @ARGV;die $!' -- GerritCodeReview
  RUN_ARGS               =  -jar /yinzhengjie/softwares/gerrit/soft/bin/gerrit.war daemon -d /yinzhengjie/softwares/gerrit/soft

[gerrit@node201.yinzhengjie.org.cn ~/soft]$ 
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ ss -ntl
State       Recv-Q Send-Q                                                   Local Address:Port                                                                  Peer Address:Port              
LISTEN      0      128                                                                  *:22                                                                               *:*                  
LISTEN      0      100                                                          127.0.0.1:25                                                                               *:*                  
LISTEN      0      80                                                                  :::3306                                                                            :::*                  
LISTEN      0      128                                                                 :::22                                                                              :::*                  
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ 

4>.使用自定義腳本啓動Gerrit服務

[gerrit@node201.yinzhengjie.org.cn ~/soft]$ ./bin/gerrit.sh stop
Stopping Gerrit Code Review: OK
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ 
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ 
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ systemctl start gerrit
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to manage system services or units.
Authenticating as: Jason Yin (jason)
Password: 
==== AUTHENTICATION COMPLETE ===
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ 
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ systemctl status gerrit
● gerrit.service - Web based code review and project management for Git based projects
   Loaded: loaded (/usr/lib/systemd/system/gerrit.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2019-06-18 13:18:52 EDT; 13s ago
  Process: 23985 ExecStart=/yinzhengjie/softwares/gerrit/soft/bin/gerrit.sh start (code=exited, status=0/SUCCESS)
 Main PID: 24014 (java)
   CGroup: /system.slice/gerrit.service
           └─24014 GerritCodeReview -jar /yinzhengjie/softwares/gerrit/soft/bin/gerrit.war daemon -d /yinzhengjie/softwares/gerrit/soft --run-id=1560878325.23985
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ 
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ 
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ 
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ ss -ntl
State       Recv-Q Send-Q                                                   Local Address:Port                                                                  Peer Address:Port              
LISTEN      0      50                                                        172.30.1.201:29418                                                                            *:*                  
LISTEN      0      50                                                        172.30.1.201:8080                                                                             *:*                  
LISTEN      0      128                                                                  *:22                                                                               *:*                  
LISTEN      0      100                                                          127.0.0.1:25                                                                               *:*                  
LISTEN      0      80                                                                  :::3306                                                                            :::*                  
LISTEN      0      128                                                                 :::22                                                                              :::*                  
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ 
[gerrit@node201.yinzhengjie.org.cn ~/soft]$ 

5>.遇到的問題 (下面是查看系統日誌的相關報錯)

問題分析:
  編譯安裝的git貌似咱們在編寫啓動腳本時,systemd進程識別不到,能夠是路徑問題。


解決方案:
  最簡單的解決方案就是使用yum方式安裝,問題天然迎刃而解。
  [root@node201.yinzhengjie.org.cn ~]# yum -y install git

總結:
   好像 gerrit 服務器端,使用1.8就行 
    [root@node201.yinzhengjie.org.cn ~]# git --version
    git version 1.8.3.1
    [root@node201.yinzhengjie.org.cn ~]#
   只有客戶端的git纔要求1.8以上,由於我以前在使用gerrit3.0版本時,使用git1.8會報錯喲~

啓動服務時,咱們應該查看日誌信息,若是啓動成功會有如下日誌輸出:
  

[root@node201.yinzhengjie.org.cn ~]# tail -100f /var/log/messages

相關文章
相關標籤/搜索