gerrit install

2018-10-24 11:29:29 浏览数 (1)

安装jdk1.8 安装httpd

下载gerrit,如:gerrit-2.12.4.war

代码语言:javascript复制
Gerrit 2.12.4 https://www.gerritcodereview.com/download/gerrit-2.12.4.war

gerrit管理帐号

代码语言:javascript复制
sudo adduser gerrit
sudo passwd gerrit

并将gerrit加入sudo权限

代码语言:javascript复制
sudo visudo
gerrit  ALL=(ALL:ALL) ALL

安装gerrit

代码语言:javascript复制
java -jar gerrit-2.11.3.war init

启动gerrit服务

代码语言:javascript复制
[gerrit@promote review2]$ /etc/init.d/gerrit.sh start
** ERROR: GERRIT_SITE not set
[gerrit@promote review2]$ pwd
/home/gerrit/review2
[gerrit@promote review2]$ /etc/init.d/gerrit.sh start
** ERROR: GERRIT_SITE not set
[gerrit@promote review2]$ export GERRIT_SITE=/home/gerrit/review2
[gerrit@promote review2]$ /etc/init.d/gerrit.sh status
Checking arguments to Gerrit Code Review:
  GERRIT_SITE     =  /home/gerrit/review2
  GERRIT_CONFIG   =  /home/gerrit/review2/etc/gerrit.config
  GERRIT_PID      =  /home/gerrit/review2/logs/gerrit.pid
  GERRIT_TMP      =  /home/gerrit/review2/tmp
  GERRIT_WAR      =  /home/gerrit/review2/bin/gerrit.war
  GERRIT_FDS      =  1024
  GERRIT_USER     =  gerrit
  JAVA            =  /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.141-2.6.10.1.el7_3.x86_64/jre/bin/java
  JAVA_OPTIONS    =  
  RUN_EXEC        =  /usr/bin/perl -e '$x=$ENV{JAVA};exec $x @ARGV;die $!' -- GerritCodeReview
  RUN_ARGS        =  -jar /home/gerrit/review2/bin/gerrit.war daemon -d /home/gerrit/review2

[gerrit@promote review2]$ /etc/init.d/gerrit.sh start
Starting Gerrit Code Review: OK
[root@promote etc]# cd /etc/httpd/
[root@promote httpd]# ls
conf  conf.d  conf.modules.d  logs  modules  run
[root@promote httpd]# cd conf.d/
[root@promote conf.d]# ls
autoindex.conf  gerrit.conf  README  userdir.conf  welcome.conf

根据需要修改配置文件

代码语言:javascript复制
[root@promote conf.d]# vim gerrit.conf 

配置gerrit账户密码

代码语言:javascript复制
[root@promote ~]# htpasswd -m /etc/gerrit.passwd hanwei
htpasswd: cannot modify file /etc/gerrit.passwd; use '-c' to create it
[root@promote ~]# touch /etc/gerrit.passwd
[root@promote ~]# htpasswd -m /etc/gerrit.passwd hanwei
New password: 
Re-type new password: 
Adding password for user hanwei

打开浏览器,打开gerrit主界面,用刚刚创建的账号登录gerrit

0 人点赞