Gerrit安装配置
环境: CentOS 1611 + gerrit-2.11.4 (review.openstack.org)
1. 安装java1.8 (>1.7)
[root@review ~]# yum install java [root@review ~]# java -version
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-b12)
OpenJDK -Bit Server VM (build 25.131-b12, mixed mode)
Install jdk 1.8
2. 安装mariadb (mysql)
[root@review ~]# yum install -y mariadb* # 安装
[root@review ~]# systemctl start mariadb.service #启动
[root@review ~]# systemctl enable mariadb.service #开机启动 # 首次配置mariadb
[root@review ~]# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here. Enter current password for root (enter for none): # 默认为空
OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation. Set root password? [Y/n] # 新密码
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success! By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment. Remove anonymous users? [Y/n]
... Success! Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] n
... skipping. By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment. Remove test database and access to it? [Y/n]
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success! Reloading the privilege tables will ensure that all changes made so far
will take effect immediately. Reload privilege tables now? [Y/n]
... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB
installation should now be secure. Thanks for using MariaDB!
[root@review ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is
Server version: 5.5.-MariaDB MariaDB Server Copyright (c) , , Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> create user 'gerrit'@'localhost' identified by 'password';
MariaDB [(none)]> create database reviewdb;
MariaDB [(none)]> grant all on reviewdb.* to 'gerrit'@'localhost';
MariaDB [(none)]> flush privileges;
Install&Config Mariadb
3. 安装gerrit
换mysql数据库, 安装verify label, 用http认证, 安装所有插件
[root@review ~]# java -jar gerrit-2.11..war init -d /usr/local/gerrit_site/
Using secure store: com.google.gerrit.server.securestore.DefaultSecureStore *** Gerrit Code Review 2.11.
*** Create '/usr/local/gerrit_site' [Y/n]? *** Git Repositories
*** Location of Git repositories [git]: *** SQL Database
*** Database server type [h2]: mysql Gerrit Code Review is not shipped with MySQL Connector/J 5.1.
** This library is required for your configuration. **
Download and install it now [Y/n]?
Downloading http://repo2.maven.org/maven2/mysql/mysql-connector-java/5.1.21/mysql-connector-java-5.1.21.jar ... OK
Checksum mysql-connector-java-5.1..jar OK
Server hostname [localhost]:
Server port [(mysql default)]:
Database name [reviewdb]:
Database username [root]: gerrit
gerrit's password :
confirm password : *** Index
*** Type [LUCENE/?]: *** 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/?]: http
Get username from custom HTTP header [y/N]?
SSO logout URL : *** Review Labels
*** Install Verified label [y/N]? y *** Email Delivery
*** SMTP server hostname [localhost]:
SMTP server port [(default)]:
SMTP encryption [NONE/?]:
SMTP username : *** Container Process
*** Run as [root]:
Java runtime [/usr/lib/jvm/java-1.8.-openjdk-1.8.0.131-.b12.el7_3.x86_64/jre]:
Copy gerrit-2.11..war to /usr/local/gerrit_site/bin/gerrit.war [Y/n]?
Copying gerrit-2.11..war to /usr/local/gerrit_site/bin/gerrit.war *** SSH Daemon
*** Listen on address [*]:
Listen on port []: Gerrit Code Review is not shipped with Bouncy Castle Crypto SSL v151
If available, Gerrit can take advantage of features
in the library, but will also function without it.
Download and install it now [Y/n]?
Downloading http://www.bouncycastle.org/download/bcpkix-jdk15on-151.jar ... !! FAIL !! error: http://www.bouncycastle.org/download/bcpkix-jdk15on-151.jar: 302 Found
Please download: http://www.bouncycastle.org/download/bcpkix-jdk15on-151.jar and save as: /usr/local/gerrit_site/lib/bcpkix-jdk15on-.jar Press enter to continue
Continue without this library [Y/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 []:
Canonical URL [http://review.infra:8080/]: http://192.168.11.9:8080 *** Plugins
*** Installing plugins.
Install plugin reviewnotes version v2.11.4 [y/N]? y
Install plugin replication version v2.11.4 [y/N]? y
Install plugin download-commands version v2.11.4 [y/N]? y
Install plugin singleusergroup version v2.11.4 [y/N]? y
Install plugin commit-message-length-validator version v2.11.4 [y/N]? y
Initializing plugins.
No plugins found with init steps. Initialized /usr/local/gerrit_site
Executing /usr/local/gerrit_site/bin/gerrit.sh start
Starting Gerrit Code Review: OK
Waiting for server on 192.168.11.9: ... OK
Opening http://192.168.11.9:8080/#/admin/projects/ ...FAILED
Open Gerrit with a JavaScript capable browser:
http://192.168.11.9:8080/#/admin/projects/
Install Gerrit
如果启动出错, $gerrit_site/logs/error_log 中提示reindex ..... 执行:
java -jar gerrit-2.11..jar reindex -d $gerrit_site
... $gerrit_site/bin/gerrit.sh start
if reindex error
4. gerrit配置
配置文件路径: $gerrit_sit/etc/gerrit.config
a. 邮箱配置
保证两个文件中的smtpPass密码(实际邮箱密码)一致
[root@review ~]# vim /usr/local/gerrit_site/etc/gerrit.config
...
[sendemail]
smtpServer = smtp..com
smtpUser = xxxxxxxxx@.com
from = GerritReviewAdmin<xxxxxxxxx@.com>
smtpPass = xxxxxxxxx
... [root@review ~]# vim /usr/local/gerrit_site/etc/secure.config
...
[sendemail]
smtpPass = xxxxxxxxx
... Email Config
Email Config
打开邮箱, 打开链接, 邮箱才注册成功
b. 公钥私钥配置
[root@review project]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
5b:e3:bc:0b:c7:::7f:d2:::dc:f9:cd::2c root@review.infra
The key's randomart image is:
+--[ RSA ]----+
| |
| |
| |
| . . o . . |
| o + S E o |
| . = X * |
| o B % |
| B . |
| o. |
+-----------------+
create key
复制生成的公钥~/.ssh/id_rsa.pub到gerrit上,并复制gerrit上的known_hosts内容到~/.ssh/known_hosts (也可自动连接时生成)
c. 修改gerrit配置 (添加标签Verified, Workflow Label)
按上步配置好后, git clone All-Projects, 并修改里面的project.config文件
[root@review All-Projects]# vim project.config
......
[label "Verified"]
function = MaxWithBlock
value = - Fails
value = - Doesn't seem to work
value = No score
value = + Works for me
value = + Verified
defaultValue =
[label "Workflow"]
function = MaxWithBlock
value = - Work in progress
value = Ready for reviews
value = + Approved
defaultValue = [root@review All-Projects]# git add .
[root@review All-Projects]# git commit -m "add workflow label"
[detached HEAD a711d36] add workflow label
file changed, insertions(+), deletions(-)
[root@review All-Projects]# git push origin HEAD:refs/meta/config
Counting objects: , done.
Delta compression using up to threads.
Compressing objects: % (/), done.
Writing objects: % (/), bytes | bytes/s, done.
Total (delta ), reused (delta )
remote: Resolving deltas: % (/)
remote: Processing changes: refs: , done
To ssh://gerrit@192.168.11.9:29418/All-Projects
..a711d36 HEAD -> refs/meta/config
project.config
添加Verifyed和Workflow 选项
d. gerrit html 主题配置
参考openstack的gerrit review: https://review.openstack.org
简要教程: https://review.openstack.org/Documentation/config-themes.html
需要的静态文件可以从这里提取, 也可自行编写或修改
部好后效果图:
5. 部署到Apache 或 Nginx
如果不配置会出现以下错误
[root@review ~]# yum install -y httpd
Installed:
httpd.x86_64 :2.4.-.el7.centos. Dependency Installed:
httpd-tools.x86_64 :2.4.-.el7.centos. mailcap.noarch :2.1.-.el7 Complete!
安装httpd
a. Apache配置:
[root@review ~]# vim /usr/local/gerrit_site/etc/gerrit.config
[gerrit]
basePath = git
canonicalWebUrl = http://192.168.11.9
[database]
type = mysql
hostname = localhost
port =
database = reviewdb
username = gerrit
[index]
type = LUCENE
[auth]
type = HTTP
[sendemail]
smtpServer = localhost
[container]
user = root
javaHome = /usr/lib/jvm/java-1.8.-openjdk-1.8.0.131-.b12.el7_3.x86_64/jre
[sshd]
listenAddress = *:
[httpd]
listenUrl = proxy-http://192.168.11.9:8080/
[cache]
directory = cache
gerrit config
[root@review httpd]# vim conf.d/gerrit.conf <VirtualHost *:>
ServerName 192.168.11.9
ProxyPreserveHost On
ProxyRequests Off
ProxyVia Off <Proxy *>
Order deny,allow
Allow from all
</Proxy> <Location />
AuthType Basic
AuthName "Welcomme to Gerrit Code Review Site!"
Require valid-user
AuthBasicProvider file
AuthUserFile /usr/local/gerrit_site/etc/passwords
</Location> AllowEncodedSlashes On
ProxyPass / http://192.168.11.9:8080/
#proxyPassReverse / http://127.0.0.1:8080 </VirtualHost>
apache config
http://192.168.11.9 输入用htpasswd产生的用户和密码登陆, 第一个用户是管理员用户(注册邮箱).
b. Nginx
[root@review conf]# cat gerrit.conf server { listen ; server_name localhost; location / { auth_basic "Gerrit Code Review"; auth_basic_user_file /usr/local/gerrit_site/etc/passwords; proxy_pass http://192.168.11.9:8080;
proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; } }
Nginx
6. gitweb对接
安装, 安装后的gitweb目录 /var/www/git
[root@review ~]# yum install -y gitweb
[root@review ~]# git config --file /usr/local/gerrit_site/etc/gerrit.config gitweb.cgi /var/www/git/gitweb.cgi
[root@review ~]# git config --file /usr/local/gerrit_site/etc/gerrit.config --unset gitweb.url
[root@review ~]# /usr/local/gerrit_site/bin/gerrit.sh restart
Stopping Gerrit Code Review: OK
Starting Gerrit Code Review: OK
[root@review ~]#
REF1: http://www.cnblogs.com/kevingrace/p/5624122.html
REF2: http://www.cnblogs.com/kevingrace/p/5651447.html
Gerrit安装配置的更多相关文章
- gerrit安装配置记录
gerrit安装配置 java -jar gerrit-2.13.5.war init -d gerrit Authentication method [OPEN/?]: htt Install Ve ...
- Gerrit - 安装配置GitWeb
1 - GitWeb简介 GitWeb是一个支持在Web页面上查看代码以及提交信息的工具. 安装GitWeb工具并且集成到Gerrit中,就可以直接在Gerrit的项目列表中查看项目的代码信息. 2 ...
- 安装配置gerrit
Centos 安装配置gerrit 关闭selinux,不然nginx的反向代理会报错connect() to 127.0.0.1:8080 failed (13: Permission denied ...
- gerrit+nginx+centos安装配置
安装环境 centos 6.8 gerrit-full-2.5.2.war 下载地址:https://gerrit-releases.storage.googleapis.com/gerrit-ful ...
- Gerrit+apache+H2数据库简单安装配置及建库流程
Gerrit 是一个基于 Web 的代码评审和项目管理的工具,面向基于 Git 版本控制系统的项目.因此需要Apache.Mysql.GIT等相关软件的支持 系统配置: 新装的UBANTU LINUX ...
- Centos7安装配置gitlab
Centos7安装配置gitlab 这篇文字我会介绍在Centos7上安装gitlab,配置gitlab的smtp,并且创建项目demo. sudo yum install openssh-serve ...
- Gerrit2安装配置
我主要根据下面这个文章而安装,遇到一些小问题,记录如下:2016.4.30 安装 2.12.2,要将加密的东东全装上!!!注意 1) 由于新的git-bash ...
- Git Review + Gerrit 安装及使用完成 Code-Review
转载自:https://cloud.tencent.com/developer/article/1010615 1.Code Review 介绍 Code Review 代码评审是指在软件开发过程中, ...
- Hive安装配置指北(含Hive Metastore详解)
个人主页: http://www.linbingdong.com 本文介绍Hive安装配置的整个过程,包括MySQL.Hive及Metastore的安装配置,并分析了Metastore三种配置方式的区 ...
随机推荐
- 基于json-lib-2.2.2-jdk15.jar的JSON解析工具类大集合
json解析之前的必备工作:导入json解析必须的六个包 资源链接:百度云:链接:https://pan.baidu.com/s/1dAEQQy 密码:1v1z 代码示例: package com.s ...
- 微信小程序开发,服务器端获取不到请求参数
微信的request请求请求方式为 GET 时,可以在后台获取到请求的参数 userName 当为POST请求时则获取不到 userName 参数 解决方案是 在 设置一下 headers 里添加 ' ...
- VM CentOS 问题汇总
1. 锁定文件失败 / 模块启动失败 如下图问题: 原因分析: 虚拟机为了防止有多虚拟机共用一个虚拟磁盘(就是后 缀为.vmdk那个文件)造成数据的丢失等问题,每次启动虚拟机时会给每个虚拟磁盘加一个磁 ...
- .net WINFORM的GDI双缓冲的实现
有时候在窗体中执行不断的GDI+操作的时候会出现闪速的状况,除了修改窗体的参数,更应该解决刷新本身的问题,双缓冲可能就是这样来的. 方法1: 用GDI绘制在位图上,然后再重新生成位图 Bitmap b ...
- SVN版本控制——SVN 合并的六种方式
合并的工作是把主干或者分支上合并范围内的所有改动列出,并对比当前工作副本的内容,由合并者手工修改冲突,然后提交到服务器的相应目录里.如果当前工作副本是主干,则合并的范围是分支上的改动,如果工作副本是分 ...
- 针对Eclipse闪退的两种解决方案
闪退情况是:双击Eclipse登陆按钮,显示图标后,紧接着关闭: 1. 到eclipse文件夹中的eclipse.ini打开编辑在最后加入下面代码保存即可 -Dorg.eclipse.swt.brow ...
- Hadoop shell 一查就会
Hadoop shell 命令有三种格式 hdfs + dfs (必须是dfs) Hadoop + dfs Hadoop + df 命令 说明 hadoop 版本查看 hadoop version h ...
- 小tip:巧用CSS3属性作为CSS hack——张鑫旭
一.开篇小问题 题目:实现类似下图的宽度自适应效果,IE9+,FireFox,Chrome,Opera等使用CSS3实现,IE6~8浏览器使用图片实现. 计时思考…… 二.思考中 ————- 假设这是 ...
- Review——JS的异步与同步
一.概念 同步(synchronous):指在js的主线程上,所有任务被依次执行: 异步(asynchronous):指任务不进入主线程,进入任务队列(task):当“任务队列”通知主线程,异步任务才 ...
- 第二十二天- 序列化 pickle json shelve
# 序列化:存储或传输数据时,把对象处理成方便存储和传输的数据格式,这个过程即为序列化# Python中序列化的三种方案:# 1.pickle python任意数据——>bytes写入⽂件:写好 ...