Home » Ubuntu » Build SVN server under Ubuntu

Build SVN server under Ubuntu

Preface
What is the

SVN? Although we use every day, but few people know what it is. With version control tools, can also be said to be a backup server, details of every code change, and prevent the team between code is not the case in the.Ubuntu installation is relatively simple, next we start installing.


Start the installation
1, install package
wenjie@rain:~$sudo apt-get install subversion

2, we need to create a directory stored in the warehouse
wenjie@rain:/home$sudo MKDIR svn

3, create a SVN folder warehouse
wenjie@rain:/home$CD svn/
Wenjie@rain:/home/svn$sudo MKDIR project_v1

4, create a version of the warehouse
wenjie@rain:/home/svn$CD project_v1/
Wenjie@rain:/home/svn/project_v1$sudo svnadmin create /home/svn/project_v1/

5, we look at the project_v1 file structure
wenjie@rain:/home/svn/project_v1$ll
Total 32
Drwxr-xr-x 6 root root 4096 Feb 23 15:41.
Drwxr-xr-x 3 root 4096 Feb 23 15:41 / root
Drwxr-xr-x 2 root root 4096 Feb 23 15:41 conf/
Drwxr-sr-x 6 root root 4096 Feb 23 15:41 db/
-r--r--r-- 1 root root 2 Feb 23 15:41 format
Drwxr-xr-x 2 root root 4096 Feb 23 15:41 hooks/
Drwxr-xr-x 2 root root 4096 Feb 23 15:41 locks/
-rw-r--r-- 1 root root 246 Feb 23 15:41 README.txt

6, we need to change the three files in the conf directory
wenjie@rain:/home/svn/project_v1$CD conf/
Wenjie@rain:/home/svn/project_v1/conf$ll
Total 24
Drwxr-xr-x 2 root root 4096 Feb 23 15:41.
Drwxr-xr-x 6 root 4096 Feb 23 15:41 / root
-rw-r--r-- 1 root root 1080 Feb 23 15:41 authz
-rw-r--r-- 1 root root 885 Feb 23 15:41 hooks-env.tmpl
-rw-r--r-- 1 root root 309 Feb 23 15:41 passwd
-rw-r--r-- 1 root root 4002 Feb 23 15:41 svnserve.conf

Authz: used to set user permissions
Passwd: used to store user and password settings
Svnserve.conf: the main configuration file
7, configure the main configuration file
wenjie@rain:/home/svn/project_v1/conf$sudo VI svnserve.conf

the following attributes in front of the # removed, note: there can be no space in front of.


Anon-access = read: anonymous access, the default read, none is not allowed to access
Auth-access = write: user authentication
Password-db = passwd: user information is stored in the following file, the default version of /conf library, can also specify absolute path of the file location
Authz-db = authz: file permissions information storage.
8, set the user name and password
wenjie@rain:/home/svn/project_v1/conf$sudo VI passwd

Format:

= username password, the plaintext password.


[users]
Zhangsan=123
Lisi=456
Wangwu=789

9, set the user permissions
wenjie@rain:/home/svn/project_v1/conf$sudo VI authz

user can set the user group or individual user settings.


[groups]
Raiing=zhangsan, Wangwu
[/]
@raiing=r
Lisi=rw
*=

Key points: groups can set the following user group, convenient setting management permissions for multiple users, and set the user group to add.
Point two: of course alone for a single user to set permissions, such as Lisi in the above example
Three points: * = representative is other users prohibited operating means.
10, start the SVN server
Next we open the SVN server


wenjie@rain:/home/svn/project_v1/conf$sudo svnserve -d -r /home/svn/

-d: in order to protect mode
-r: the development of SVN version of the root directory that is convenient for the client can access the repository
to enter the full path
For example: svn://127.0.0.1/project_v1

check whether the SVN start


wenjie@rain:/home/svn/project_v1/conf$sudo netstat -antp |grep svnserve
TCP 00 0.0.0.0:3690 0.0.0.0:* LISTEN 3785/svnserve

if you want to close the service, you can use the pkill svnserve

Latest