"CentOS 서브버전 서버 설치 및 설정 (svn)"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-<source +<syntaxhighlight , -</source> +</syntaxhighlight>))
 
(사용자 3명의 중간 판 10개는 보이지 않습니다)
1번째 줄: 1번째 줄:
{{테스트|CentOS 6.3}}
{{다른뜻|우분투 서브버전 설치}}
{{테스트|CentOS 6}}
==개요==
==개요==
;서브버전 설치 및 설정하기
;서브버전 설치 및 설정하기
*이 문서에서는 저장소(repository)의 상위 디렉토리를 /svn으로 한 예이다.
;CentOS 서브버전 설치
*해당 디렉토리 아래에 저장소(디렉토리)를 여러 개 둘 수 있다(예: repo1, repo2...).
;CentOS SVN 설치
*리눅스 subversion 패키지는 서버 + 클라이언트
*이 문서에서는 저장소(repository)의 상위 디렉토리를 /repos으로 한 예이다.
*해당 디렉토리 아래에 저장소(디렉토리)를 여러 개 둘 수 있다(예: proejct1, project2...).


==사전 작업==
==설치 확인==
*[[CentOS 서브버전 설치]]
{{참고|SVN 설치 확인}}
<syntaxhighlight lang='console'>
[root@zetawiki ~]# svn
-bash: svn: command not found
</syntaxhighlight>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# rpm -qa | grep subversion
[root@zetawiki ~]# yum list subversion
... (생략)
Available Packages
subversion.i686                              1.6.11-10.el6_5                            base
subversion.x86_64                            1.6.11-10.el6_5                            base
</syntaxhighlight>
:→ 설치되어 있지 않으며, yum을 통해 설치가능하다.
 
==설치==
<syntaxhighlight lang='console'>
[root@zetawiki ~]# yum install subversion
... (생략)
=============================================================================================
Package              Arch              Version                      Repository      Size
=============================================================================================
Installing:
subversion            x86_64            1.6.11-10.el6_5              base            2.3 M
Installing for dependencies:
neon                  x86_64            0.29.3-3.el6_4                base            119 k
pakchois              x86_64            0.4-3.2.el6                  base            21 k
 
Transaction Summary
=============================================================================================
Install      3 Package(s)
 
Total download size: 2.4 M
Installed size: 12 M
Is this ok [y/N]: y
</syntaxhighlight>
<syntaxhighlight lang='console'>
... (생략)
Installed:
  subversion.x86_64 0:1.6.11-10.el6_5                                                       
 
Dependency Installed:
  neon.x86_64 0:0.29.3-3.el6_4                pakchois.x86_64 0:0.4-3.2.el6               
 
Complete!
</syntaxhighlight>


==저장소 생성==
==저장소 생성==
서버 1대에 저장소를 여러 개 생성할 수 있다. 저장소 폴더들이 /svn 아래에 있도록 설정할 것이다.
서버 1대에 저장소를 여러 개 생성할 수 있다. 프로젝트 저장소 폴더들이 /repos 아래에 있도록 설정할 것이다.


;명령어
;명령어
<source lang='bash'>
<syntaxhighlight lang='bash'>
mkdir /svn
mkdir /repos
cd /svn
cd /repos
svnadmin create --fs-type fsfs 저장소명
svnadmin create --fs-type fsfs 저장소명
ll
ll
</source>
</syntaxhighlight>


;실행 예시
;실행 예시
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# mkdir /svn
[root@zetawiki ~]# mkdir /repos
[root@zetawiki ~]# cd /svn
[root@zetawiki ~]# cd /repos
[root@zetawiki svn]# svnadmin create --fs-type fsfs repo1
[root@zetawiki repos]# svnadmin create --fs-type fsfs project1
[root@zetawiki svn]# ll
[root@zetawiki repos]# ll
total 4
total 4
drwxr-xr-x. 6 root root 4096 Jun  1 09:27 repo1
drwxr-xr-x. 6 root root 4096 Jun  1 09:27 project1
</source>
</syntaxhighlight>


*여러 프로젝트를 담기 위해 반드시 저장소를 여러 개 만들 필요는 없다. 저장소 폴더 아래에 다시 프로젝트별 폴더들을 만들어 관리하면 되기 때문이다.
*여러 프로젝트를 담기 위해 반드시 저장소를 여러 개 만들 필요는 없다. 저장소 폴더 아래에 다시 프로젝트별 폴더들을 만들어 관리하면 되기 때문이다.
37번째 줄: 86번째 줄:


