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

1 개요[ | ]

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

2 사전작업[ | ]

3 설치[ | ]

root@zetawiki:~# apt install subversion apache2 libapache2-svn
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  apache2-bin apache2-data libapache2-mod-svn
Suggested packages:
  apache2-doc apache2-suexec-pristine apache2-suexec-custom apache2-utils
  db5.3-util subversion-tools
The following NEW packages will be installed:
  libapache2-mod-svn libapache2-svn subversion
The following packages will be upgraded:
  apache2 apache2-bin apache2-data
3 upgraded, 3 newly installed, 0 to remove and 174 not upgraded.
Need to get 1,176 kB/1,455 kB of archives.
After this operation, 2,015 kB of additional disk space will be used.
Do you want to continue? [Y/n]
... (생략)
Setting up apache2 (2.4.7-1ubuntu4.9) ...
 * Restarting web server apache2                                                    [ OK ] 
Setting up libapache2-mod-svn (1.8.8-1ubuntu3.2) ...
apache2_invoke: Enable module authz_svn
 * Restarting web server apache2                                                    [ OK ] 
apache2_invoke dav_svn: already enabled
 * Restarting web server apache2                                                    [ OK ] 
Setting up subversion (1.8.8-1ubuntu3.2) ...
Setting up libapache2-svn (1.8.8-1ubuntu3.2) ...

4 저장소 설정[ | ]

  • 저장소 폴더의 부모 폴더가 되는 /repos 폴더 생성
  • hello 프로젝트를 담을 hello 저장소 생성
  • 아파치가 접근가능하도록 소유자를 www-data로 변경
root@zetawiki:~# mkdir /repos
root@zetawiki:~# svnadmin create /repos/hello
root@zetawiki:~# chown -R www-data:www-data /repos
root@zetawiki:~#

5 아파치 설정[ | ]

  • 아파치 설정파일 000-default.conf를 수정
  • <VirtualHost *:80>, </VirtualHost> 태그 사이에 /svn 설정
root@zetawiki:~# vi /etc/apache2/sites-enabled/000-default.conf
 <Location /svn>
  DAV svn
  SVNParentPath /repos
  AuthType Basic
  AuthName "My repositories"
  AuthUserFile /etc/subversion/passwd
  Require valid-user
 </Location>
  • 아파치 리로드
root@zetawiki:~# /etc/init.d/apache2 reload
 * Reloading web server apache2                                                             *
root@zetawiki:~# curl -I http://localhost/svn/hello
HTTP/1.1 401 Unauthorized
Date: Sun, 24 Apr 2016 13:28:54 GMT
Server: Apache
WWW-Authenticate: Basic realm="My repositories"
Content-Type: text/html; charset=iso-8859-1
→ 권한은 없지만, 설정한 "My repositories"는 확인 가능

6 사용자 생성[ | ]

root@zetawiki:~# htpasswd -c /etc/subversion/passwd svnuser1
New password: P@ssw0rd
Re-type new password: P@ssw0rd
Adding password for user svnuser1

7 (Optional) 테스트[ | ]

  • 여기서는 테스트용으로 간단히 작성해봄
( 기존 프로젝트가 있다면 svn import하는 것이 바람직함 )
root@zetawiki:~# svn co http://localhost/svn/hello
Authentication realm: <http://localhost:80> My repositories
Password for 'svnuser1': ********


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

   <http://localhost:80> My repositories

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: http://localhost/svn/hello
Relative URL: ^/
Repository Root: http://localhost/svn/hello
Repository UUID: 7e0c2d53-8bc5-40ba-b572-d31d4d4ba890
Revision: 0
Node Kind: directory
Schedule: normal
Last Changed Rev: 0
Last Changed Date: 2016-04-24 23:00:58 +0900 (Sun, 24 Apr 2016)
root@zetawiki:~/hello# ll
total 12
drwxr-xr-x  3 root root 4096 Apr 24 23:02 ./
drwx------ 29 root root 4096 Apr 24 23:02 ../
drwxr-xr-x  4 root root 4096 Apr 24 23:02 .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 }}