Linux 学习

来源:互联网 发布:康拉德格拉夫钢琴 知乎 编辑:程序博客网 时间:2024/05/20 08:21

  • 安装 SVN
  • 安装 Apache
  • 整合
  • 遇到问题

对于需要使用 SVN的用户来说,如果想要搭建一个自己的版本控制,SVN相对于GIT 来说简单很多。

之前写了一个只搭建 SVN的教程,链接:Ubuntu学习 - SVN服务搭建

  1. SVN 的默认端口是:3690 有的服务器不给开这个端口
  2. 单独只搭建 SVN是无法用网页打开查看 SVN项目的。

安装 SVN

sudo apt-get install subversion   //创建项目目录mkdir ~/svncd svn/svnadmin create new_projectcd ../sudo chown -R www-data:www-data ./svn

安装 Apache

安装:

sudo apt-get install apache2

整合

  1. 安装模块
sudo apt-get install libapache2-svn sudo apt-get install apache2-utils 
  1. 修改配置
sudo vim /etc/apache2/mods-available/dav_svn.conf

修改成下面这样:

# dav_svn.conf - Example Subversion/Apache configuration## For details and further options see the Apache user manual and# the Subversion book.## NOTE: for a setup with multiple vhosts, you will want to do this# configuration in /etc/apache2/sites-available/*, not here.# <Location URL> ... </Location># 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 /home/alps/repository  # 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 <Limit> and <LimitExcept>, 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 /home/alps/repository/slowtech/conf/passwd  # To enable authorization via mod_authz_svn (enable that module separately):  #<IfModule mod_authz_svn.c>  #AuthzSVNAccessFile /etc/apache2/dav_svn.authz  #</IfModule>  # The following three lines allow anonymous read, but make  # committers authenticate themselves.  It requires the 'authz_user'  # module (enable it with 'a2enmod').  #<LimitExcept GET PROPFIND OPTIONS REPORT>    Require valid-user  #</LimitExcept></Location>

其中Location /svn这里是要访问的地址后缀。

AuthUserFile //这个是 passwd文件

然后添加一个用户:

sudo htpasswd  ~/svn/new_project/conf/passwd alps//要求输入密码

会在 passwd的文件里生成用户名和你刚才输入的密码

  1. 重启 apache2
sudo apachectl restart
  1. 打开 http://localhost/svn

遇到问题

<D:error xmlns:D="DAV:" xmlns:m="http://apache.org/dav/xmlns" xmlns:C="svn:"><C:error/><m:human-readable errcode="13">Could not open the requested SVN filesystem</m:human-readable></D:error>

这个错误首先看配置文件是否有错。

然后看文件夹的权限配置是否有错。

参考:StackOverflow Ubuntu + SVN: Could not open the requested SVN filesystem

原创粉丝点击