;명령어
;명령어
<source lang='bash'>
<syntaxhighlight lang='bash'>
echo 'OPTIONS="--threads --root 저장소최상위폴더"' > /etc/sysconfig/svnserve
echo 'OPTIONS="--threads --root 저장소최상위폴더"' > /etc/sysconfig/svnserve
cat /etc/sysconfig/svnserve
cat /etc/sysconfig/svnserve
</source>
</syntaxhighlight>


;실행예시
;실행예시
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# echo 'OPTIONS="--threads --root /svn"' > /etc/sysconfig/svnserve
[root@zetawiki ~]# echo 'OPTIONS="--threads --root /repos"' > /etc/sysconfig/svnserve
[root@zetawiki ~]# cat /etc/sysconfig/svnserve
[root@zetawiki ~]# cat /etc/sysconfig/svnserve
OPTIONS="--threads --root /svn"
OPTIONS="--threads --root /repos"
</source>
</syntaxhighlight>


==svnserve.conf 수정==
==svnserve.conf 수정==
54번째 줄: 103번째 줄:


;명령어
;명령어
<source lang='bash'>
<syntaxhighlight lang='bash'>
cd /svn/repo1/conf/
cd /repos/project1/conf/
cat svnserve.conf
cat svnserve.conf
mv svnserve.conf svnserve.conf.old
mv svnserve.conf svnserve.conf.old
64번째 줄: 113번째 줄:
echo 'authz-db = authz' >> svnserve.conf
echo 'authz-db = authz' >> svnserve.conf
cat svnserve.conf
cat svnserve.conf
</source>
</syntaxhighlight>


;실행예시
;실행예시
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# cd /svn/repo1/conf/
[root@zetawiki ~]# cd /repos/project1/conf/
[root@zetawiki conf]# cat svnserve.conf
[root@zetawiki conf]# cat svnserve.conf
### This file controls the configuration of the svnserve daemon, if you
### This file controls the configuration of the svnserve daemon, if you
75번째 줄: 124번째 줄:
### irrelevant.)
### irrelevant.)
... (생략)
... (생략)
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki conf]# mv svnserve.conf svnserve.conf.old
[root@zetawiki conf]# mv svnserve.conf svnserve.conf.old
[root@zetawiki conf]# echo '[general]' > svnserve.conf
[root@zetawiki conf]# echo '[general]' > svnserve.conf
89번째 줄: 138번째 줄:
password-db = passwd
password-db = passwd
authz-db = authz
authz-db = authz
</source>
</syntaxhighlight>
:→ 비로그인 접속자는 권한 없음, 로그인하면 쓸 수 있음, passwd와 authz 파일을 사용함.
:→ 비로그인 접속자는 권한 없음, 로그인하면 쓸 수 있음, passwd와 authz 파일을 사용함.


==계정 설정==
==계정 설정==
{{참고|/svn/repo1/conf/passwd}}
{{참고|/repos/project1/conf/passwd}}
*svn는 OS계정이 아니라 자체 계정을 사용한다.
*svn는 OS계정이 아니라 자체 계정을 사용한다.
*해당 저장소의 conf 디렉토리에 있는 passwd를 편집하여 계정을 등록한다.
*해당 저장소의 conf 디렉토리에 있는 passwd를 편집하여 계정을 등록한다.
*패스워드 분실시에도 이 파일을 열어보면 된다.
*패스워드 분실시에도 이 파일을 열어보면 된다.
*passwd 파일을 passwd.old 로 이름을 변경하여 보존해두고 새로 작성한다.
*passwd 파일을 passwd.old 로 이름을 변경하여 보존해두고 새로 작성한다.
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki conf]# mv passwd passwd.old
[root@zetawiki conf]# mv passwd passwd.old
[root@zetawiki conf]# vi passwd
[root@zetawiki conf]# vi passwd
</source>
</syntaxhighlight>
<source lang='aconf'>
<syntaxhighlight lang='aconf'>
[users]
[users]
testuser1 = P@ssw0rd
testuser1 = P@ssw0rd
testuser2 = P@ssw0rd
testuser2 = P@ssw0rd
</source>
</syntaxhighlight>


