Installation, configuration and startup of SVN under Linux (centOS6.5)

Original address: http://www.blogjava.net/rockblue1988/archive/2014/11/19/420246.aspx

Preparation: yum

1. Check whether it is installed

rpm -qa subversion

If you want to uninstall the old version:

yum remove subversion


2. Installation

yum install subversion
PS: yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql (this is a module for installing with Apache, I haven't done it yet, I will add it after I do it, you can just install subversion, it doesn't matter if you install more)

3. Check if the installation is successful

svnserve --version

If successful, the version number will be output

4. Create a warehouse directory
For example:

mkdir /home/svn/game


5. Create a project

svnadmin create /home/svn/game


6. Check if the creation is successful

cd /home/svn/game
ll

If successful, there will be several more folders in the game directory.


7. When you enter the conf directory, you will see 3 configuration files. The generated files have English comments.
Example requirements:

Planning group: open planning, art reading and writing Back-
end group: open back-end reading and writing, planning read-only Front-
end group: open front-end reading and writing, planning, art read-only
Art group: open art reading and writing, planning read-only
Administrator group: all reads and writes

authz: ​​user rights configuration
example:

[groups] #Management
group
manager = boss #Server
user group
server = server1,server2 #Client
user group
client = client1,client2 #Art
group
art = art1,art2 #Planning
group
design=design1,design2
[game:/]
@manager=rw
[game:/server]
@server=rw
[game:/client]
@client=rw
@design=r
@art=r
[game:/art]
@design=rw
@art=rw
@client=r
[game:/design]
@design=rw
@server=r
@client=r
@art=r

passwd: user password

[users]
boss=123456
server1=123456
server2=123456
client1=123456
client2=123456
art1=123456
art2=123456
design1=123456
design2=123456

svnserve.conf:

#匿名访问者权限
anon-access = none
#验证用户权限
auth-access = write
#密码文件地址
#password-db = /home/svn/game/passwd
password-db =passwd
#权限文件地址
#authz-db = /home/svn/game/authz
authz-db =authz
#项目名称(UUID)
realm =game


8.开放svn端口
默认是3690端口,你也可以用别的。已开启的跳过这一步

修改
iptables -I INPUT -p tcp --dport 3690 -j ACCEPT
保存
/etc/rc.d/init.d/iptables save
重启
service iptables restart
查看
/etc/init.d/iptables status


9.启动SVN服务

svnserve -d -r /home/svn

-d:守护进程
-r:svn根目录
假设服务端IP为192.168.1.100,那么如下设置后game的访问目录就为:

svn://192.168.1.100/game


10.安装客户端 TortoiseSVN

11.建立子目录
在客户端PC上找个目录,用管理员帐户从svn://192.168.1.100/game迁出game目录,分别新建art,design,server,client 4个子目录,然后提交。
这时候你可以用其他组的帐户测试下是否正常使用了。

12.安装好的svn服务端,默认是不会开机自启动的,每次开机自己启动会很麻烦,我们可以把它设成开机启动
首先:编写一个启动脚本svn_startup.sh,我放在/root/svn_startup.sh
#!/bin/bash
/usr/bin/svnserve -d -r /home/svn/
这里的svnserve路径保险起见,最好写绝对路径,因为启动的时候,环境变量也许没加载。
绝对路径怎么查?
which svnserve

这里还有可能碰到一个问题,如果你在windows下建立和编写的脚步,拿到linux下,用vi或者vim修改后可能会无法执行,这是文件格式的问题

vi svn_startup.sh

输入:set ff 回车

如果显示的结果不是fileformat=unix

再次输入

set ff=unix

就OK了

然后修改该脚本的执行权限

chmod ug+x svn_startup.sh

或者万能的

chmod 777 svn_startup.sh

最后:加入自动运行

vi /etc/rc.d/rc.local
在末尾添加脚本的路径,如:
/root/svn_startup.sh

现在,你可以重启一下试试了。 不懂得怎么确认成功?败给你了

ps -ef|grep svnserve

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326221437&siteId=291194637