linux 搭建svn
2016-04-21 23:17
393 查看
1、安装svn客户端
1.1、使用命令安装
1)CentOS
2)ubuntu
1.2、源码安装
http://www.cnblogs.com/fengbohello/p/4142810.html
2、开启svn服务进程
2.1、我的习惯是把代码仓库放在/opt/svn目录下,所以先创建目录/opt/svn
2.2、开启svn服务进程
这个命令的作用是开启svn服务进程,并且把/opt/svn/目录作为我们的svn服务的根目录。以后,当我们要在客户端checkout代码的时候,svn服务进程就会从这里开始进行查询,类似于apache的/var/www/目录的作用。
运行如下命令检查svn服务是否开启了。
如果,出现以上结果,这说明svn服务正常开启了。
2.3、创建我们的第一个代码仓库:firsttest
这就创建了我们的第一个代码仓库,这个代码仓库的名字就叫做“firsttest”,可以看到其中的文件
2.4、下面对我们的代码仓库进行权限设置
1)进入conf目录
2)编辑svnserve.conf。这个文件是要告诉svn服务进程,我们的firsttest项目的认证权限和认证需要的密码文件以及认证文件的存放位置。
在第8行左右找到“[general]”,对其下面的内容进行编辑
其中需要编辑的地方分别是
2.1)
修改为
注意,红色的两行前面不能有空格,否个svn会读取失败,下面的修改也要注意这些。这个一定要注意
2.2)
改为
2.3)
修改为
对于一般的情况,修改到这里就可以了,下面的选项是加密选项等的加强版,这里就不说了。
3)下面修改passwd文件。
3.1)找到“[users]”,在此选项下添加用户“woshihehe”,“woshihehe”用户对应的密码是“123456”
4)修改authz文件
在最后添加两行
这两行的意思是,目录[/](代码根目录)下的所有文件,如果没有特殊约定的话,woshihehe用户将具有读(r)和写(w)的权限。
3、下载代码
假如我的svn服务器的IP是192.168.1.105,在其它的机器上,执行如下代码
那么接下来输入密码就可以了
填写yes,这样我们就取出了我们的代码,版本是0。这时候就可以在里面添加目录和文件了。不过这个是如何使用svn了,这里就细说了。
1.1、使用命令安装
1)CentOS
$ yum install subversion
2)ubuntu
sudo apt-get install subversion
1.2、源码安装
http://www.cnblogs.com/fengbohello/p/4142810.html
2、开启svn服务进程
2.1、我的习惯是把代码仓库放在/opt/svn目录下,所以先创建目录/opt/svn
$ mkdir /opt/svn -p
2.2、开启svn服务进程
svnserve -d -r /opt/svn/
这个命令的作用是开启svn服务进程,并且把/opt/svn/目录作为我们的svn服务的根目录。以后,当我们要在客户端checkout代码的时候,svn服务进程就会从这里开始进行查询,类似于apache的/var/www/目录的作用。
运行如下命令检查svn服务是否开启了。
# ps -ef | grep svn root 2572 1 0 09:22 ? 00:00:00 svnserve -d -r /opt/svn/
如果,出现以上结果,这说明svn服务正常开启了。
2.3、创建我们的第一个代码仓库:firsttest
# cd /opt/svn/ # svnadmin create firsttest
这就创建了我们的第一个代码仓库,这个代码仓库的名字就叫做“firsttest”,可以看到其中的文件
# ls firsttest/ README.txt conf db format hooks locks
2.4、下面对我们的代码仓库进行权限设置
1)进入conf目录
# cd firsttest/conf/
2)编辑svnserve.conf。这个文件是要告诉svn服务进程,我们的firsttest项目的认证权限和认证需要的密码文件以及认证文件的存放位置。
在第8行左右找到“[general]”,对其下面的内容进行编辑
# vim svnserve.conf ### 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",
其中需要编辑的地方分别是
2.1)
### and "none". The sample settings below are the defaults. # anon-access = read # auth-access = write ### The password-db option controls the location of the password
修改为
### 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
注意,红色的两行前面不能有空格,否个svn会读取失败,下面的修改也要注意这些。这个一定要注意
2.2)
### Uncomment the line below to use the default password file. # password-db = passwd ### The authz-db option controls the location of the authorization
改为
### Uncomment the line below to use the default password file. password-db = passwd ### The authz-db option controls the location of the authorization
2.3)
### Uncomment the line below to use the default authorization file. # authz-db = authz ### This option specifies the authentication realm of the repository.
修改为
### Uncomment the line below to use the default authorization file. authz-db = authz ### This option specifies the authentication realm of the repository.
对于一般的情况,修改到这里就可以了,下面的选项是加密选项等的加强版,这里就不说了。
3)下面修改passwd文件。
# vim passwd
3.1)找到“[users]”,在此选项下添加用户“woshihehe”,“woshihehe”用户对应的密码是“123456”
[users] # harry = harryssecret # sally = sallyssecret woshihehe = 123456
4)修改authz文件
# vim authz
在最后添加两行
# [repository:/baz/fuz] # @harry_and_sally = rw # * = r [/] woshihehe=rw 如果是所有人都可以checkout,那么就要修改成* = rw
这两行的意思是,目录[/](代码根目录)下的所有文件,如果没有特殊约定的话,woshihehe用户将具有读(r)和写(w)的权限。
3、下载代码
假如我的svn服务器的IP是192.168.1.105,在其它的机器上,执行如下代码
# svn co svn://192.168.1.105:/firsttest --username woshihehe 认证领域: <svn://192.168.1.105:3690> My First Repository “woshihehe”的密码:
那么接下来输入密码就可以了
----------------------------------------------------------------------- 注意! 你的密码,对于认证域: <svn://192.168.1.105:3690> My First Repository 只能明文保存在磁盘上! 如果可能的话,请考虑配置你的系统,让 Subversion 可以保存加密后的密码。请参阅文档以获得详细信息。 你可以通过在“/root/.subversion/servers”中设置选项“store-plaintext-passwords”为“yes”或“no”, 来避免再次出现此警告。 ----------------------------------------------------------------------- 保存未加密的密码(yes/no)?yes 取出版本 0。
填写yes,这样我们就取出了我们的代码,版本是0。这时候就可以在里面添加目录和文件了。不过这个是如何使用svn了,这里就细说了。
相关文章推荐
- 转:linux守护进程的启动方法
- 用USB在win7系统上安装centos
- Linux 系统下的各种包的安装
- Linux中批量修改文件名
- 图形安装centos6.5
- linux内核中链表结构及使用方法
- Linux 网卡流量工具详细介绍【转】
- Linux学习总结
- hadoop2.7.1在vmware上3台centos7虚拟机上的完全分布式集群搭建
- linux命令(10)---echo、wall、write、clear、sync、uptime命令
- Linux 关机重启
- Linux crontab用法和时间同步设置
- 【php基础 Xdebug】linux下Xdebug的安装与使用
- Linux Python升级
- linux基础2
- 20135220谈愈敏Linux_总结
- arm9+linux fl2440 GPRS SIM卡 模块 ppp拨号上网
- linux下lvm逻辑卷和快照的命令详解
- linux 守护进程
- linux 统计文件的个数