==(optional) 권한 없음 오류시==
==(optional) 권한 없음 오류시==
*권한이 없다는 오류가 날 경우 [[/svn/repo1/conf/authz]] 파일 마지막에 계정의 권한 추가
*권한이 없다는 오류가 날 경우 [[/repos/project1/conf/authz]] 파일 마지막에 계정의 권한 추가
<source lang='aconf'>
<syntaxhighlight lang='aconf'>
[/]
[/]
testuser1 = rw
testuser1 = rw
testuser2 = rw
testuser2 = rw
</source>
</syntaxhighlight>


==서비스 시작==
==서비스 시작==
120번째 줄: 169번째 줄:
/etc/sysconfig/svnserve 파일을 설정해두었기 때문에 service로 시작/중지를 할 수 있다.
/etc/sysconfig/svnserve 파일을 설정해두었기 때문에 service로 시작/중지를 할 수 있다.


<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki svn]# service svnserve start
[root@zetawiki repos]# service svnserve start
Starting svnserve:                                        [  OK  ]
Starting svnserve:                                        [  OK  ]
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki svn]# ps -ef | grep svnserve | grep -v grep
[root@zetawiki repos]# ps -ef | grep svnserve | grep -v grep
root      2581    1  0 11:12 ?        00:00:00 /usr/bin/svnserve --daemon --pid-file=/var/run/svnserve.pid --threads --root /svn
root      2581    1  0 11:12 ?        00:00:00 /usr/bin/svnserve --daemon --pid-file=/var/run/svnserve.pid --threads --root /repos
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki svn]# netstat -anp | grep svnserve
[root@zetawiki repos]# netstat -anp | grep svnserve
tcp        0      0 0.0.0.0:3690                0.0.0.0:*                  LISTEN      2581/svnserve   
tcp        0      0 0.0.0.0:3690                0.0.0.0:*                  LISTEN      2581/svnserve   
</source>
</syntaxhighlight>
:→ 기본 포트인 3690 포트로 서비스 중. (다른 포트로 변경하려면 [[/etc/sysconfig/svnserve]]를 수정해야 한다.)
:→ 기본 포트인 3690 포트로 서비스 중. (다른 포트로 변경하려면 [[/etc/sysconfig/svnserve]]를 수정해야 한다.)


여기까지 되었다면 설정이 완료된 것이다. 다른 컴퓨터에서 SVN 클라이언트로 접속하면 된다.<ref>물론 방화벽 등 다른 문제가 없다는 가정 하에 그렇다.</ref>
여기까지 되었다면 설정이 완료된 것이다. 다른 컴퓨터에서 SVN 클라이언트로 접속하면 된다.<ref>물론 방화벽 등 다른 문제가 없다는 가정 하에 그렇다.</ref>
접속 URL은 svn://서버주소/repo1 이다.
접속 URL은 svn://서버주소/proejct1 이다.


==재부팅시 자동시작 설정==
==재부팅시 자동시작 설정==
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki svn]# chkconfig --list svnserve
[root@zetawiki repos]# chkconfig --list svnserve
svnserve      0:off 1:off 2:off 3:off 4:off 5:off 6:off
svnserve      0:off 1:off 2:off 3:off 4:off 5:off 6:off
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki svn]# chkconfig svnserve on
[root@zetawiki repos]# chkconfig svnserve on
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki svn]# chkconfig --list svnserve
[root@zetawiki repos]# chkconfig --list svnserve
svnserve      0:off 1:off 2:on 3:on 4:on 5:on 6:off
svnserve      0:off 1:off 2:on 3:on 4:on 5:on 6:off
</source>
</syntaxhighlight>
:→ 재부팅시에 svnserve 서비스가 자동으로 시작될 것이다.
:→ 재부팅시에 svnserve 서비스가 자동으로 시작될 것이다.


156번째 줄: 205번째 줄:


;명령어
;명령어
<source lang='bash'>
<syntaxhighlight lang='bash'>
service svnserve stop
service svnserve stop
rm -rf /svn/repo1
rm -rf /repos/project1
ll
ll
</source>
</syntaxhighlight>


;실행예시
;실행예시
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# service svnserve stop
[root@zetawiki ~]# service svnserve stop
Stopping svnserve:                                        [  OK  ]
Stopping svnserve:                                        [  OK  ]
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# rm -rf /svn/repo1
[root@zetawiki ~]# rm -rf /repos/project1
[root@zetawiki ~]# ll
[root@zetawiki ~]# ll
total 0
total 0
</source>
</syntaxhighlight>
:→ 깔끔하게 지워졌다
:→ 깔끔하게 지워졌다


