欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

gerrit linux下安装  

程序员文章站 2022-06-09 23:49:58
...

下载软件:

git-1.8.1.5.tar.gz

http://code.google.com/p/git-core/downloads/detail?name=git-1.8.1.5.tar.gz&can=2&q=

httpd-2.0.64.tar.gz

http://mirror.bit.edu.cn/apache//httpd/

gerrit-full-2.5.2.war


软件都拷贝到

/usr/soft目录下

安装git

[root@GBase git-1.8.1.5]# tar -xzf git-1.8.1.5.tar.gz

[root@GBase git-1.8.1.5]# cd git-1.8.1.5

[root@GBase git-1.8.1.5]# make prefix=/usr/local all

[root@GBase git-1.8.1.5]# make prefix=/usr/local install

安装完成后输入git,有反馈即成功

安装apache服务

[root@GBase apache]# tar -xvzf httpd-2.0.64.tar.gz

[root@GBase apache]# cd httpd-2.0.64

[root@GBase apache]# ./configure --prefix=/usr/soft/apache --enable-mods-shared='proxy proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http proxy_rewrite'

[root@GBase apache]# make

[root@GBase apache]# make install


安装完成

查看80端口是否被占用,没被占用直接使用,占用修改端口

netstat -tln | grep 80

netstat -tln | grep 8080


编辑apache配置文件

vi httpd.conf

在末尾添加如下配置

<VirtualHost *:80>
ServerName Gitserver
ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On


<Proxy *:80>
Order deny,allow
Allow from all
</Proxy>


<Location /login/>
AuthType Basic
AuthName "Gerrit Code Review"
Require valid-user
AuthUserFile /usr/soft/git/htpasswd
</Location>


ProxyPass / http://10.14.132.204:9080/
ProxyPassReverse / http://10.14.132.204:9080/
</VirtualHost>


安装gerrit

java -jar gerrit.war init -d /usr/soft/gerrit

[root@GBase soft]# java -jar gerrit-full-2.5.2.war init -d /usr/soft/gerrit
*** Gerrit Code Review 2.5.2
***
Create '/usr/soft/gerrit' [Y/n]? Y
*** Git Repositories
***
Location of Git repositories [git]:
*** SQL Database
***
Database server type [H2/?]:
*** User Authentication
***
Authentication method [OPENID/?]: http
Get username from custom HTTP header [y/N]?
SSO logout URL : logout
*** Email Delivery
***
SMTP server hostname [localhost]:
SMTP server port [(default)]:
SMTP encryption [NONE/?]:
SMTP username :
*** Container Process
***
Run as [root]:
Java runtime [/usr/local/jdk1.6.0_38/jre]:

Copy gerrit.war to /usr/soft/gerrit/bin/gerrit.war [Y/n]?
Copying gerrit.war to /usr/soft/gerrit/bin/gerrit.war
*** SSH Daemon
***
Listen on address [*]:
Listen on port [29418]:
Gerrit Code Review is not shipped with Bouncy Castle Crypto v144
If available, Gerrit can take advantage of features
in the library, but will also function without it.
Download and install it now [Y/n]? n
Generating SSH host key ... rsa(simple)... done
*** HTTP Daemon
***
Behind reverse proxy [y/N]?
Use SSL (https://) [y/N]?
Listen on address [*]:
Listen on port [8080]: 9080
*** Plugins
***
Prompt to install core plugins [y/N]?
Initialized /usr/soft/gerrit
Executing /usr/soft/gerrit/bin/gerrit.sh start
Starting Gerrit Code Review: OK
Waiting for server to start ... OK
Opening browser ...

下一步停止gerrit服务,然后进行配置

可以通过命令[root@GBase bin]# ps -ef | grep gerrit 查看到已经运行的gerrit进程

[root@GBase bin]# ./gerrit.sh stop
** ERROR: GERRIT_SITE not set

遇到上面的错误信息,编辑

gerrit.sh

添加

GERRIT_SITE=/usr/soft/gerrit

编辑gerrit.config

[root@GBase etc]# vi gerrit.config


[gerrit]
basePath = git
canonicalWebUrl = http://10.14.132.204:9080/
[database]
type = H2
database = db/ReviewDB
[auth]
type = HTTP
logoutUrl = http://aa:aa@10.14.132.204/
[sendemail]
smtpServer = smtp.163.com
smtpUser = manager@163.com
smtpPass = manager
from = manager@163.com
[container]
user = root
javaHome = /usr/local/jdk1.6.0_38/jre
[sshd]
listenAddress = *:29418
[httpd]
listenUrl = http://10.14.132.204:9080/
[cache]
directory = cache






apache启动和停止

启动apache2:

[root@GBase bin]# ./apachectl start

停止apache2:

[root@GBase bin]# ./apachectl stop


设定apache和gerrit自动启动

编辑 /etc/rc.d/rc.local
将执行命令添加到这个文件中
/usr/soft/apache/bin/apachectl start
/usr/soft/gerrit/bin/gerrit.sh start