1、yum install subversion
sudo yum install subversion
This will check for any dependencies and then prompt you to install those and subversion itself. Type in "y" and <enter> to install these.
Unfortunately it doesn't set up anything else after installing the necessary files, so you need to add a subversion user and set up the repositories etc yourself. If we decide to call the subversion user "svn" then you add them like so:
sudo /usr/sbin/useradd svn
sudo passwd svn
And then change to the subversion user like so:
su svn
Change to the svn user's directory and then create a "repositories" directory like so:
cd
mkdir repositories
And now create your project's repository. For example, if we had a project called "myproject" you would do this:
cd repositories
svnadmin create myproject
There will now be a "myproject" directory containing the following:
-rw-rw-r-- 1 svn svn 229 Nov 21 16:58 README.txt
drwxrwxr-x 2 svn svn 1024 Nov 21 16:58 conf
drwxrwsr-x 6 svn svn 1024 Nov 21 16:58 db
-r--r--r-- 1 svn svn 2 Nov 21 16:58 format
drwxrwxr-x 2 svn svn 1024 Nov 21 16:58 hooks
drwxrwxr-x 2 svn svn 1024 Nov 21 16:58 locks
You need to edit "myproject/conf/svnserve.conf" and uncomment the following lines:
auth-access = write
password-db = passwd
and edit the password file "myproject/conf/passwd" adding a new user and password. Note that the password is stored in plain text. In the following example we have a user called "john" whose password is "foobar123":
[users]
john = foobar123
And finally, as the svn user, start the subversion daemon like so:
svnserve -d -r /home/svn/repositories
You can now connect to the subversion repository at e.g. svn://svn@hostname/myproject
You can add additional repositories under this user using the "svnadmin create" command and then access them at svn://[userame]@[hostname]/[project name]
[general]
anon-access = none
auth-access = write
password-db = passwd
其中所有的行都要顶格写。第一行是一个开头,第二行设置没有权限的用户权限,个人建议设置为 none,否则别人只要知道你的svn版本库就可以直接co出来;第三行是设定有权限用户的权限,当然是write,可以向版本库中写了;第四行设定了密 码文件的位置,一般默认为当前目录下passwd文件
然后打开authz文件,将 文件内容修改为
[groups]
应该是设定群组成员的吧?没有用过,因为只是本地建立一个svn版本库用一下
最后修改passwd文件
这 个文件设定了所有授权用户的用户名和密码
该文件以[users]为开头,下面每一 行等号前面是用户名,后面是密码,所有都要顶格写
svnserve.conf
passwd
authz
[/]
jason = rw
Hooks脚本 自动提交
cp post-commit.tmpl post-commit
#!/bin/shsvn update --username svnuser --password svnpass /var/www/proj/
svn checkout
svn co svn://192.168.1.105/svn/svndata/repos/ /data0/htdocs
浙公网安备 33010602011771号