第3步:配置Apache2
编辑SVN配置文件,创建用于控制访问的SVN存储库。
sudo nano /etc/apache2/mods-enabled/dav_svn.conf
修改参考:
# .
# URL controls how the repository appears to the outside world.
# In this example clients access the repository as http://hostname/svn/
# Note, a literal /svn should NOT exist in your document root.
<Location /svn>
# Uncomment this to enable the repository
DAV svn
# Set this to the path to your repository
#SVNPath /var/lib/svn
# Alternatively, use SVNParentPath if you have multiple repositories under
# under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, . ).
# You need either SVNPath and SVNParentPath, but not both.
SVNParentPath /var/lib/svn
# Access control is done at 3 levels: (1) Apache authentication, via
# any of several methods. A "Basic Auth" section is commented out
# below. (2) Apache and , also commented out
# below. (3) mod_authz_svn is a svn-specific authorization module
# which offers fine-grained read/write access control for paths
# within a repository. (The first two layers are coarse-grained; you
# can only enable/disable access to an entire repository.) Note that
# mod_authz_svn is noticeably slower than the other two layers, so if
# you don't need the fine-grained control, don't configure it.
# Basic Authentication is repository-wide. It is not secure unless
# you are using https. See the 'htpasswd' command to create and
# manage the password file - and the documentation for the
# 'auth_basic' and 'authn_file' modules, which you will need for this
# (enable them with 'a2enmod').
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
# To enable authorization via mod_authz_svn (enable that module separately):
#
#AuthzSVNAccessFile /etc/apache2/dav_svn.authz
#
# The following three lines allow anonymous read, but make
# committers authenticate themselves. It requires the 'authz_user'
# module (enable it with 'a2enmod').
#
Require valid-user
#
</Location>
运行以下命令以在/var/lib/svn目录中创建SVN存储库。
sudo mkdir /var/lib/svn sudo svnadmin create /var/lib/svn/repository sudo chown -R www-data:www-data /var/lib/svn sudo chmod -R 775 /var/lib/svn
第4步:创建SVN用户帐户
创建帐户名称admin:
sudo htpasswd -cm /etc/apache2/dav_svn.passwd admin
键入密码并继续完成设置。
重复上面的步骤以创建其他用户。
重新启动Apache2
sudo systemctl restart apache2.service
现在就可以使用浏览器浏览repository了:
http://example.com/svn/repository
第1步:安装apache2
Subversion服务器需要Web或者HTTP服务器。
我们将使用Apache2,使用下面的命令安装Apache2.
sudo apt update sudo apt install apache2 apache2-utils
安装Apache2后,下面的命令可用于停止,启动和启用Apache2服务。
sudo systemctl stop apache2.service sudo systemctl start apache2.service sudo systemctl enable apache2.service
第2步:在Ubuntu上安装SVN包
运行以下命令以获取SVN包,包括所有依赖项:
sudo apt-get install subversion libapache2-mod-svn subversion-tools libsvn-dev
启用允许Subversion功能的Apache2模块。
sudo a2enmod dav sudo a2enmod dav_svn sudo service apache2 restart
日期:2020-07-07 20:55:42 来源:oir作者:oir
