ldap如何挂mysql_MySQL数据库之如何搭建基于ldap和mysql的gerrit服务

本文主要向大家介绍了MySQL数据库之如何搭建基于ldap和mysql的gerrit服务 ,通过具体的内容向大家展现,希望对大家学习MySQL数据库有所帮助。

一.搭建数据库以及配置数据库

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).搭建的命令如下所示:

[root@svnnj01 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

http://192.168.100.198:8080

四. 登录后页面

本文由职坐标整理并发布,希望对同学们学习MySQL有所帮助,更多内容请关注职坐标数据库MySQL数据库频道!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值