==같이 보기==
==같이 보기==
*[[CentOS 서브버전 설치]]
*[[우분투 서브버전 서버 설치 및 설정 (svn)]]
*[[우분투 서브버전 서버 설정]]
*[[우분투 서브버전 서버 설치 및 설정 (http)]]
*[[/etc/init.d/svnserve]]
*[[/etc/init.d/svnserve]]


183번째 줄: 232번째 줄:


[[분류:서브버전]]
[[분류:서브버전]]
[[분류: yum 설치]]

2021년 9월 24일 (금) 23:17 기준 최신판

  다른 뜻에 대해서는 우분투 서브버전 설치 문서를 참조하십시오.

1 개요[ | ]

서브버전 설치 및 설정하기
CentOS 서브버전 설치
CentOS SVN 설치
  • 리눅스 subversion 패키지는 서버 + 클라이언트
  • 이 문서에서는 저장소(repository)의 상위 디렉토리를 /repos으로 한 예이다.
  • 해당 디렉토리 아래에 저장소(디렉토리)를 여러 개 둘 수 있다(예: proejct1, project2...).

2 설치 확인[ | ]

[root@zetawiki ~]# svn
-bash: svn: command not found
[root@zetawiki ~]# rpm -qa | grep subversion
[root@zetawiki ~]# yum list subversion
... (생략)
Available Packages
subversion.i686                              1.6.11-10.el6_5                             base
subversion.x86_64                            1.6.11-10.el6_5                             base
→ 설치되어 있지 않으며, yum을 통해 설치가능하다.

3 설치[ | ]

[root@zetawiki ~]# yum install subversion
... (생략)
=============================================================================================
 Package               Arch              Version                       Repository       Size
=============================================================================================
Installing:
 subversion            x86_64            1.6.11-10.el6_5               base            2.3 M
Installing for dependencies:
 neon                  x86_64            0.29.3-3.el6_4                base            119 k
 pakchois              x86_64            0.4-3.2.el6                   base             21 k

Transaction Summary
=============================================================================================
Install       3 Package(s)

Total download size: 2.4 M
Installed size: 12 M
Is this ok [y/N]: y
... (생략)
Installed:
  subversion.x86_64 0:1.6.11-10.el6_5                                                        

Dependency Installed:
  neon.x86_64 0:0.29.3-3.el6_4                 pakchois.x86_64 0:0.4-3.2.el6                

Complete!

4 저장소 생성[ | ]

서버 1대에 저장소를 여러 개 생성할 수 있다. 프로젝트 저장소 폴더들이 /repos 아래에 있도록 설정할 것이다.

명령어
mkdir /repos
cd /repos
svnadmin create --fs-type fsfs 저장소명
ll
실행 예시
[root@zetawiki ~]# mkdir /repos
[root@zetawiki ~]# cd /repos
[root@zetawiki repos]# svnadmin create --fs-type fsfs project1
[root@zetawiki repos]# ll
total 4
drwxr-xr-x. 6 root root 4096 Jun  1 09:27 project1
  • 여러 프로젝트를 담기 위해 반드시 저장소를 여러 개 만들 필요는 없다. 저장소 폴더 아래에 다시 프로젝트별 폴더들을 만들어 관리하면 되기 때문이다.
  • 그렇다면 언제 저장소를 여러 개 만들어야 할까? 하나의 저장소는 하나의 사용자 권한 설정을 가지고 있다. 그러므로 사용자들의 권한이 구분되어야 할 때 저장소를 여러 개 두는 것이 좋다.

5 /etc/sysconfig/svnserve 생성[ | ]

이 파일을 생성해주어야 service svnserve start/stop이 가능하다.[1]

명령어
echo 'OPTIONS="--threads --root 저장소최상위폴더"' > /etc/sysconfig/svnserve
cat /etc/sysconfig/svnserve
실행예시
[root@zetawiki ~]# echo 'OPTIONS="--threads --root /repos"' > /etc/sysconfig/svnserve
[root@zetawiki ~]# cat /etc/sysconfig/svnserve
OPTIONS="--threads --root /repos"

6 svnserve.conf 수정[ | ]

