svn and how to install

https://hub.docker.com/r/krisdavison/svn-server/

Description

This docker image was built on top of the Ubuntu 14.04 latest image using docker version 1.4.1

Subversion is installed as is Apache 2 web server for remote access. 

Setup is as described in https://help.ubuntu.com/community/Subversion

The basic install is complete along with the WebDAV protocol setup but I have not included the SSL , SSH or custom protocol setup.

Running Commands

To run the image simply type (-p maps port 80 of the host to port 80 of the container)

docker run -d -p 80:80 krisdavison/svn-server:v2.0 /startup.sh

Optionally you can name the container using the (substitute mysvnserver with your own name)

<span style="font-family: Monaco, Consolas, Courier, 'Lucida Console', monospace;"–<name mysvnserver

Optionally you can map a volume to the svn repository root folder for backups etc 

-v /home/svn

Configuration

The image is pre-configured with a single remote user

username:user

password:password

If you would like to add additional users you can attach to the running container as below.

docker exec -it <container-name> bash

To clear all old users and add a new user simple type. (substitute your user for user-name) and then the system will request that users password.

htpasswd -c /etc/subversion/passwd user-name

or to add a new user without removing all the old ones type this. (remove the -c)

htpasswd /etc/subversion/passwd user-name

To exit the container in a safe way after making these changes simply type.

exit

Checking it worked

On your host machine open a browser and type in the following url.

http://localhost/svn

(This will ask for your username and password – Default is : user and password)

The browser should then show an empty SampleProject that has been created just to prove the svn repo works. If this does not work please make sure you are using the newest version of the docker image and that you specified /startup.sh as the executable as the last param.

Future Changes / ToDo List

  1. Provide a way to specify a txt file of username and passwords for simple setup of users.

SVN Commit error: Can’t open file txn-current-lock Permission denied

http://stackoverflow.com/questions/10607928/svn-commit-error-cant-open-file-txn-current-lock-permission-denied

 can do checkouts, update and such. But when I try to commit changes, SVN gives me the following error:

Can’t open file ‘/svn/p/pokemonium/code/db/txn-current-lock’: Permission denied

I am using Windows 7 x64 SP1 with latest version of TortoiseSVN. UAC is off, my account has read and write access, etc.

I can commit fine to other svn repositorys.

For me it ended up being a permissions issue on the server. I have my repo on a linux box, and ssh in to use svnadmin. For convenience sake, I had executed my create repository command as root. I was looking to get source I had on my Windows box into the repo, so was using TortoiseSVN to set up trunk/branches/tags. The directory containing the repo on the server was owned by root, and Tortoise was coming in as apache. I chowned the directory on the server to apache:apache, and it all went smoothly.

chown apache:apache -R my_repo_root

#######

从该docker .bash_history中提取的操作日志

mkdir /home/svn

cd /home/svn

mkdir SampleProject

apt-get install apache2 subversion

service httpd status

service apache2 status

pwd

chown -R www-data:subversion SampleProject

groupadd subversion

useradd -G subversion www-data

usermod -a -G subversion www-data

usermod -a -G subversion root

chown -R www-data:subversion SampleProject

chmod -R g+rws SampleProject

svnadmin create  dir   ###

ls

chown -R www-data:subversion SampleProject

chmod -R g+rws SampleProject

apt-get install libapache2-svn

apt-get update

apt-get install libapache2-svn

apt-get install nano

nano /etc/apache2/mods-available/dav_svn.conf

service apache2 restart

htpasswd -c /etc/subversion/passwd KristoforD

apt-get install apache2-utils

htpasswd -c /etc/subversion/passwd KristoforD

htpasswd /etc/subversion/passwd RossH

htpasswd /etc/subversion/passwd RodS

htpasswd /etc/subversion/passwd KarlS

htpasswd /etc/subversion/passwd KevJ

ls

cd test

svn co http://172.17.0.2/svn/SampleProject SampleProject –username KristoforD

ls

cd SampleProject/

ls

cd ../

cd ,,.

cd ..

rm test

rm -r test

ls

nano /root/.subversion/servers

exit

htpasswd -c /etc/subversion/passwd user

exit

nano /etc/apache2/mods-available/dav_svn.conf

ifconfig

service apache2 start

service apache2 status

nano /etc/apache2/apache2.conf

service apache2 status

service apache2 restart

cd var.lo

cd /var/log/

ls

cd apache2

ls

cat access.log

cd /

nano startup.sh

ls

