首页 > 代码库 > svn installation
svn installation
# yum install mod_dav_svn.x86_64 subversion-svn2cl.noarch
===========================================================================================================================================================================
svnserve.conf:12: Option expected
为什么会出现这个错误呢,就是因为subversion读取配置文件svnserve.conf时,无法识别有前置空格的配置文件,issue存在前置空格
svn: Invalid authz configuration
是authz文件的问题 你看是不是添加user的时候导致空格或换行不对
format‘: Permission denied
是由于缺少执行 # chcon -R -h -t httpd_sys_content_t /svn
===========================================================================================================================================================================
SVN Without apache
===========================================================================================================================================================================
# cd /
# mkdir svn
# svnadmin create svn1
# cat /svn/svn1/conf/svnserve.conf | grep -v ‘^#‘ |grep -v ‘^$‘
[general]
anon-access = read
auth-access = write
password-db = /svn/svn1/conf/passwd
realm = Eric First Repository
# cat /svn/svn1/conf/authz | grep -v ‘^#‘ |grep -v ‘^$‘
[aliases]
[groups]
admin = eric
[test:/svn/svn1]
@admin = rw
# cat /svn/svn1/conf/passwd | grep -v ‘^#‘ |grep -v ‘^$‘
[users]
eric = eric
# svnserve -r /svn/svn1/ -d
# netstat -an |grep 3690
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN
# mkdir project123
# svn import project123 svn://localhost/ -m "initial import"
Authentication realm: <svn://localhost:3690> Eric First Repository
Password for ‘eric‘:
-----------------------------------------------------------------------
ATTENTION! Your password for authentication realm:
<svn://localhost:3690> Eric First Repository
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
‘/root/.subversion/servers‘.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no
# mkdir -p /root/testsvn
# cd /root/testsvn
# svn co svn://localhost/
Checked out revision 0.
# cd localhost/
# touch abc
# svn add abc
# svn ci -m "add abc"
Authentication realm: <svn://localhost:3690> Eric First Repository
Password for ‘eric‘:
Adding abc
Transmitting file data .
Committed revision 1.
# mkdir -p /root/abcd
# svn co svn://localhost
A localhost/abc
Checked out revision 1.
# mkdir testdir
# svn add testdir/
A testdir
# svn ci -m "add dir"
Authentication realm: <svn://localhost:3690> Eric First Repository
Password for ‘eric‘:
Adding testdir
Committed revision 2.
# svn info
Path: .
URL: svn://localhost
Repository Root: svn://localhost
Repository UUID: 6de30579-f38c-4a96-8970-da2307fefe79
Revision: 1
Node Kind: directory
Schedule: normal
Last Changed Author: eric
Last Changed Rev: 1
Last Changed Date: 2012-08-27 16:24:38 +0800 (Mon, 27 Aug 2012)
# svn remove abc
D abc
[root@CentOS1 localhost]# svn ci -m "remove abc"
Authentication realm: <svn://localhost:3690> Eric First Repository
Password for ‘eric‘:
Deleting abc
Committed revision 5.
===========================================================================================================================================================================
SVN Merge
===========================================================================================================================================================================
# cd testdir/
# mkdir dir1 dir2 dir3
# svn add dir*
# svn ci -m "add dirs"
# cd dir1/
# touch file1
# svn add file1
# cd ../dir2/
# touch file2
# svn add file2
# cd ..
# svn ci -m "add files"
# svn cp dir1/ dir2/
A dir2/dir1
# svn ci -m "dev dir1 inside dir2"
Adding testdir/dir2/dir1
Adding testdir/dir2/dir1/file1
Committed revision 8.
# cd testdir/
# cd dir2/dir1/
touch file4 file5 file6
# svn add file4 file5 file6
# cd testdir/dir1/
# touch file8 file7 file9
# svn add file7 file8 file9
# cd testdir/
# svn ci -m "dev tog"
Adding testdir/dir1/file7
Adding testdir/dir1/file8
Adding testdir/dir1/file9
Adding testdir/dir2/dir1/file4
Adding testdir/dir2/dir1/file5
Adding testdir/dir2/dir1/file6
Transmitting file data ......
Committed revision 9.
# cd testdir/dir2/dir1
# ls -l
total 0
-rw-r--r--. 1 root root 0 Aug 27 17:51 file4
-rw-r--r--. 1 root root 0 Aug 27 17:51 file5
-rw-r--r--. 1 root root 0 Aug 27 17:51 file6
# cd testdir/dir1
# ls -l
total 0
-rw-r--r--. 1 root root 0 Aug 27 17:21 file1
-rw-r--r--. 1 root root 0 Aug 27 17:32 file7
-rw-r--r--. 1 root root 0 Aug 27 17:32 file8
-rw-r--r--. 1 root root 0 Aug 27 17:32 file9
# cd testdir/dir1/
# svn merge svn://localhost/testdir/dir2/dir1@8 svn://localhost/testdir/dir2/dir1
--- Merging r9 into ‘.‘:
A file4
A file5
A file6
# svn update
At revision 9.
# svn ci -m "merge dir1"
Sending dir1
Adding dir1/file4
Adding dir1/file5
Adding dir1/file6
Committed revision 10.
# cd testdir/dir1
# ls -l
total 0
-rw-r--r--. 1 root root 0 Aug 27 17:21 file1
-rw-r--r--. 1 root root 0 Aug 27 17:51 file4
-rw-r--r--. 1 root root 0 Aug 27 17:51 file5
-rw-r--r--. 1 root root 0 Aug 27 17:51 file6
-rw-r--r--. 1 root root 0 Aug 27 17:32 file7
-rw-r--r--. 1 root root 0 Aug 27 17:32 file8
-rw-r--r--. 1 root root 0 Aug 27 17:32 file9
===========================================================================================================================================================================
SVN With apache
===========================================================================================================================================================================
# cat /etc/httpd/conf.d/subversion.conf |grep -v "^#" |grep -v "^$"
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /svn>
DAV svn
SVNParentPath /svn
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /etc/svn-auth-users
Require valid-user
</Location>
# cd /
# chown -R apache.apache svn/
# chcon -R -h -t httpd_sys_content_t /svn
# htpasswd -c /etc/svn-auth-users testuser
New password:
Re-type new password:
Adding password for user testuser
# cat /etc/svn-auth-users
testuser:kEsviSFVV4iY
# htpasswd -m /etc/svn-auth-users testuser2
New password:
Re-type new password:
Adding password for user testuser2
# cat /etc/svn-auth-users
testuser:kEsviSFVV4iYk
testuser2:$apr1$0kk6lLgU$Vpk/ruvwf47t4Z/2PSMo20
# /etc/init.d/httpd start
Web login http://10.3.53.107/svn/svn1/ with username and password