linux下svn配置
来源:互联网 发布:python 矩阵转图片 编辑:程序博客网 时间:2024/05/16 12:01
本系统采用为每个项目单独建一版本库的策略。配置文件,密码文件,访问控制文件等都放在版本库的conf目录下。所以每次开始一个新项目都必须新建一个版本库,并重新配置各配置文件。还有很重要的一条,要求各组员重新配置客户端,包括服务器版本库路径,本地路径等信息。
◆建立版本库目录(可建立多个,新建库后以下各项都需重新配置。注意区别安装目录与版本库目录,以下讲的都是版本库目录)
mkdir –p /opt/svndata/repos
◆建立svn版本库(与上面目录对应)
svnadmin create /opt/svndata/repos
执行此命令后svn自动在repos目录下添加必须的配置文件.
注意:版本库不同于一般的文件夹, 直接在操作系统上新建文件无法被SVN识别, 必须使用import等命令将文件导入版本库.
此为svn内部指令,create用于新建版本库。请使用svn help查看详细说明。
◆修改版本库配置文件
vi /opt/svndata/repos/conf/svnserve.conf
各参数功能在配置文件的注释中有说明, 此处配置如下:
[general]
anon-access = none # 使非授权用户无法访问
auth-access = write # 使授权用户有写权限
password-db = passwd # 指明密码文件路径
authz-db = authz # 访问控制文件
realm = /opt/svndata/repos # 认证命名空间,subversion会在认证提示里显示,并且作为凭证缓存的关键字。
其它采用默认配置. 各语句都必须顶格写, 左侧不能留空格, 否则会出错.
其中pwd.conf 与 authz.conf 在新建版本库时系统不会自动创建,需要自己创建。
指令简介:这是svn配置文件的格式,请按照以上格式书写。
◆配置用户
vi /opt/svndata/repos/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.
### 在下面添加用户和密码,每行一组username = password
[users]
# harry = harryssecret
# sally = sallyssecret
###===========下面是我添加的用户信息========#######
iitshare = password1
itblood = password2
可以添加多个,此为用户名密码对。
◆配置权限
vi /opt/svndata/repos/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
# [/foo/bar]
# harry = rw
# &joe = r
# * =
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
###--------------------下面我新加的------------------------###
###屏蔽掉上面的[groups] 因为在下面添加了
[groups]
devteam = iitshare, itblood #devteam 项目组包括两个用户iitshare,itblood
[/]
iitshare = rw
itblood =
[tshop:/tb2c]
@devteam = rw
itblood =
[repos:/]
@devteam = rw
itblood = r
其中,1个用户组可以包含1个或多个用户,用户间以逗号分隔。
说明:
devteam = iitshare, itblood #devteam 项目组包括两个用户iitshare,itblood
[/]
iitshare = rw #iitshare 对根目录有读写权限
itblood = #itblood 对根目录没有任何权限
####如果需要配置tb2c、tb2b2c项目的权限,前提条件是tshop仓库下面需要有这两个项目
####如果没有的话,tshop都将不能访问
[repos:/] #对repos仓库的所有项目进行权限控制
@devteam = rw #控制 devteam 组对tb2c项目有读写权限
◆启动服务
执行svnserve –d –r /opt/svndata/repos/ 启动服务, 以deamon方式运行。
本系统采用svnserve方式, 这是小团队项目的推荐方法. 这种方法维护最少, 配置最简单.
指令简介:此指令用于启动svn服务,-d指明以守护模式运行,svn自动在3690端口监听。3690是默认端口,可以使用“–listen-port=”或者“–listen-host=”来指定其它端口。-r选项用来指定svn服务的根目录,这样用户就可以使用相对路径访问,而不用提供完整路径。
◆检查是否启动
netstat -tunlp | grep svn
如果显示以下信息说明启动成功
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 10973/svnserve
◆将svn加入到开机启动
编辑rc.local文件:vi /etc/rc.d/rc.local
加入如下启动命令:
/usr/local/svn/bin/svnserve –d –r /opt/svndata/repos/
◆如果想停止svn,则使用如下命令:
killall svnserve
◆如果想将svn作为服务:
在/etc/rc.d/init.d/目录下新建名为svn的文件
并设置权限为755:chmod 755 /etc/rc.d/init.d/svn
编辑svn文件:vi /etc/rc.d/init.d/svn, 在里面添加如下代码:
#!/bin/bash
# build this file in /etc/rc.d/init.d/svn
# chmod 755 /etc/rc.d/init.d/svn
# centos下可以用如下命令管理svn: service svn start(restart/stop)
SVN_HOME=/opt/svn
if [ ! -f "/usr/local/svn/bin/svnserve" ]
then
echo "svnserver startup: cannot start"
exit
fi
case "$1" in
start)
echo "Starting svnserve..."
/usr/local/svn/bin/svnserve -d -r $SVN_HOME
echo "Finished!"
;;
stop)
echo "Stoping svnserve..."
killall svnserve
echo "Finished!"
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: svn { start | stop | restart } "
exit 1
esac
之后便可以以service svn start(restart/stop)方式启动SVN。
通过web方式访问svn有很多方法,请参阅配置websvn或配置bsSvnBrowser的方法
◆客户端访问
1、下载安装文件
window 64位的话下载:TortoiseSVN-1.7.6.22632-x64-svn-1.7.4.msi
window 32位的话下载:TortoiseSVN-1.6.5.16974-win32-svn-1.6.5.msi
具体的下载文件可以在网上下载下,一找一大堆
2、通过客户端进行访问
地址如下:
svn://{your-server-ip}:9999/repos/ 或者 svn://{your-server-ip}:3690/repos/
注意:
不要在浏览器中通过http的方式进行访问,如下地址:
http://{your-server-ip}:3690/tshop/
那样肯定是不行的,因为你没有配置http的服务,上面是安装独立的SVN服务器
- Linux下SVN配置
- Linux 下svn配置
- linux 下svn配置
- Linux下配置SVN
- Linux 下svn配置
- linux下svn配置
- Linux下SVN配置
- linux下SVN配置笔记
- linux下SVN配置笔记
- Linux下配置使用SVN
- linux下svn安装配置
- Linux下SVN安装配置
- Linux下SVN安装配置
- Linux下SVN安装配置
- linux下SVN配置笔记
- Linux下SVN安装配置
- Linux下SVN安装配置
- Linux下SVN安装配置
- android边框线
- css优先级
- Html+CSS CSS3中 transitions属性详解
- ViewPager左右滑动页面,下面的按钮跟着动态变化
- java0x01 eclipse基本操作
- linux下svn配置
- Python中的陷阱
- Java hashCode
- EventBus源码解读详细注释(5)事件消息继承性分析 eventInheritance含义
- 获取指定时间的offsets类:GetOffsetShell 源码导读
- 跟着Google学Android —— 1.3 来创建个非常简单的UI吧
- 1.1. Creating a New Project from Maven Archetype 从Maven Archetype创建一个新项目
- OC中关于时间的几个函数及格式化时间
- AlertController工具类的封装,让AlertController变得更简单