遵循以下说明: https://gerrit-documentation.storage.googleapis.com/Documentation/2.11.4/install.html
已安装postgres 9.3:
sudo -i -u postgres
postgres@ubuntu:~$ psql
psql (9.3.10)
Type "help" for help.
postgres=#
即使我创建了用户和数据库
,gerrit2用户也无法访问psqlpostgres@ubuntu:~$ createuser --username=postgres -RDIElPS gerrit2
postgres@ubuntu:~$ createdb --username=postgres -E UTF-8 -O gerrit2 reviewdb
^d
gerrit2@ubuntu:~$ psql
psql: FATAL: database "gerrit2" does not exist
安装的gerrit 2.11.4:
gerrit2@ubuntu:~$ java -jar gerrit-2.11.4.war init -d .
请参阅gerrit.conf安装结果:
[gerrit]
basePath = .
canonicalWebUrl = http://ubuntu:8080/
[database]
type = postgresql
hostname = localhost
database = reviewdb
username = gerrit2
[index]
type = LUCENE
[auth]
type = OPENID
[sendemail]
smtpServer = localhost
smtpUser = lmougen5
[container]
user = gerrit2
javaHome = /usr/lib/jvm/java-7-openjdk-amd64/jre
[sshd]
listenAddress = *:22
[httpd]
listenUrl = http://*:8080/
[cache]
directory = cache
gerrit init没有按照说明启动浏览器,所以我尝试了一个reindex。注意输出中的错误:
gerrit2@ubuntu:~$ java -jar gerrit-2.11.4.war reindex
[2015-11-19 16:42:24,861] INFO com.google.gerrit.server.git.LocalDiskRepositoryManager : Defaulting core.streamFileThreshold to 119m
[2015-11-19 16:42:25,542] INFO com.google.gerrit.server.cache.h2.H2CacheFactory : Enabling disk cache /home/gerrit2/cache
Reindexing changes: done
Reindexed 0 changes in 0.0s (0.0/s)
[2015-11-19 16:42:26,525] WARN com.google.gerrit.server.cache.h2.H2CacheImpl : Cannot build BloomFilter for jdbc:h2:file:/home/gerrit2/cache/diff_intraline: Error opening database: "Sleep interrupted" [8000-174]
[2015-11-19 16:42:26,526] INFO com.google.gerrit.server.cache.h2.H2CacheFactory : Finishing 4 disk cache updates
然后重启,可能需要先解决错误。随着gerrit2用户访问psql reviewdb:
gerrit2@ubuntu:~$ ~/bin/gerrit.sh restart
重启失败,这里〜/ logs / error_log:
[2015-11-20 08:12:30,627] INFO com.google.gerrit.server.cache.h2.H2CacheFactory : Enabling disk cache /home/gerrit2/cache
[2015-11-20 08:12:31,970] INFO com.google.gerrit.server.config.ScheduleConfig : gc schedule parameter "gc.interval" is not configured
[2015-11-20 08:12:33,640] WARN com.google.gerrit.httpd.GitWebConfig : gitweb not installed (no /usr/lib/cgi-bin/gitweb.cgi found)
[2015-11-20 08:12:34,415] INFO org.eclipse.jetty.util.log : Logging initialized @8505ms
[2015-11-20 08:12:35,115] INFO com.google.gerrit.server.git.LocalDiskRepositoryManager : Defaulting core.streamFileThreshold to 119m
[2015-11-20 08:12:35,204] INFO com.google.gerrit.server.plugins.PluginLoader : Loading plugins from /home/gerrit2/plugins
[2015-11-20 08:12:35,363] INFO com.google.gerrit.server.plugins.PluginLoader : Loaded plugin commit-message-length-validator, version v2.11.4
[2015-11-20 08:12:35,479] INFO com.google.gerrit.server.plugins.PluginLoader : Loaded plugin download-commands, version v2.11.4
[2015-11-20 08:12:35,603] WARN com.googlesource.gerrit.plugins.replication.ReplicationFileBasedConfig : Config file /home/gerrit2/etc/replication.configdoes not exist; not replicating
[2015-11-20 08:12:35,617] INFO com.google.gerrit.server.plugins.PluginLoader : Loaded plugin replication, version v2.11.4
[2015-11-20 08:12:35,726] INFO com.google.gerrit.server.plugins.PluginLoader : Loaded plugin reviewnotes, version v2.11.4
[2015-11-20 08:12:35,787] INFO com.google.gerrit.server.plugins.PluginLoader : Loaded plugin singleusergroup, version v2.11.4
[2015-11-20 08:12:36,290] ERROR com.google.gerrit.pgm.Daemon : Unable to start daemon
java.lang.IllegalStateException: Cannot bind to *
at com.google.gerrit.sshd.SshDaemon.start(SshDaemon.java:319)
at com.google.gerrit.lifecycle.LifecycleManager.start(LifecycleManager.java:74)
at com.google.gerrit.pgm.Daemon.start(Daemon.java:293)
at com.google.gerrit.pgm.Daemon.run(Daemon.java:205)
at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:64)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:166)
at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:93)
at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:50)
at Main.main(Main.java:25)
Caused by: java.io.IOException: Error while binding on 0.0.0.0/0.0.0.0:22
original message : Permission denied
at org.apache.mina.transport.socket.nio.NioSocketAcceptor.open(NioSocketAcceptor.java:238)
at org.apache.mina.transport.socket.nio.NioSocketAcceptor.open(NioSocketAcceptor.java:51)
at org.apache.mina.core.polling.AbstractPollingIoAcceptor.registerHandles(AbstractPollingIoAcceptor.java:582)
at org.apache.mina.core.polling.AbstractPollingIoAcceptor.access$400(AbstractPollingIoAcceptor.java:70)
at org.apache.mina.core.polling.AbstractPollingIoAcceptor$Acceptor.run(AbstractPollingIoAcceptor.java:456)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)