1.安装JDK
执行sudo tar zxvf jdk-8u211-linux-x64.tar.gz -C /opt命令后
命令vim ~/.bashrc,配置jdk环境
export JAVA_HOME=/opt/jdk1.7.0_79 (此处是jdk的安装路径,注意到安装命令后有-C /opt,即安装路径)
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
问题:执行java -version命令,依旧无法识别java
解决:source .bashrc 使配置文件立即生效,就好啦!
2.端口配置问题
3个配置文件:
- ~/review_site/etc/gerrit.config
- /etc/apache2/sites-enabled/000-default.conf
- /etc/apache2/ports.conf
gerrit.config
[gerrit]
basePath = git
canonicalWebUrl = http://192.168.1.226:8082
serverId = 0607c0ef-9c85-4ee4-b603-62cf8b75f59c
[database]
type = H2
database = db/ReviewDB
[container]
javaOptions = "-Dflogger.backend_factory=com.google.common.flogger.backend.log4j.Log4jBackendFactory#getInstance"
javaOptions = "-Dflogger.logging_context=com.google.gerrit.server.logging.LoggingContext#getInstance"
user = pangqi
javaHome = /opt/jdk1.8.0_211/jre
[index]
type = LUCENE
[auth]
type = HTTP
[receive]
enableSignedPush = false
[sendemail]
smtpServer = localhost
[sshd]
listenAddress = *:29418
[httpd]
listenUrl = http://192.168.1.226:8081/
[cache]
directory = cache
000-default.conf
有很多方法都是在apache2目录下新建httpd.conf 或 在apache2/sites-enabled/gerrit-httpd.conf中配置,但是,我真心卡在了这里,直接在默认000-default.conf 文件中,添加如下配置信息即可:(根据自己的端口写哦)
<VirtualHost *:8082>
ServerName 192.168.1.226
ProxyPreserveHost On
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
AuthType Basic
AuthName "Welcomme to Gerrit Code Review Site!"
Require valid-user
AuthUserFile /home/pangqi/review_site/etc/passwd
</Location>
ProxyPass / http://192.168.1.226:8081/
proxyPassReverse / http://192.168.1.226:8081/
</VirtualHost>
ports.conf
NameVirtualHost *:80
NameVirtualHost *:8082
Listen 80
Listen 8082
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
https://www.cnblogs.com/jiangzhaowei/p/7922536.html
https://www.cnblogs.com/tesky0125/p/5877536.html