如何搭建基于ldap和mysql的gerrit服务
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何搭建基于ldap和mysql的gerrit服务相关的知识,希望对你有一定的参考价值。
一.搭建数据库以及配置数据库
1.使用yum install mysql-server安装mysql
2.mysqladmin -u root password archermind(第一次设置密码).设置密码
3.修改 vi /etc/my.cnf
增加[client]项以及修改[mysqld]项.具体如下所示:
[client]
#password = your_password
port = 3306
socket = /var/lib/mysql/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
default-character-set=utf8
[mysqld]
default-storage-engine = innodb-----这一行要加上
character-set-server=utf8-----这一行要加上
collation-server=utf8_general_ci-----这一行要加上
4.启动mysql服务
service mysqld start
5.新建数据库
(1).输入mysql -uroot –p(密码为archermind)
(2).create database gerritdb;
(3).grant all on gerritdb.* to ‘root‘@‘localhost‘ identified by ‘archermind‘;
(4).flush privileges;
(5).ALTER DATABASE gerritym charset=utf8;
(6). flush privileges;
二. 搭建gerrit
gerrit-2.11.war包可以在网上找到共享的包
(1).搭建的命令如下所示:
[[email protected] gerrit]# java -jar gerrit-2.11.war init -d review_site
Using secure store: com.google.gerrit.server.securestore.DefaultSecureStore
*** Gerrit Code Review 2.11
***
*** Git Repositories
***
Location of Git repositories [git]:
*** SQL Database
***
Database server type [mysql]:
Server hostname [localhost]:
Server port [(mysql default)]:
Database name [gerritdb]:
Database username [root]:
Change root‘s password [y/N]? y
root‘s password :
confirm password :
ec
*** Index
***
Type [LUCENE/?]:
The index must be rebuilt before starting Gerrit:
java -jar gerrit.war reindex -d site_path
*** User Authentication
***
Authentication method [LDAP/?]:
LDAP server ldap://192.168.100.101:389:
LDAP username cn=domainldap.OU=IT.OU=archermind.DC=archermind.DC=com:
Change cn=domainldap.OU=IT.OU=archermind.DC=archermind.DC=com‘s password [y/N]?
Account BaseDN DC=archermind.DC=com:
Group BaseDN DC=archermind.DC=com:
*** Review Labels
***
Install Verified label [y/N]?
*** 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.0-openjdk-1.8.0.45-28.b13.el6_6.x86_64/jre]:
Upgrade /data1/gerrit/review_site/bin/gerrit.war [Y/n]?
Copying gerrit-2.11.war to /data1/gerrit/review_site/bin/gerrit.war
*** SSH Daemon
***
Listen on address [*]:
Listen on port [29418]:
*** HTTP Daemon
***
Behind reverse proxy [y/N]?
Use SSL (https://) [y/N]?
Listen on address [*]:
Listen on port [8080]:
Canonical URL [http://localhost:8080/]:
*** Plugins
***
Installing plugins.
Install plugin download-commands version v2.11 [y/N]?
Install plugin reviewnotes version v2.11 [y/N]?
Install plugin singleusergroup version v2.11 [y/N]?
Install plugin replication version v2.11 [y/N]?
Install plugin commit-message-length-validator version v2.11 [y/N]?
Initializing plugins.
No plugins found with init steps.
Initialized /data1/gerrit/review_site
(2).
修改 /data1/gerrit/review_site/etc/gerrit.config中的内容.如下所示:
[gerrit]
basePath = git
canonicalWebUrl = http://10.20.70.135:8080/
[database]
type = mysql
hostname = localhost
database = gerritdb
username = root
[index]
type = LUCENE
[auth]
type = LDAP
[ldap]
server = ldap://192.168.100.101:389
username = cn=domainldap.OU=IT.OU=archermind.DC=archermind.DC=com
accountBase = DC=archermind.DC=com
groupBase = DC=archermind.DC=com
accountPattern = (sAMAccountName=${username})
accountFullName = displayName
[sendemail]
smtpServer = smtp.archermind.com
smtpServerPort = 25
smtpUser = mailman
[container]
user = root
javaHome = /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.45-28.b13.el6_6.x86_64/jre
[sshd]
listenAddress = *:29418
[httpd]
listenUrl = http://*:8080/
[cache]
directory = cache
(3).重启gerrit
/work/gerrit/review_site/bin/gerrit.sh restart
三. 网页访问gerrit
四. 登录后页面
本文出自 “7582964” 博客,请务必保留此出处http://jiyude.blog.51cto.com/7582964/1751145
以上是关于如何搭建基于ldap和mysql的gerrit服务的主要内容,如果未能解决你的问题,请参考以下文章