svnserve.conf 파일을 svnserve.conf.old 로 변경하여 보존해두고 새로 작성한다.

명령어
cd /repos/project1/conf/
cat svnserve.conf
mv svnserve.conf svnserve.conf.old
echo '[general]' > svnserve.conf
echo 'anon-access = none' >> svnserve.conf
echo 'auth-access = write' >> svnserve.conf
echo 'password-db = passwd' >> svnserve.conf
echo 'authz-db = authz' >> svnserve.conf
cat svnserve.conf
실행예시
[root@zetawiki ~]# cd /repos/project1/conf/
[root@zetawiki conf]# cat 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.)
... (생략)
[root@zetawiki conf]# mv svnserve.conf svnserve.conf.old
[root@zetawiki conf]# echo '[general]' > svnserve.conf
[root@zetawiki conf]# echo 'anon-access = none' >> svnserve.conf
[root@zetawiki conf]# echo 'auth-access = write' >> svnserve.conf
[root@zetawiki conf]# echo 'password-db = passwd' >> svnserve.conf
[root@zetawiki conf]# echo 'authz-db = authz' >> svnserve.conf
[root@zetawiki conf]# cat svnserve.conf
[general]
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz
→ 비로그인 접속자는 권한 없음, 로그인하면 쓸 수 있음, passwd와 authz 파일을 사용함.

7 계정 설정[ | ]

  • svn는 OS계정이 아니라 자체 계정을 사용한다.
  • 해당 저장소의 conf 디렉토리에 있는 passwd를 편집하여 계정을 등록한다.
  • 패스워드 분실시에도 이 파일을 열어보면 된다.
  • passwd 파일을 passwd.old 로 이름을 변경하여 보존해두고 새로 작성한다.
[root@zetawiki conf]# mv passwd passwd.old
[root@zetawiki conf]# vi passwd
[users]
testuser1 = P@ssw0rd
testuser2 = P@ssw0rd

8 (optional) 권한 없음 오류시[ | ]

[/]
testuser1 = rw
testuser2 = rw

9 서비스 시작[ | ]

/etc/sysconfig/svnserve 파일을 설정해두었기 때문에 service로 시작/중지를 할 수 있다.

[root@zetawiki repos]# service svnserve start
Starting svnserve:                                         [  OK  ]
[root@zetawiki repos]# ps -ef | grep svnserve | grep -v grep
root      2581     1  0 11:12 ?        00:00:00 /usr/bin/svnserve --daemon --pid-file=/var/run/svnserve.pid --threads --root /repos
[root@zetawiki repos]# netstat -anp | grep svnserve
tcp        0      0 0.0.0.0:3690                0.0.0.0:*                   LISTEN      2581/svnserve
→ 기본 포트인 3690 포트로 서비스 중. (다른 포트로 변경하려면 /etc/sysconfig/svnserve를 수정해야 한다.)

여기까지 되었다면 설정이 완료된 것이다. 다른 컴퓨터에서 SVN 클라이언트로 접속하면 된다.[2] 접속 URL은 svn://서버주소/proejct1 이다.

10 재부팅시 자동시작 설정[ | ]

[root@zetawiki repos]# chkconfig --list svnserve
svnserve       	0:off	1:off	2:off	3:off	4:off	5:off	6:off
[root@zetawiki repos]# chkconfig svnserve on
[root@zetawiki repos]# chkconfig --list svnserve
svnserve       	0:off	1:off	2:on	3:on	4:on	5:on	6:off
→ 재부팅시에 svnserve 서비스가 자동으로 시작될 것이다.

11 (저장소 삭제)[ | ]

주의! 저장소를 삭제하고 싶을 때만 이 문단을 참고하시라. 만들 때는 svnadmin으로 하였지만, 지울 때는 그냥 저장소 폴더를 지우면 된다.

명령어
service svnserve stop
rm -rf /repos/project1
ll
실행예시
[root@zetawiki ~]# service svnserve stop
Stopping svnserve:                                         [  OK  ]
[root@zetawiki ~]# rm -rf /repos/project1
[root@zetawiki ~]# ll
total 0
→ 깔끔하게 지워졌다

12 같이 보기[ | ]

13 주석[ | ]

  1. /etc/init.d/svnserve 파일이 이 파일을 참조하기 때문이다.
  2. 물론 방화벽 등 다른 문제가 없다는 가정 하에 그렇다.
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}