본문 바로가기

와사비크래커 IT Tip/Infra

[리눅스(Linux)]SVN 서버 설치

728x90
반응형

(패키지 설치)
#yum install subversion

(svn 디렉토리 생성)
#cd


[root@localhost svn]#pwd
/home/svn

[root@localhost svn]#mkdir svn
(SVN 경로 폴더 생성)

[root@localhost svn]# svnadmin create --fs-type fsfs /home/svn/svn/QCDOC
[root@localhost svn]# svnadmin create --fs-type fsfs /home/svn/svn/EEMS
[root@localhost svn]# svnadmin create --fs-type fsfs /home/svn/svn/NPUMS
(필요 SVN 생성)

[root@localhost svn]# cd svn/
[root@localhost svn]# ls
EEMS  NPUMS  QCDOC
(svn 생성 확인)

[root@localhost svn]# cd EEMS/
[root@localhost EEMS]# ls
conf  db  format  hooks  locks  README.txt
[root@localhost EEMS]# cd conf/
authz          passwd         svnserve.conf
[root@localhost EEMS]# vi conf/svnserve.conf
(svn 생성 설정 파일 설정)


[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 = read (수정)
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 directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### 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 the
### directory containing this file.  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 = My First Repository


[root@localhost EEMS]# cd conf/
[root@localhost conf]# ls
authz  passwd  svnserve.conf
[root@localhost conf]# vi passwd
(사용자 ID/패스워드 등록)
[users]
# harry = harryssecret
# sally = sallyssecret
test = test


[root@localhost conf]# cp ./svnserve.conf ../../NPUMS/conf/svnserve.conf
cp: overwrite `../../NPUMS/conf/svnserve.conf'? y
[root@localhost conf]# cp ./svnserve.conf ../../QCDOC/conf/svnserve.conf
cp: overwrite `../../QCDOC/conf/svnserve.conf'? y
[root@localhost conf]# cp ./passwd ../../NPUMS/conf/passwd
cp: overwrite `../../NPUMS/conf/passwd'? y
[root@localhost conf]# cp ./passwd ../../QCDOC/conf/passwd
cp: overwrite `../../QCDOC/conf/passwd'? y
(설정 파일 나머지도 동일하게 overwrite)


[root@localhost conf]# svnserve -d -r /home/svn
port 3690 사용
(서비스 실행)


---------------------------------------------------

[svn 디렉토리 생성]
$ cd /home
$ mkdir svn
$ cd svn

[설정파일 갱신]
/etc/sysconfig/svnserve 파일 생성(yum으로 설치해도 위 파일이 생성되지 않으므로 직접 작성)
※ service svnserve start/status/stop 등의 명령어를 사용할 수 있다.
$ echo 'OPTIONS="--threads --root 저장소의 최상위 디렉토리"' > /etc/sysconfig/svnserve
ex) echo 'OPTIONS="--threads --root /home/svn"' > /etc/sysconfig/svnserve

[svn 리파지토리 생성]
$ svnadmin create --fs-type fsfs 리파지토리명
$ cd conf

[svn 사용자 계정 설정]
$ vi authz
developer=rw
:wq
$ vi passwd
developer=developer
:wq
$ cp -a svnserve.conf svnserve.conf_org
$ vi svnserve.conf

[general]
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz
realm = portal.pocheoltech.hs.kr repository
:wq

[svn 데몬 시작]
$ service svnserve start

[svn 데몬 중지]
$ service svnserve stop

[svn port 확인]
$ netstat -atn | grep 3690

[svn port 방화벽 확인]
$ iptables -I INPUT -p tcp --dport 3690 -j ACCEPT

[기존 리파지토리 dump]
$ svnadmin dump /home/svn/리파지토리명 > /root/리파지토리명.dump

[기존 리파지토리 load]
$ svnadmin load /home/svn/리파지토리명 < 리파지토리명.dump


[주소 방식]
svn://[서버IP주소]/svn/EEMS
svn://[서버IP주소]/svn/NPUMS
svn://[서버IP주소]/svn/QADEV

svn://xxx.도메인/리파지토리명


반응형