CentOS經過yum安裝subversionspring
yum install subversion
查看svn安裝在哪一個目錄apache
which svnserve
檢查一下subversion是否安裝成功。bash
svnserve --version svnserve, version 1.7.14 (r1542130) compiled Nov 20 2015, 19:25:09 Copyright (C) 2013 The Apache Software Foundation. This software consists of contributions made by many people; see the NOTICE file for more information. Subversion is open source software, see http://subversion.apache.org/ The following repository back-end (FS) modules are available: * fs_base : Module for working with a Berkeley DB repository. * fs_fs : Module for working with a plain file (FSFS) repository. Cyrus SASL authentication is available.
創建版本庫服務器
subversion默認以/var/svn做爲數據根目錄,能夠經過/etc/sysconfig/svnserve修改這個默認位置。ssh
systemctl vi svnserve.service # /usr/lib/systemd/system/svnserve.service [Unit] Description=Subversion protocol daemon After=syslog.target network.target [Service] Type=forking EnvironmentFile=/etc/sysconfig/svnserve ExecStart=/usr/bin/svnserve --daemon --pid-file=/run/svnserve/svnserve.pid $OPTIONS [Install] WantedBy=multi-user.target
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"
咱們修改/etc/sysconfig/svnserver將默認目錄指定到/opt/svn。tcp
vi /etc/sysconfig/svnserve OPTIONS="-r /opt/svn"
使用svnadmin創建版本庫productsvn
mkdir -p /opt/svn svnadmin create /opt/svn/product
配置code
編輯用戶文件passwd,新增用戶:leo和sayorm
/opt/svn/product/conf/passwd [users] leo = leo say = say
編輯權限文件authz,用戶say設置可讀寫權限,leo設置只讀權限。server
vi /opt/svn/product/conf/authz [/] say = rw leo = r
編輯svnserve.conf:
$ vi /opt/svn/product/conf/svnserve.conf [general] anon-access = none #控制非鑑權用戶訪問版本庫的權限 auth-access = write #控制鑑權用戶訪問版本庫的權限 password-db = passwd #指定用戶名口令文件名 authz-db = authz #指定權限配置文件名 realm = spring-hello-world #指定版本庫的認證域,即在登陸時提示的認證域名稱
svn服務
啓動SVN服務。
systemctl start svnserve.service
檢查服務是否啓動成功。
$ ps aux | grep svn root 16349 0.0 0.1 162180 900 ? Ss 15:01 0:00 /usr/bin/svnserve --daemon --pid-file=/run/svnserve/svnserve.pid -r /opt/svn
經過netstat能夠看到SVN打開了3690端口。
$ netstat -tnlp Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 16349/svnserve
設置成開機啓動。
$ systemctl enable svnserve.service
用systemctl檢查服務器的防火牆配置:
$ firewall-cmd --list-all public (default, active) interfaces: eno16777736 eno33554984 sources: services: dhcpv6-client ssh ports: masquerade: no forward-ports: icmp-blocks: rich rules:
能夠看到,沒有telnet服務和3690端口。增長telnet服務器和3690端口:
$ firewall-cmd --permanent --add-service=telnet $ firewall-cmd --permanent --add-port=3690/tcp $ firewall-cmd --reload