ubuntu 环境下 gerrit 代码审查服务器的安装
2014-01-10 10:46
423 查看
1. 环境准备
安装java环境$ wget http://openlinux.amlogic.com:8000/deploy/java/sun-java6-bin_6.26-2lucid1_amd64.deb $ wget http://openlinux.amlogic.com:8000/deploy/java/sun-java6-jdk_6.26-2lucid1_amd64.deb $ wget http://openlinux.amlogic.com:8000/deploy/java/sun-java6-jre_6.26-2lucid1_all.deb $ sudo dpkg -i sun-java6* $ apt-get -f install
安装 apache
如果安装的是apache httpd,后面的配置文件不太一样,所以尽量安装 apache2
$ sudo apt-get install apache2
2. 安装配置 gerrit
参考 http://gerrit.googlecode.com/svn/documentation/2.2.1/2.1 安装 gerrit
新建一个专用 linux 账号$ sudo adduser gerrit $ sudo su gerrit $ cd ~
下载安装包
$ wget http://gerrit-releases.storage.googleapis.com/gerrit-2.8-rc3.war[/code]
安装$ java -jar gerrit-2.8-rc3.war init -d review_site2.2 配置 gerrit
参考 http://gerrit.googlecode.com/svn/documentation/2.2.1/config-gerrit.html$ cat review_site/etc/gerrit.config [gerrit] basePath = git canonicalWebUrl = http://192.168.27.42:8081/gerrit [database] type = h2 database = db/ReviewDB [auth] type = HTTP #httpHeader = SM_USER [sendemail] smtpServer = mail.pptv.com smtpServerPort = 587 smtpEncryption = smtpUser = cmguo smtpPass = 123456 sslVerify = false from = PPBOX ROM GERRIT <ppbox-rom@pptv.com> [container] user = gerrit javaHome = /usr/lib/jvm/java-6-sun-1.6.0.26/jre [sshd] listenAddress = *:29418 [httpd] listenUrl = proxy-http://*:8081/gerrit [cache] directory = cache2.3 配置 apache
启动反向代理$ cd /etc/apache2/mods-enabled $ ln ../mods-available/proxy.* . $ ln ../mods-available/proxy_http.* .
配置反向代理$ cat mods-enabled/proxy.conf <IfModule mod_proxy.c> # If you want to use apache2 as a forward proxy, uncomment the # 'ProxyRequests On' line and the <Proxy *> block below. # WARNING: Be careful to restrict access inside the <Proxy *> block. # Open proxy servers are dangerous both to your network and to the # Internet at large. # # If you only want to use apache2 as a reverse proxy/gateway in # front of some web application server, you DON'T need # 'ProxyRequests On'. #ProxyRequests On <Proxy *> AddDefaultCharset off Order deny,allow Allow from all #Allow from .example.com </Proxy> # Enable/disable the handling of HTTP/1.1 "Via:" headers. # ("Full" adds the server version; "Block" removes all outgoing Via: headers) # Set to one of: Off | On | Full | Block #ProxyVia Off ProxyPreserveHost On #AllowEncodedSlashes On ProxyPass /gerrit http://localhost:8081/gerrit nocanon </IfModule> $ cat sites-available/default <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined AllowEncodedSlashes NoDecode </VirtualHost>
配置HTTP认证$ cat /etc/apache2/httpd.conf <Location /gerrit/login/> AuthType Basic AuthName "Gerrit Code Review" Require valid-user AuthUserFile /home/gerrit/review_site/etc/gerrit.passwd </Location> $ touch /home/gerrit/review_site/etc/gerrit.passwd可能有些版本的apach2没有在apache2.conf文件中包含(Include)httpd.conf文件,需要手动添加
增加管理员账号$ htpasswd /home/gerrit/review_site/etc/gerrit.passwd cmguo2.4 验证 gerrit 安装
登陆 http://192.168.13.202/gerrit/login3. 集成 gitweb
安装 gitweb$ sudo apt-get install gitweb
配置 gitweb
在 gerrit 配置文件添加 gitweb 配置$ tail gerrit.config user = gerrit javaHome = /usr/lib/jvm/java-6-sun-1.6.0.26/jre [sshd] listenAddress = *:29418 [httpd] listenUrl = proxy-http://*:8081/gerrit [cache] directory = cache [gitweb] cgi = /usr/lib/cgi-bin/gitweb.cgi
配置 gerrit 访问权限
gitweb 需要能够访问 refs/meta/config,需要修改 All-Projects 项目,增加 Registered Users 对 refs/meta/config 的 read 访问权限。4. 添加新用户
4.1 注册账号
注册 gerrit 账号$ htpasswd /home/gerrit/review_site/etc/gerrit.passwd isxxguo
注册 SSH key
登陆 http://192.168.13.202/gerrit/
按提示输入用户名,密码
第一次进入会提示完善账号信息,并且添加 SSH KEY4.2 用户本地配置
配置SSH主机别名$ cat ~/.ssh/config host ppboxrom user isxxguo hostname 192.168.13.202 port 29418 identityfile ~/.ssh/id_rsa
相关文章推荐
- redhat 环境下 gerrit 代码审查服务器的安装
- ubuntu 12.04搭建gerrit代码审查环境
- [置顶] 腾讯云服务器中Ubuntu上的jdk,tomcat,MySQL的安装和环境配置
- linux 下 VNC Server安装配置及 eclipse CDT C/C++ 开发环境搭建(我用的是阿里云服务器 ubuntu 12.04 64-bit,无图形化界面)
- 阿里云学生服务器搭建网站(2)-Ubuntu16.04安装php开发环境
- ubuntu搭建Gerrit代码审核服务器
- [转载]阿里云服务器ubuntu安装java运行环境
- 在服务器上安装caffe环境(ubuntu14.04+非root权限+opencv3.3.1+anaconda3)
- Ubuntu14.04中安装nodejs及其代码环境配置
- Ubuntu 10.04 的源服务器和PXE安装环境搭建。
- Ubuntu 16.04 安装 Apache, MySQL, PHP7,防火墙,服务器环境一站式解决bingo
- MACOS:安装Ubuntu1604虚拟机实例并配置bitcoin代码编译开发环境
- 在 Ubuntu 16.04 为 Nginx 服务器安装 LEMP 环境(MariaDB,PHP 7 并支持 HTTP 2.0)
- 嵌入式Linux开发环境的建立——Ubuntu上安装nfs服务器
- ubuntu服务器环境安装脚本
- ubuntu12.04安装gerrit代码审核服务器
- 服务器环境之5:ubuntu14.04安装git及使用
- Ubuntu环境下安装tomcat服务器,发布外网网站,可直接用ip地址访问
- Ubuntu 搭建LNMP环境图文教程 安装Nginx服务器
- ubuntu 安装配置 gerrit 服务器 [ HTTP 认证 ]