[CentOs] 서브버젼 설치

2010. 10. 25. 00:46OS/CentOS

개발을 하면서 버전관리 프로그램은 필수 프로그램 중 하나입니다.
저는 서버에 직접적으로 작업을 하기 때문에 가끔씩 파일이 롤백된다던지 예전 삭제된 자료가 없어 고생한 적이 많습니다. ㅡㅜ

그래서 Subversion(이하 SVN)을 사용하고 있습니다.
SVN을 기준으로 업데이트하고 서버에 업로드하는 형식으로 내가 언제 어떤 부분을 수정을 했는지에 대한 모든 소스의 로그가 남고 간단히 예전 버전으로 롤백도 가능하기 때문에 사용하시면 많이 편리한 점이 많습니다.

여러명이서 작업을 하게 되는 프로젝트에서도 중복되지 않기 위해서 파트를 나누어 작업은 하겠지만, 공통파일들은 항상 있기 마련입니다. 이때도 내가 작업하는 파일에 대하여 Lock를 걸어 두어 다른 사람이 업데이트 하는 것을 방지할 수도 있습니다.

그럼 CentOS에서 SVN을 설치하는 방법에 대해서 알아보겠습니다.
CentOS의 유일한 무기 yum을 이용하여 설치를 하게 됩니다.

 # yum install subversion

그리고 SVN의 데이터를 저장할 디렉토리를 생성합니다.

 # mkdir /home/svn

그러면 SVN에 하나의 repository를 생성하겠습니다.

 # cd /home/svn
 # svnadmin create repo-tasks

자, 그러면 생성한 repository는 /home/svn 디렉토리안에 repo-tasks라는 디렉토리가 생성된 것을 볼 수 있습니다.

이제 설정 부분을 확인하도록 하겠습니다.

/home/svn/repo-tasks/conf 디렉토리 안에는 설정파일들이 존재합니다.

1. svnserve.conf 수정

 # vi /home/svn/repo-tasks/conf/svnserve.conf

내용을 보시면 노란색 부분을 아래와 같이 수정합니다.

 ### This file controls the configuration of the svnserve daemon, if you
 ### use it to allow access to this repository.  (If you only allow
 ### access through http: and/or file: URLs, then this file is
 ### irrelevant.)
 
 ### Visit http://subversion.tigris.org/ for more information.
 
 [general]
 ### These options control access to the repository for unauthenticated
 ### and authenticated users.  Valid values are "write", "read",
 ### and "none".  The sample settings below are the defaults.
 anon-access = none
 auth-access = write
 ### The password-db option controls the location of the password
 ### database file.  Unless you specify a path starting with a /,
 ### the file's location is relative to the conf directory.
 ### Uncomment the line below to use the default password file.
 password-db = passwd
 ### The authz-db option controls the location of the authorization
 ### rules for path-based access control.  Unless you specify a path
 ### starting with a /, the file's location is relative to the conf
 ### directory.  If you don't specify an authz-db, no path-based access
 ### control is done.
 ### Uncomment the line below to use the default authorization file.
 #authz-db = authz
 ### This option specifies the authentication realm of the repository.
 ### If two repositories have the same authentication realm, they should
 ### have the same password database, and vice versa.  The default realm
 ### is repository's uuid.
 realm = Tasks Repository

anon-access = none          -> 앞의 #(주석)을 제거합니다.
auth-access = write           -> 앞의 #(주석)을 제거합니다.
password-db = passwd     -> 앞의 #(주석)을 제거합니다.
realm = Tasks Repository   -> Repository 명을 입력합니다.

2. passwd 수정

  # vi /home/svn/repo-tasks/conf/passwd

노란색 부분과 같이 사용자를 추가합니다.

 ### This file is an example password file for svnserve.
 ### Its format is similar to that of svnserve.conf. As shown in the
 ### example below it contains one section labelled [users].
 ### The name and password for each user follow, one account per line.
 
 [users]
 # harry = harryssecret
 # sally = sallyssecret
 svnuser = svnpass

접속하려는 사용자를 ID = PASS 로 추가하시면 됩니다.

그럼 SVN 데몬을 실행합니다. 그리고 SVN이 사용하고 있는 3690 포트를 iptable에서 열어 둡니다.

 # svnserve -d -r /home/svn/
 #  vi /etc/sysconfig/iptables

iptable 파일 내에 아래와 같은 부분을 추가합니다.

 -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3690 -j ACCEPT

그리고 저장 후 나와서 iptable를 재 시동합니다.

 # /etc/init.d/iptables restart

자 이로서 SVN의 설치가 완료되었습니다.