gerrit安裝及其注意事項


Gerrit安裝需要注意的點

1.注意jdk的版本(我選用jdk8)

2.設置好代理配置(apache或者nginx)

gerrit.config配置:

[gerrit]
basePath = git
serverId = 0c7ed3f1-6236-4a2b-a9ba-cd0ddec32092
canonicalWebUrl = http://192.168.245.131:8090
[database]
type = h2
database = /home/zb/review_site/db/ReviewDB
[noteDb "changes"]
disableReviewDb = true
primaryStorage = note db
read = true
sequence = true
write = true
[container]
user = zb
javaHome = /home/zb/jdk/jdk1.8.0_211
[index]
type = LUCENE
[auth]
type = HTTP
[receive]
enableSignedPush = false
[sendemail]
smtpServer = mail.100fen.cn
smtpServerPort = 25
smtpUser = 18269783010@100fen.cn
      from=CodeReview18269783010@100fen.cn
[sshd]
listenAddress = :29418
[httpd]
listenUrl = proxy-http://:8080/
[cache]
directory = cache

apache中000-default.conf配置:

 <VirtualHost *:8090>
      ProxyRequests Off
      ProxyVia Off
      ProxyPreserveHost On
<Proxy *>
  Order deny,allow
  Allow from all  
</Proxy>
<Location /login/>
  AuthType Basic
  AuthName "Welcome to Gerrit Code Review Site!"
  Require valid-user
  AuthUserFile /home/zb/review_site/gerrit.password
</Location>
AllowEncodedSlashes On
ProxyPass / http://127.0.0.1:8080/


ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

在000-default.conf同目錄新建一個gerrit-httpd.conf文件

配置主機ip:ServerName 192.168.245.131

apache中ports.conf配置:

NameVirtualHost *:80
NameVirtualHost *:8090

Listen 80
Listen 8090

<IfModule ssl_module>
Listen 443
</IfModule>

<IfModule mod_gnutls.c>
Listen 443
</IfModule>

 

在review_site目錄下新建一個gerrit.password文件用來存放用戶名和密碼

gerrit添加新用戶 htpasswd -c gerrit.password admin(在review_site目錄下輸入,就創建了一個用戶名為admin的賬戶)

之后添加用戶只需要把-c改為-m即可(記住要把所有用戶名改成自己的,上面例子配置的用戶名為zb)

服務器輸入:./review_site/bin/gerrit.sh start(啟動gerrit) systemctl start apache2.service (啟動apache服務)

瀏覽器輸入:http://192.168.245.131:8090 即可訪問 輸入創建好的用戶名和密碼即可登錄

按照這樣配置192.168.245.131要改成自己的虛擬主機ip

 

經過上面操作應該可以訪問gerrit,但是要想同一局域網下的所有電腦都能訪問則需要把虛擬機網絡ip設置成與該局域網下的網段相同(設置詳情見學習文件的文件夾中)。還完網段之后,要把Gerrit登陸網址設置成改變后的網絡ip,端口號不變,訪問這個網絡ip加端口號即可。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM