在CentOS中安装配置Svn+Ssl+Mysql

1.svn安装

yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql


确定已经安装了svn模块:
           #cd /etc/httpd/modules
           #ls | grep svn
             mod_authz_svn.so
             mod_dav_svn.so

      如果要确认是否成功的安装了svn可以通过如下的命令进行验证:
           svn --version
显示如下,表示正常:


   svn, version 1.1.4 (r13838)
         compiled Aug 21 2005, 20:56:55
    Copyright (C) 2000-2004 CollabNet.
          Subversion is open source software, see http://subversion.tigris.org/
          This product includes software developed by CollabNet (http://www.Collab.Net/ ).
     The following repository access (RA) modules are available:


     * ra_dav : Module for accessing a repository via WebDAV (DeltaV) protocol.
            - handles 'http' schema
            - handles 'https' schema
          * ra_local : Module for accessing a repository on local disk.
            - handles 'file' schema
          * ra_svn : Module for accessing a repository using the svn network protocol.
            - handles 'svn' schema

2.Mysql的安装配置

安装MySQL

  #yum -y install mysql-server 

安装php-mysql
       #yum -y install php-mysql 

设置MySQL服务随系统启动自启动

  #chkconfig mysqld on 
      确认MySQL自启动

  #chkconfig --list mysqld

启动MySQL服务

  #/etc/init.d/mysqld start          

创建SVN用户的认证数据库
*********************************Command*********************************
[root@rep /]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or /g.
Your MySQL connection id is 8 to server version: 5.0.22

Type 'help;' or '/h' for help. Type '/c' to clear the buffer.

mysql> create database auth;
Query OK, 1 row affected (0.00 sec)

mysql> use auth;                            #创建数据库,为什么创建这样的数据库可以参看/etc/httpd/conf.d/auth_mysql.conf
Database changed
mysql> CREATE TABLE users (
    ->   user_name CHAR(30) NOT NULL,
    ->   user_passwd CHAR(20) NOT NULL,
    ->   PRIMARY KEY (user_name)
    -> );

Query OK, 0 rows affected (0.01 sec)

mysql> GRANT SELECT                         #更改数据库权限
    ->  ON auth.users
    ->  TO authuser@localhost
    ->  IDENTIFIED BY 'Your Password Here';
Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;                    #权限生效
Query OK, 0 rows affected (0.00 sec)

mysql> INSERT INTO users VALUES ('test', ENCRYPT('PaSsWoRd'));    #添加测试帐号
Query OK, 1 row affected (0.00 sec)

mysql> exit
Bye

3.svn的配置

下面将使用myapp这个仓库来配置Subversion

mkdir  -p /var/www/svn
     # cd  /var/www/svn
     # svnadmin create myapp
     # chown  -R apache: apache myapp
     # vi /etc/httpd/conf.d/subversion.conf

加入以下配置

<Location /svn>
        DAV svn
        SVNParentPath /var/www/svn
  #这个就是SVN的父级目录,如果你只有一个库可以写成SVNPath
     #
     #   # Limit write permission to list of valid users.
         <LimitExcept GET PROPFIND OPTIONS REPORT>
     #      # Require SSL connection for password protection.
     #      # SSLRequireSSL
     #
                AuthType  Basic
                AuthName  "Authorization Realm"

          AuthzSVNAccessFile /var/www/svn/auth/authz     #权限验证文件
                AuthMYSQLEnable on
                AuthMySQLUser authuser               #访问mysql的用户名
                AuthMySQLPassword "Your Password Here"    #访问mysql的密码
                AuthMySQLDB auth
                AuthMySQLUserTable users                   #用户验证的数据库
                AuthMySQLNameField user_name           #用户验证数据库的用户名字段
                AuthMySQLPasswordField user_passwd    #用户验证数据库的密码字段


                Require  valid-user
         </LimitExcept>
     </Location>

 

 

 

3.编写权限文件

         

         AuthzSVNAccessFile控制每个目录的读写权限


            [test:/]

              1 = r 

              2 = r 

              3 = r 


           [test:/1]

              1 = rw 


           [test:/2]

              2 = rw


重起Apache

       # service httpd restart











Subversion部分安装完成,打开浏览器访问https://localhost/svn/myapp 即可看到效果。




  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值