20.04.2-Ubuntu SVN+HTTPS管理多个仓库

20.04.2-Ubuntu SVN+HTTPS管理多个仓库

公司搭建linux svn, 需要单独分开版本,这里记录一下。

先说开启https服务

sudo a2enmod ssl
sudo a2ensite default-ssl.conf
sudo systemctl restart apache2

再是开启svn

$ sudo apt-get install subversion apache2 libapache2-mod-svn
$ sudo vi /etc/apache2/dav_svn.authz
[groups]
svn = test1,test2
 
[/]
@svn = rw
 
[a:/]
test1 = rw
* = r
 
[b:/]
test1 = rw
* = r
$ sudo htpasswd -bc /etc/apache2/dav_svn.passwd test1 111
$ sudo htpasswd -b /etc/apache2/dav_svn.passwd test2 222
$ sudo mv /etc/apache2/mods-enabled/dav_svn.conf /etc/apache2/mods-enabled/dav_svn.bak
$ sudo vi /etc/apache2/mods-enabled/dav_svn.conf
<Location /svn/a>
  DAV svn
  SVNPath /svn/a
  SVNListParentPath on
  AuthType Basic
  AuthName "Project A"
  AuthUserFile /etc/apache2/dav_svn.passwd
  AuthzSVNAccessFile /etc/apache2/dav_svn.authz
  Require valid-user
  SSLRequireSSL
</Location>
<Location /svn/b>
  DAV svn
  SVNPath /svn/b
  SVNListParentPath on
  AuthType Basic
  AuthName "Project B"
  AuthUserFile /etc/apache2/dav_svn.passwd
  AuthzSVNAccessFile /etc/apache2/dav_svn.authz
  Require valid-user
  SSLRequireSSL
</Location>
$ sudo mkdir /svn && sudo chmod 777 /svn
$ svnadmin create /svn/a
$ svnadmin create /svn/b
$ sudo a2enmod ssl
$ sudo su
# openssl genrsa -des3 -out svn.key 1024
# openssl req -new -key svn.key -x509 -out svn.crt -config /etc/ssl/openssl.cnf -days 3650
# chown -R www-data:www-data /svn
# systemctl restart apache2

你可能感兴趣的:(实用技巧,svn,ubuntu)