首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > CVS SVN >

Debian6停安装SVN+Apache2+SSH实现HTTPS

2012-06-28 
Debian6下安装SVN+Apache2+SSH实现HTTPS休息了很久没写什么东西,最近工作需要配置了一下https的svn服务器,

Debian6下安装SVN+Apache2+SSH实现HTTPS

休息了很久没写什么东西,最近工作需要配置了一下https的svn服务器,留个爪子分享一下

?

#首先需要安装所需要的软件apt-get install subversion libapache2-svn apache2 subversion-tools#增加subversion用户组sudo addgroup subversion#www-data是apache默认的,让他也能够管理subversion的东西sudo usermod -G subversion -a www-data#检查结果看上去应该像这样:# cat /etc/group|grep subversion#subversion:x:1001:www-data,exp#执行下面的命令sudo mkdir /usr/svncd /usr/svnsudo mkdir StrongWEBsudo chown -R root:subversion StrongWEB#下面的命令用于创建 SVN 文件仓库sudo svnadmin create /usr/svn/StrongWEB#赋予组成员对所有新加入文件仓库的文件拥有相应的权限:sudo chmod -R g+rws StrongWEB#查看txn-current-lock文件的权限,应该类似于: #ls -l /usr/svn/StrongWEB/db/txn-current-lock#-rw-rwSr-- 1 root subversion  0  2009-06-18  15:33  txn-current-lock#您必须加入下面的代码片段到您的 /etc/apache2/mods-available/dav_svn.conf中: # SSLRequireSSL 为强制使用SSL连接# Require valid-user 为强迫登录# SVNParentPath 为多个版本库时使用 单个版本库时可使用 SVNPath#注意下面是/svn/,最后的那个/不能少<Location /svn/>DAV svnSSLRequireSSLSVNParentPath /usr/svn/AuthzSVNAccessFile /usr/svn/authz.confAuthType BasicAuthName "StrongWEB subversion repository"AuthUserFile /etc/subversion/passwdSVNListParentPath on #这个是否允许列表svn的目录,即可以查看所有项目列表#<LimitExcept GET PROPFIND OPTIONS REPORT>Require valid-user#</LimitExcept></Location>#您需要创建 /etc/subversion/passwd 文件,该文件包含了用户授权的详细信息。要添加用户,您可以执行下面的命令:#“-c”选项表示创建新的/etc/subversion/passwd文件htpasswd -c /etc/subversion/passwd user_name#如果要添加其他用户,则去掉“-c”选项即可# htpasswd /etc/subversion/passwd other_user_name#建立  SSL 认证mkdir /etc/apache2/sslopenssl req -new -x509 -days 365 -nodes -out /etc/apache2/ssl/apache.pem -keyout /etc/apache2/ssl/apache.pem#-days 365 中的365代表证书的有效期是一年,如果出现SSL 接收到一个超出最大准许长度的记录。对不起,你设置的事件太长,改小点吧#回答运行中的提问,切记!!!一定要填写,否则web能打开,但是小乌龟的svn会报错!!!#启用SSL使其有效a2enmod ssl#然后确认一下/etc/apache2/ports.conf里包含有"Listen 443"之类的字段#重写 rewrite rule 如下操作:a2enmod rewritecp /etc/apache2/sites-available/default /etc/apache2/sites-available/ssl#修改这两个文件的对应内容:# "default" 文件:NameVirtualHost *:80<virtualhost *:80>    RewriteEngine On    RewriteCond %{HTTPS} off    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}    RewriteLog      "/var/log/apache2/rewrite.log"</virtualhost># "ssl" 文件:NameVirtualHost *:443<virtualhost *:443>        ServerAdmin webmaster@localhost        SSLEngine On        SSLCertificateFile /etc/apache2/ssl/apache.pem        DocumentRoot /var/www/        <directory />                Options FollowSymLinks                AllowOverride None        </directory>        <directory /var/www/>                Options Indexes FollowSymLinks MultiViews                AllowOverride None                Order allow,deny                allow from all                # This directive allows us to have apache2's default start page                # in /apache2-default/, but still have / go to the right place                # Commented out for Ubuntu                #RedirectMatch ^/$ /apache2-default/        </directory>        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/        <directory "/usr/lib/cgi-bin">                AllowOverride None                Options ExecCGI -MultiViews +SymLinksIfOwnerMatch                Order allow,deny                Allow from all        </directory>        ErrorLog /var/log/apache2/error.log        # Possible values include: debug, info, notice, warn, error, crit,        # alert, emerg.        LogLevel warn        CustomLog /var/log/apache2/access.log combined        ServerSignature On    Alias /doc/ "/usr/share/doc/"    <directory "/usr/share/doc/">        Options Indexes MultiViews FollowSymLinks        AllowOverride None        Order deny,allow        Deny from all        Allow from 127.0.0.0/255.0.0.0 ::1/128    </directory></virtualhost>#修改以后执行a2ensite ssl/etc/init.d/apache2 restart# Apache 方式下的分组管理 有时,我们希望能够将多个开发人员编为一组,使用组的方式来为 项目设定权限。比如 projectA 项目只有属于 groupA 的成员才可以存取。下面我们来介绍其配置方法。这里,我们就要用到 mod_authz_svn 提供的功能了。我们对 /etc/apache2/mods-available/dav_svn.conf 中的目录配置可再做一次修改:<Location /svn/StrongWEB>DAV svnSSLRequireSSLSVNPath /usr/svn/StrongWEBAuthzSVNAccessFile /usr/svn/authz.confAuthType BasicAuthName "StrongWEB subversion repository"AuthUserFile /etc/subversion/passwd<LimitExcept GET PROPFIND OPTIONS REPORT>Require valid-user</LimitExcept></Location>#authz.conf大致结构如下:[groups]everyone = simen , jby , atugroupA = simengroupB = jby , atu[StrongWEB:/]@groupA = rw@everyone = r[StrongWEB123:/]@everyone = r@groupB = rw# 文件权限再次设定# 每次新增版本库都必须执行下面的操作chown -R root:subversion /usr/svn/chmod -R g+rws /usr/svn/
?

热点排行