一、检查是否已安装
成都创新互联技术团队10年来致力于为客户提供网站建设、成都网站设计、成都品牌网站建设、网络营销推广、搜索引擎SEO优化等服务。经过多年发展,公司拥有经验丰富的技术团队,先后服务、推广了成百上千网站,包括各类中小企业、企事单位、高校等机构单位。
# svnserve --version
如果出现下列提示,则代表没有安装
-bash: svnserve: command not found
如果出现下列提示,则代表已经安装了,直接跳到四步
svnserve, version 1.7.14 (r1542130)
compiled Apr 11 2018, 02:40:28
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.
二、安装
# yum install -y subversion
三、再次检查是否已安装
# svnserve --version
四、创建并进入到储存版本库的目录
# mkdir /data/svn-repository
# cd /data/svn-repository
五、创建一个版本库(项目) test
为版本库的名称
# svnadmin create test
六、显示版本库目录的文件列表
# ls test
名称 |
类型 |
说明 |
---|---|---|
conf |
目录 |
配置文件目录 |
conf/authz |
文件 |
负责账号权限的管理,控制账号是否读写权限 |
conf/passwd |
文件 |
负责账号和密码的用户名单管理 |
conf/svnserve.conf |
文件 |
版本库配置文件 |
db |
目录 |
版本数据存储目录 |
hooks |
目录 |
版本库钩子脚本文件目录 |
locks |
目录 |
db锁文件和db_logs锁文件的目录,用来追踪存取文件库的客户端 |
format |
文件 |
存储一个整数的文件,此整数代表库层次结构版本 |
README.txt |
文件 |
说明文件 |
七、设置全局配置 默认情况下,都是使用版本库目录下conf
目录的配置,一两个项目还没问他,但是项目一多,管理就很麻烦了。 先把配置目录复制出来,作为全局配置
# cp -R test/conf conf
八、新增该版本库的用户 打开passwd
文件
# vi conf/passwd
在文件末新增一行,输入用户名jwj
和密码123456
### 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
jwj = qq2254
九、设置版本库用户的权限 打开authz
文件
# vi conf/authz
给jwj
用户赋予test
版本库根目录的读写权限
### 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
[test:/]
jwj = rw
当然,还有更多权限的写法
十、设置svn服务开机自启
#vi /etc/init.d/svn
然后输入以下内容
#!/bin/sh
# chkconfig: 2345 85 85
# processname: svn
svn_bin=/bin
svn_port=3690
svn_home=/mnt/svn-repository
svn_config=/mnt/svn-repository/conf/svnserve.conf
if [ ! -f "$svn_bin/svnserve" ]
then
echo "svnserver startup: cannot start"
exit
fi
case "$1" in
start)
echo "Starting svnserve..."
$svn_bin/svnserve -d -r $svn_home --config-file $svn_config --listen-port $svn_port
echo "Successfully!"
;;
stop)
echo "Stoping svnserve..."
killall svnserve
echo "Successfully!"
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: svn { start | stop | restart } "
exit 1
;;
esac
给文件添加可执行权限
# chmod +x /etc/init.d/svn
开启开机自启动
# chkconfig svn on
十一、启动svn
# service svn start
本文标题:Linux服务器搭建SVN服务器
本文来源:http://www.csdahua.cn/qtweb/news19/397569.html
网站建设、网络推广公司-快上网,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 快上网