인프라/Docker

[Docker] Centos7 + subversion 설치기

Morian Kim 2020. 11. 6. 18:59

 

Docker Centos7 다운

 

centos - Docker Hub

Supported tags and respective Dockerfile links latest, centos8, 8 centos7, 7 centos6, 6 centos7.7.1908, 7.7.1908 centos7.6.1810, 7.6.1810 centos7.5.1804, 7.5.1804 centos7.4.1708, 7.4.1708 centos7.3.1611, 7.3.1611 centos7.2.1511, 7.2.1511 centos7.1.1503, 7.

hub.docker.com

docker pull centos:7

 

PS C:\docker> docker run --privileged -d --name mycentos7 -p 3690:3690 centos:centos7 init
9297bd6bf849a0866584a1e59bc00d0b2f90f552f84de446d45e8f100afcb3db

PS C:\docker> docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                    NAMES
9297bd6bf849        centos:centos7      "init"              5 minutes ago       Up 5 minutes        0.0.0.0:3690->3690/tcp   mycentos7

PS C:\docker> docker exec -it mycentos7 bin/bash

 

systemd 를 사용하기위해 --privileged 옵션과 마지막에 init command를 주었다.

( centos7 image를 경량화 하기위해 systemd 기능을 제거했다고 어디선가 보았다... )

svn 기본포트사용으로 3690 포트포워딩

 

옵션을 주지 않으면 systemd 커맨드를 사용 시 아래와같은 오류를 만나게 될 것이다.

Failed to get D-Bus connection: Operation not permitted

 


install svn

yum -y install subversion

svn repository 최상위 directory 경로설정

[root@9297bd6bf849 /]# vi /etc/sysconfig/svnserve
# OPTIONS is used to pass command-line arguments to svnserve.
#
# Specify the repository location in -r parameter:
OPTIONS="-r /var/svn"

본인은 "/var/svn" 에서 "/svn_repo" 로 변경하였다.

반드시 디렉토리를 만들어주어야 svnserve.service를 실행 할때 오류가 생기지 않는다.

디렉토리를 생성하지 않으면 생기는 오류

svn 기본포트를 변경하고싶으면 위의 OPTIONS를 아래와같이 추가하여 포트번호를 변경하면된다.

# OPTIONS is used to pass command-line arguments to svnserve.
#
# Specify the repository location in -r parameter:
OPTIONS="-r /var/svn --listen-port 3690"

 

디렉토리 생성 후 svn start! (기본포트 3690)

systemctl start svnserve

 

 

test-repo 저장소 생성해보기

svnadmin create --fs-type fsfs /svn_repo/test-repo

 

test-repo 저장소로 이동

 


test-repo 접근권한 설정하기위해 svnserve.conf 살펴보기

각 Repository 마다 conf가 존재한다.

다 주석으로 되어있을 텐데 여기서 수정해야할 부분만 확인해보자

 

CentOS 7에 Subversion(SVN) 설치하고 저장소 만들기

CentOS 7에 Subversion(SVN) 설치하고 저장소 만들기 참고사이트 https://blog.hanumoka.net/2018/04/30/centOs-20180430-centos-install-subversion/ https://okkks.tistory.com/975 https://zetawiki.com/wiki/C..

hellowoori.tistory.com

이분의 글이 잘되어 있어서 아래 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.apache.org/ for more information.

[general]
### The anon-access and auth-access options control access to the
### repository for unauthenticated (a.k.a. anonymous) users and
### authenticated users, respectively.
### Valid values are "write", "read", and "none".
### Setting the value to "none" prohibits both reading and writing;
### "read" allows read-only access, and "write" allows complete
### read/write access to the repository.
### The sample settings below are the defaults and specify that anonymous
### users have read-only access to the repository, while authenticated
### users have read and write access to the repository.
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
### The force-username-case option causes svnserve to case-normalize
### usernames before comparing them against the authorization rules in the
### authz-db file configured above.  Valid values are "upper" (to upper-
### case the usernames), "lower" (to lowercase the usernames), and
### "none" (to compare usernames as-is without case conversion, which
### is the default behavior).
#force-username-case = none

[sasl]
### This option specifies whether you want to use the Cyrus SASL
### library for authentication. Default is false.
### This section will be ignored if svnserve is not built with Cyrus
### SASL support; to check, run 'svnserve --version' and look for a line
### reading 'Cyrus SASL authentication is available.'
# use-sasl = true
### These options specify the desired strength of the security layer
### that you want SASL to provide. 0 means no encryption, 1 means
### integrity-checking only, values larger than 1 are correlated
### to the effective key length for encryption (e.g. 128 means 128-bit
### encryption). The values below are the defaults.
# min-encryption = 0
# max-encryption = 256
  • anon-access : 로그인 하지 않은 사용자(비인증 계정)에게 접근권한을 설정하는 부분. read, write, none 세가지 값을 설정 할 수 있다.

  • auth-access :  로그인한 사용자(인증 계정)에 대한 접근 권한을 설정하는 부분. read, write, none 세가지 값을 설정 할 수 있다.

  • passwd-db : 저장소에 접근할 사용자 계정과 비밀번호를 관리할 파일의 이름을 지정하는 설정이다. 기본 파일명은 passwd 이며, 다른 이름을 사용할 수 있다.

  • authz-db : 파일과 디렉토리에 대한 접근 권한을 관리하는 파일의 이름을 지정하는 설정이다. 기본 파일명은 authz 이며, 다른 이름을 사용할 수 있다.

  • realm :  인증할 때 보여주는 간단한 저장소 설명이며, 생략 가능하다.

( none : 접근 권한 없음, read : 읽기 권한, write : 쓰기 권한 )

 

사용자, 비밀번호 설정

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]
admin = admin

{id} = {passwd} 형식으로 지정하자

 

권한 설정

authz 파일 수정

### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
###  - a single user,
###  - a group of users defined in a special [groups] section,
###  - an alias defined in a special [aliases] section,
###  - all authenticated users, using the '$authenticated' token,
###  - only anonymous users, using the '$anonymous' token,
###  - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').

[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average

#[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe

# [/foo/bar]
# harry = rw
# &joe = r
# * =

# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r

[groups]
admin = admin

[test-repo:/]
@admin = rw

 

 

SVN 설치 및 설정

1. SVN 설치 확인 # svn -bash: svn: commond not found # rpm -qa | grep subversion 2. yum설치 # yum install subversion 3. 설치확인 # svn Type 'svn help' for usage. # svnserve You must specify exactly..

yaic.tistory.com

위 사이트에서 내용 참조

 


재기동 및 확인!

systemctl restart svnserve

svn list svn://127.0.0.1/test-repo
svn info svn://127.0.0.1/test-repo

svn list로 test-repo 내부에 파일들을 확인 (현재는 아무것도 없음)

svn info로 Repository 정보 확인

 


eclipse로 test-repo에 붙어서 보자!

 

확인 끝!!