gerrit搭建
来源:互联网 发布:中宏数据库 编辑:程序博客网 时间:2024/05/21 18:40
1.gerrit 安装
1.1 安装java环境:
- 从oracle下载jdk-8u144-linux-x64.tar.gz
- 解压缩 sudo tar zxvf jdk-8u144-linux-x64.tar.gz -C /opt
- 配置环境变量 sudo vim /etc/profile 添加:
- 验证:java -version
export JAVA_HOME=/opt/1.8.0_144export JRE_HOME=$JAVA_HOME/jreexport CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATHexport PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
1.2 安装git
sudo apt-get install git
1.3 gerrit 安装和配置
1.3.1 安装
默认安装:java -jar gerrit-2.14.2.war init --batch -d ~/review_site
1.3.2 配置文件
vim ~/review_site/etc/gerrit.config]
[gerrit] basePath = git serverId = 2e0d4b2a-0a28-407c-9fe8-9c7b84557e90 canonicalWebUrl = http://10.119.125.39:8081/[database] type = h2 database = /home/penggc1/review_site/db/ReviewDB[index] type = LUCENE[auth] type = HTTP[receive] enableSignedPush = false[sendemail] smtpServer = smtp.126.comsmtpServerPort = 465
smtpEncryption = ssl
smtpUser = xxxx@126.com
smtpPass = xxxxxx
sslVerify = false
from=CodeReview<xxxxx@126.com>
[container] user = penggc1 javaHome = /opt/jdk1.8.0_144/jre[sshd] listenAddress = *:29418[httpd] listenUrl = http://*:8081/[cache] directory = cache
2. apache反向代理
apache反向代理主要是用户做gerrit的http的认证
2.1 apache的安装
安装:sudo apt-get install apache2
验证:sudo /etc/init.d/apache2 start
进入/etc/apache2可以看到apache的目录结构如下:
apache2.conf conf-enabled magic mods-enabled sites-available
conf-available envvars mods-available ports.conf sites-enabled
2.2 apache的模块加载流程
2.3 配置apache 的server
2.3.1 开启ssl和proxy,rewrite模块
cd /etc/apache2/mods-enabled
ln -s ../mods-available/proxy.loadln -s ../mods-available/proxy.confln -s ../mods-available/proxy_http.loadln -s ../mods-available/proxy_balancer.confln -s ../mods-available/proxy_balancer.loadln -s ../mods-available/rewrite.loadln -s ../mods-available/ssl.confln -s ../mods-available/ssl.loadln -s ../mods-available/socache_shmcb.load ln -s ../mods-available/slotmem_shm.load
2.3.2 创建反向代理的配置文件:
sudo touch /etc/apache2/sites-available/gerrit-httpd.conf
在文件中添加以下内容:
<VirtualHost *:8080>ServerName 10.119.125.39 ProxyRequests Off ProxyVia Off ProxyPreserveHost On AllowEncodedSlashes On RewriteEngine On RewriteRule ^/(.*) http://10.119.125.39:8081/$1 [NE,P] #rewrite rule for proxy <Proxy *> Order deny,allow Allow from all </Proxy> <Location /login/> AuthType Basic AuthName "Gerrit Code Review" Require valid-user AuthBasicProvider file AuthUserFile /etc/apache2/passwords #password file for gerrit </Location> ProxyPass / http://10.119.125.39:8081/</VirtualHost>
其中<VirtualHost *:8080>是用户访问的端口,8081是内部服务实际上提供的端口。也就是用户访问10.119.125.39:8080时候实际上访问的10.119.125.39:8081. 8080端口是8081的代理端口
2.3.3 创建软链接,
cd /etc/apache2/sites-enable
sudo ln -s ../sites-available/gerrit-httpd.conf
2.3.4 配置让apache server 监听8080端口
sudo vim /etc/apache2/ports.conf
#If you just change the port or add more ports here, you will likely also# have to change the VirtualHost statement in# /etc/apache2/sites-enabled/000-default.confListen 80Listen 8080<IfModule ssl_module> Listen 443</IfModule><IfModule mod_gnutls.c> Listen 443</IfModule>
2.3.5 启动代理
sudo a2ensite gerrit-httpd.conf
2.4 配置gerrit 账户密码
根据反向代理的配置文件,存储用户名和密码的地方是/etc/apache2/passwords
sudo touch /etc/apache2/passwords
htpasswd是apache密码生成工具
htpasswd -b /etc/apache2/passwords admin 123456
2.5重新 启动 apache server 和gerrit
sudo /etc/init.d/apache2 restart
sudo ~/review_site/bin/gerrit.sh stop
sudo ~/review_site/bin/gerrit.sh start
遇到问题:
1. 配置邮箱不成功:
需要登录126的邮箱设置smtp的许可
参考内容:
http://www.cnblogs.com/tesky0125/p/5877536.html
- 【Gerrit】gerrit server搭建
- gerrit 搭建
- gerrit搭建
- gerrit的搭建
- gerrit环境搭建
- gerrit 搭建和使用
- Gerrit 服务器搭建
- Gerrit 服务器搭建
- inux搭建gerrit服务器
- Gitolite+Gerrit服务器搭建
- Gerrit搭建过程
- gerrit服务器搭建总结
- ubuntu搭建Gerrit平台总结
- git 服务器搭建之gerrit
- Gerrit代码审核服务器搭建
- Gerrit代码审核服务器搭建
- gerrit代码评审服务器搭建
- 搭建git+gerrit+repo代码
- 20170907--学习笔记(Ext.data.Store的基本用法)
- Android---HttpURLConnection
- Server Apache Tomcat v7.0 at localhost failed to start.
- Hive搭建并将元数据存储到MySQL
- APP项目打包
- gerrit搭建
- Servlet的生命周期与相关接口
- Android Studio将library打包成jar
- 自定义view
- Greendao打印Didn't find class "net.sqlcipher.database.SQLiteOpenHelper”解决办法
- Hadoop集群nodes unhealthy解决方法
- Android MVP模式 简单易懂的介绍方式
- JAVA开发的23种设计模式之 --- 解释器模式
- Ceph PG 归置组状态