chmod a+x startup.sh

ls

exit

如果修改访问限制,在apache2中

修改/etc/apache2/mods-enabled/dav_svn.conf

修改/etc/apache2/apache2.conf或者/etc/apache2/conf-enabled/security.conf并不管用

修改/etc/apache2/conf-enabled/security.conf,取消开头注释

<Directory />

   AllowOverride None

   Order Deny,Allow

   Allow from AIP

   Allow from BIP

   Deny from all

</Directory>

来限制根目录访问

修改dav_svn.conf

Location /svn中添加

   Order Deny,Allow

   Allow from AIP

   Allow from BIP

   Deny from All

SVN服务器搭建 

光哥

目录 

一、平台说明 2 

1、架构 2 

2、 环境规划 2 

二、安装配置 3 

一、平台说明 

svn(subversion)是近年来崛起的版本管理工具,是cvs的接班人。目前,绝大多数开源软件都使用svn作为代码版本管理软件。如何快速建立 Subversion服务器,并且在项目中使用起来,这是大家最关心的问题,与CVS相比,Subversion有更多的选择,也更加的容易,几个命令就 可以建立一套服务器环境, 

1、架构 

Subversion服务器程序安装包 

Subversion的Windows客户端TortoiseSVN安装包 

本文主要介绍Subversion安装配置过程。 

2、 环境规划 

IP 系统版本 部署组件(版本) 备注 

192.168.74.113 CentOS 6.3 subversion-1.6.12.tar.gz 

subversion-deps-1.6.12.tar.gz 编译安装 

备注:subversion-1.7之后不再使用subversion-deps*相关依赖包。安装方式有所变化,有待再研究 

二、安装配置 

wget http://subversion.tigris.org/downloads/subversion-1.6.12.tar.gz 

wget http://subversion.tigris.org/downloads/subversion-deps-1.6.12.tar.gz 

tar zvxf subversion-1.6.12.tar.gz 

tar zvxf subversion-deps-1.6.12.tar.gz 

cd subversion-1.6.12 

./configure –prefix=/opt/subversion 

make 

make install 

mkdir -p /data/svndata 创建目录/data/svndata,作为svn的Repository库根目录 

svnadmin create /data/svndata/record 创建一个Repository项目目录,名称叫record 

########修改主配置文件 

vi /data/svndata/record/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 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 设定密码库文件为当前目录下的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 设定账号验证库文件为当前目录下的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 

[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 

#########添加用户与密码 

vi /data/svndata/record/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 

gaohaotian = gaohaotian 格式: 账号 = 密码 

hanxiaoguang = hanxiaoguang 

lsh = lsh 

pengran = pengran 

renyongbin = renyongbin 

shiying = shiying 

tongning = tongning 

#######配置权限 

vi /data/svndata/record/conf /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 

g_xhyw = gaohaotian,hanxiaoguang,lsh,renyongbin,tongning,shiying,pengran 设置权限组g_xhyw及其成员 

# [/foo/bar] 

# harry = rw 

# &joe = r 

# * = 

# [repository:/baz/fuz] 

# @harry_and_sally = rw  

# * = r 

[/] 设定根目录(即/data/svndata目录)权限。g_xhyw组成员具有读写权限 

@g_xhyw = rw 

#############启动和停止SVN服务 

[root@svn ~]# svnserve -d -r /data/svndata/record 

-d表示后台运行 

-r 指定根目录是 /data/svndata/ 

停止SVN服务: 

ps -aux |grep svn 

kill -9 进程杀掉 

#访问权限控制

/etc/httpd/conf.d/httpd_svn.authz 

#[/]

#* =r

[proj:/]

aaa = rw

bbb = rw

/etc/httpd/conf.d/subversion.conf  或者/etc/apache2/mods-enabled/dav_svn.conf

<Location /xiangmu/ >

        DAV svn

        SVNParentPath dir

# SVNPath dir/jfbq

        AuthType Basic

        AuthName “Authorization Realm”

        AuthUserFile /etc/httpd/conf.d/httpd_svn.passwd

        Require valid-user

        AuthzSVNAccessFile /etc/httpd/conf.d/httpd_svn.authz

      Order Deny,Allow

     Allow from  ip1

     Allow from  ip2

     Deny from All

</Location>

SVN Server on Ubuntu with https access

https://rbgeek.wordpress.com/2012/09/09/svn-server-on-ubuntu-with-https-access/

点赞

发表评论

电子邮件地址不会被公开。 必填项已用*标注