免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1901 | 回复: 0
打印 上一主题 下一主题

svn源码控制环境搭建 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-03-04 14:29 |只看该作者 |倒序浏览
    公司最近有个驻外项目需要用到源码版本控制工具对项目开发版本进行控制,再此工具采用svn进行控制,版本:subversion-1.5.6.tar.gz,系统环境:redhat enterprise linux 5,开发工具MyEclipse 5.5.1 GA。
    本文将介绍:
      svn的安装配置;
      MyEclipse的svn插件安装;
      MyEclipse获取项目源码;
1.svn的安装配置:
  svn下载软件:
http://subversion.tigris.org
1.2.安装时没有采用apache于svn的整合,因此还需要用到apache的两个插件:
  apr、apr-util插件下载地址:
http://apr.apache.org/download.cgi
1.3.先安装apr、apr-util插件,再安装svn源码报。
apr安装(解压等操作略,进入到解压后的目录):
#./configure --prefix=/usr/local/svnversion/apr
#make
#make install
apr-util安装(解压等操作略,进入到解压后的目录):
#./configure --prefix=/usr/local/svnversion/apr-util --with-apr=/usr/local/svnversion/apr
#make
#make install
svnversion安装(解压等操作略,进入到解压后的目录):
#./configure --prefix=/usr/local/svnversion/svn --with-apr=/usr/local/svnversion/apr --with-apr-util=/usr/local/svnversion/apr-util
#make
#make install
到此完成了所有软件的安装。
1.4 svn配置:
进入svn安装目录(/usr/local/svnversion):
首先创建一个工程的版本库:
#cd /usr/local/svnversion
#mkdir projects
#/usr/local/svnversion/svn/bin/svnadmin create projects/test_project
执行以上命令后,在projects目录下会生成一个test_project目录,并且这个目录会有一些svn自动生成的文件或文件夹。
#cd projects/test_project/conf
编辑svnserve.conf文件,找到如下内容:
[general]
### These options control access to the repository for unauthenticated
### and authenticated users.  Valid values are "write", "read",
### 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
### database file.  Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
#password-db = passwd
### The authz-db option controls the location of the authorization
### rules for path-based access control.  Unless you specify a path
### starting with a /, the file's location is relative to the the
### directory containing this file.  If you don't specify an
### authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.
#authz-db = authz
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa.  The default realm
### is repository's uuid.
# realm = My First Repository
修改为:
[general]
### These options control access to the repository for unauthenticated
### and authenticated users.  Valid values are "write", "read",
### 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
### database file.  Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
password-db = passwd
### The authz-db option controls the location of the authorization
### rules for path-based access control.  Unless you specify a path
### starting with a /, the file's location is relative to the the
### directory containing this file.  If you don't specify an
### authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.
authz-db = authz
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa.  The default realm
### is repository's uuid.
# realm = My First Repository
将svnserve.conf保存推出。
再修改该目录下的passwd文件,在该文件的最后追加一条记录,并保存退出:
[users]
# harry = harryssecret
# sally = sallyssecret
linux6 = 111111
之后修改该目录中的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
修改为:### 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
g_svnadmin = linux6
# [/foo/bar]
# harry = rw
# &joe = r
# * =
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
[/]
@g_svnadmin = rw
linux6= rw

到此配置文件修改已完成。
下面启动svn服务:
#/usr/local/subversion/svn/bin/svnserve -d -r /usr/local/subversion/projects/test_project
接下来,只要往svn服务器中导入项目工程就可以使用了,这里我的工程放在/opt/web_project目录下,那么导入命令为:
#/usr/local/subversion/svn/bin/svn import /opt/web_project/
file:///usr/local/subversion/projects/test_project/
-m "Initial import"
其中,-m是添加注释。到此svn客户端就可以访问svn服务器了开始工作了。
java项目一般采用myeclipse进行开发,那么如何在其上集成svn呢,见下:

在线安装svn插件
打开myeslipse的菜单栏 Help-- Find and Install-- 按new Remote Site,
Name填 svn , URL填
http://subclipse.tigris.org/update
,一直next到finished为止
菜单栏 Window-- Show View-- other-- 选择打开SVN目录下的SVN资源库
新建-- 资源库位置, URL填
http://svn.javascud.org/svn/springside/trunk

网速快的话,一会功夫svn就安装完成了。




本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/23251/showart_1851070.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP