http://blog.51yip.com/server/901.html
http://blog.csdn.net/pwlazy/article/details/1713613
一,安裝要的軟體
wget http://subversion.tigris.org/downloads/subversion-1.6.1.tar.gz
wget http://subversion.tigris.org/downloads/subversion-deps-1.6.1.tar.gz
svn的官方網址是http://subversion.tigris.org/
上面二個壓縮檔解壓後會放到同一個檔案下,不要另建檔案夾
二,安裝獨立svn
1,解壓安裝
- tar zxvf subversion-1.6.1.tar.gz
- tar zxvf subversion-deps-1.6.1.tar.gz
- cd subversion-1.6.1/
- ./configure --prefix=/usr/local/svn
- make && make install
到這兒就安裝好了。安裝獨立svn,它也考慮到將來有可能會和apache結合,所以安裝的時候,它把和apache結合要用到的模組都放到/usr/lib/httpd/modules,部分提示如下
Libraries have been installed in:
/usr/lib/httpd/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
2,查看svn資訊
[root@BlackGhost bin]# /usr/local/svn/bin/svnserve --version
svnserve, version 1.6.1 (r37116)
compiled Jul 7 2010, 23:06:21
Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).
The following repository back-end (FS) modules are available:
* fs_fs : Module for working with a plain file (FSFS) repository.
Cyrus SASL authentication is available.
3,將svn的bin目錄加到環境變數中去
[root@BlackGhost /]# PATH=$PATH:/usr/local/svn/bin
[root@BlackGhost /]# export PATH
[root@BlackGhost /]# svn
svn svnadmin svnlook svnsync
svn2abs svndumpfilter svnserve svnversion
三,建立倉庫,配置svn
1,建個svn的根目錄,因為項目不只一個
[zhangy@BlackGhost ~]$ mkdir -p /home/zhangy/www #-p的意思是說如果沒有父目錄建之
2,建個倉庫
[zhangy@BlackGhost ~]$ mkdir -p /home/zhangy/www/repos
[zhangy@BlackGhost www]$ svnadmin create /home/zhangy/www/repos/
3,匯入資料
[zhangy@BlackGhost ~]$ svn import ./svntest file:///home/zhangy/www/repos -m "Initial repository test"
Adding svntest/test.php
Committed revision 1.
4,修改svnserve.conf
[root@BlackGhost conf]# vi svnserve.conf
[general]
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz
5,目錄控制檔案authz
[root@BlackGhost conf]# vi authz
[groups]
admin= zhangy
[repos:/]
@admin = rw
* = r
6,修改使用者密碼檔案passwd
[root@BlackGhost conf]# vi passwd
[users]
zhangy = *****
四,啟動和簡單測試
1,啟動svn
[root@BlackGhost www]# svnserve -d -r /home/zhangy/www
在這裡特別的要注意,/home/zhangy/www是倉庫的根目錄,不要和[repos:/]目錄重疊了。如果重疊是會提示你以下錯誤
[zhangy@BlackGhost checkout]$ svn co svn://127.0.0.1/
svn: Authorization failed
2,測試svn
a),checkout
[zhangy@BlackGhost checkout]$ svn co svn://127.0.0.1/repos
Authentication realm: <svn://127.0.0.1:3690> 3d0c32b1-3841-4518-b6b1-dcdb6c7ed716
Password for 'zhangy':
-----------------------------------------------------------------------
ATTENTION! Your password for authentication realm:
<svn://127.0.0.1:3690> 3d0c32b1-3841-4518-b6b1-dcdb6c7ed716
can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details.
You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/home/zhangy/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? yes
A repos/test.php
Checked out revision 1.
checkout的時候會出現Store password unencrypted,解決辦法
vi /home/zhangy/.subversion/servers
找到以下內容,注釋去掉並改成yes就行了
# store-plaintext-passwords = no
b),add 和submit
[zhangy@BlackGhost repos]$ svn add aaa.php
A aaa.php
[zhangy@BlackGhost repos]$ svn commit aaa.php -m "ok"
Adding aaa.php
Transmitting file data .
Committed revision 2.
svn的操作有很多,在這兒就不多說了。