在Ubuntu下安装配置svn服务器
1. 安装svn
sudo apt-get install subversion
2. 开启svn服务器
svnserve -d
检查是否开启:ps aux | grep svnserve
若出现如下内容:
wkr 6537 0.0 0.0 13784 956 ? Ss 16:18 0:00 svnserve -d
wkr 7593 0.0 0.0 5784 864 pts/0 S+ 21:57 0:00 grep –color=auto svnserve
表示服务已开启。(注意:一定要有第1行,只有第2行说明服务未启动)
启动单个代码仓库:
svnserve -d -r /home/svn --listen-host 192.168.213.31
3. 建立仓库
svnadmin create /home/svn
理论上,仓库可以建立在任何目录中。
4. 修改配置文件
编辑 svnserve.conf
gedit /home/svn/conf/svnserve.conf
#去掉#[general]前面的#号
[general]
#匿名访问的权限,可以是read,write,none,默认为read
anon-access = none
#认证用户的权限,可以是read,write,none,默认为write
auth-access = write
#密码数据库的路径,去掉前面的#
password-db = passwd
注:当你去掉注释的时候,不要简单的把前面的#去掉,要把前面的空格一块去掉,不然在Eclipse中使用的时候会出现配置文件格式错误的问题。
5. 设置用户名密码
gedit /home/svn/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
user1 = pass1 # 输入你定义的用户名和密码,密码显然没有加密
6.上传代码
svn import -m "import" /home/project(项目路径) svn://192.168.213.31/svn
7.更换svn地址
svn switch --relocate [url]http://xxx.xxx.xxx.xxx/xxx[/url](旧的svn地址) [url]http://xxx.xxx.xxx.xxx/xxx[/url](新的svn地址)
配置eclipse svn客户端
eclipse菜单栏help->Install New Software
http://subclipse.tigris.org/update_1.8.x
在eclipse里新建project,在new project里选择svn里的checkout project from svn