ubuntu下安装SVN

1。安装subversion和apache2的组件(已经认为您已经安装了apache2),

sudo apt-get install subversion subversion-tools  libapache2-svn



在/etc/apache2/mods-enabled中会多出来一下几个链接文件(实际文件在mods-available中,我们不需要去管,只需要关注enabled目录就成):

dav_fs.load dav_svn.conf dav_fs.conf dav.load dav_svn.load


2。建立svn数据库

sudo svnadmin create /var/svn 



ls /var/svn

你将得到这样的结果,则说明建立成功
conf dav db format hooks locks README.txt


3。配置apache


cd /etc/apache2/mods-enabled
sudo vi dav_svn.conf
 




按照提示去掉一些文件注释,最终的文件看起来如下


# dav_svn.conf - Example Subversion/Apache configuration
#
# For details and further options see the Apache user manual and
# the Subversion book.

# <Location URL> ... </Location>
# URL controls how the repository appears to the outside world.
# In this example clients access the repository as http://hostname/svn/
<Location /svn>

  # Uncomment this to enable the repository,
    DAV svn

  # Set this to the path to your repository
    SVNPath /var/svn

  # The following allows for basic http authentication.  Basic authentication
  # should not be considered secure for any particularly rigorous definition of
  # secure.

  # to create a passwd file
  # # rm -f /etc/apache2/dav_svn.passwd
  # # htpasswd2 -c /etc/apache2/dav_svn.passwd dwhedon
  # New password:
  # Re-type new password:
  # Adding password for user dwhedon
  # #

  # Uncomment the following 3 lines to enable Basic Authentication
    AuthType Basic
    AuthName "Subversion Repository"
    AuthUserFile /etc/apache2/dav_svn.passwd

  # Uncomment the following line to enable Authz Authentication
  # AuthzSVNAccessFile /etc/apache2/dav_svn.authz

  # The following three lines allow anonymous read, but make
  # committers authenticate themselves.

  <LimitExcept GET PROPFIND OPTIONS REPORT>
    Require valid-user
  </LimitExcept>

</Location>
 

或者象这样来实现独立的域名情况:

<VirtualHost 127.0.0.10>
        ServerName svn.rollenc.com
        DocumentRoot /var/svn

      <Location />
                DAV svn
                SVNPath /var/svn
                AuthType Basic
                AuthName "Subversion Repository"
                AuthUserFile /etc/apache2/dav_svn.passwd
                <LimitExcept GET PROPFIND OPTIONS REPORT>
                        Require valid-user
                </LimitExcept>
        </Location>
</VirtualHost>
 



4。建立密码文件
建立第一个用户需要加-c参数


sudo htpasswd2 -c /etc/apache2/dav_svn.passwd username
 


输入两次密码
建立其他用户:


sudo htpasswd2 /etc/apache2/dav_svn.passwd username2
 


注意没有加-c,加-c的话会清除掉以前存在的密码。
如果username2为已存在用户,那这句命令的意义就是修改密码

5.重启apache

sudo apache2 -k restart


如果一切正常的话,使用浏览器打开http://127.0.0.1/svn 应该看到如下信息
Revision 0: /
Powered by Subversion version 1.3.1 (r19032).


OK,安装完成
你可以对他进行一些import,commit等操作了

导入版本的文件框架

mkdir -p tmp/lab.rollenc.com/trunk tmp/eemap/trunk #如果你有其他已经写好的需要一起导入的文件,cp过来让在相应的trunk目录下,然后下一步。
svn import tmp http://127.0.0.10/ #更具提示输入message信息和用户,密码。
 

我在实验时发现有权限问题,这是你可能需要修改/var/svn的权限为可读写

sudo chmod -R 777 /var/svn
 

然后再继续执行上面的import操作。
现在使用浏览器打开http://127.0.0.10,可以得到

Revision 1: /

* eemap/
* lab.rollenc.com/


继续checkout和commit吧,祝你有一个愉快的subversion。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章