우분투 서브버전 서버 설치 및 설정 (svn)

(우분투 서브버전 설치에서 넘어옴)
  다른 뜻에 대해서는 우분투 서브버전 서버 설치 및 설정 (http) 문서를 참조하십시오.

1 개요[ | ]

우분투 서브버전 서버 설치 및 설정 (svn)
  • svn 프로토콜 사용

2 설치[ | ]

root@zetawiki:~# apt-get install subversion
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libserf-1-1 libsvn1
Suggested packages:
  subversion-tools db5.3-util
The following NEW packages will be installed:
  libserf-1-1 libsvn1 subversion
0 upgraded, 3 newly installed, 0 to remove and 75 not upgraded.
Need to get 1,238 kB of archives.
After this operation, 4,701 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main libserf-1-1 amd64 1.3.3-1ubuntu0.1 [42.2 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main libsvn1 amd64 1.8.8-1ubuntu3.2 [916 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main subversion amd64 1.8.8-1ubuntu3.2 [280 kB]
Fetched 1,238 kB in 2s (517 kB/s)
Selecting previously unselected package libserf-1-1:amd64.
... (생략)
Setting up libsvn1:amd64 (1.8.8-1ubuntu3.2) ...
Setting up subversion (1.8.8-1ubuntu3.2) ...
Processing triggers for libc-bin (2.19-0ubuntu6.7) ...

3 저장소 설정[ | ]

  • 저장소 폴더의 부모 폴더가 되는 /home/svn 폴더 생성
  • hello 프로젝트를 담을 hello 저장소 생성
root@zetawiki:~# mkdir /home/svn
root@zetawiki:~# svnadmin create /home/svn/hello
root@zetawiki:~#

4 계정 설정[ | ]

  • 자체 계정 사용 설정
root@zetawiki:~# cd /home/svn/hello/conf/
root@zetawiki:/home/svn/hello/conf# vi svnserve.conf
[general]
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz
  • 사용자/패스워드 설정
root@zetawiki:/home/svn/hello/conf# vi passwd
[users]
svnuser1 = P@ssw0rd
  • 사용자의 폴더 권한 설정
root@zetawiki:/home/svn/hello/conf# vi authz
[/]
svnuser1 = rw
→ svnuser1에게 읽기/쓰기(rw) 권한을 줌

5 서비스 등록[ | ]

  • 서비스용 svnserve.conf 작성[1]
root@zetawiki:/home/svn/hello/conf# cd
root@zetawiki:~# vi /etc/init/svnserve.conf
description "Subversion server"
start on (local-filesystems and net-device-up IFACE=lo and started udev-finish)
stop on runlevel [06]
chdir /home/svn
respawn
respawn limit 2 3600
exec /usr/bin/svnserve --foreground --daemon --config-file /home/svn/hello/conf/svnserve.conf --root /home/svn/

6 서비스 시작[ | ]

root@zetawiki:~# initctl start svnserve
svnserve start/running, process 25491
root@zetawiki:~# ps -ef | grep svnserve | grep -v grep
root     25491     1  0 21:04 ?        00:00:00 /usr/bin/svnserve --foreground --daemon --config-file /home/svn/hello/conf/svnserve.conf --root /home/svn/
root@zetawiki:~# netstat -tnlp | grep svnserve
tcp        0      0 0.0.0.0:3690            0.0.0.0:*               LISTEN      25491/svnserve
→ svn 프로토콜 기본포트인 3690으로 서비스됨

7 (Optional) 테스트[ | ]

  • 여기서는 테스트용으로 간단히 작성해봄
( 기존 프로젝트가 있다면 svn import하는 것이 바람직함 )
root@zetawiki:~# svn co svn://localhost/hello --username svnuser1
Authentication realm: <svn://localhost:3690> 171f64ab-52ea-4980-a67e-67b31af82b5d
Password for 'svnuser1': ********


-----------------------------------------------------------------------
ATTENTION!  Your password for authentication realm:

   <svn://localhost:3690> 171f64ab-52ea-4980-a67e-67b31af82b5d

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)? yes
Checked out revision 0.
root@zetawiki:~# cd hello/
root@zetawiki:~/hello# svn info
Path: .
Working Copy Root Path: /root/hello
URL: svn://localhost/hello
Relative URL: ^/
Repository Root: svn://localhost/hello
Repository UUID: 171f64ab-52ea-4980-a67e-67b31af82b5d
Revision: 0
Node Kind: directory
Schedule: normal
Last Changed Rev: 0
Last Changed Date: 2016-04-24 23:32:06 +0900 (Sun, 24 Apr 2016)
root@zetawiki:~/hello# ll
total 12
drwxr-xr-x  3 root root 4096 Apr 25 00:43 ./
drwx------ 30 root root 4096 Apr 25 00:43 ../
drwxr-xr-x  4 root root 4096 Apr 25 00:43 .svn/
root@zetawiki:~/hello# echo hello > greet.txt
root@zetawiki:~/hello# svn status
?       greet.txt
root@zetawiki:~/hello# svn add greet.txt
A         greet.txt
root@zetawiki:~/hello# svn commit -m 'first'
Adding         greet.txt
Transmitting file data .
Committed revision 1.

8 같이 보기[ | ]

9 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}