微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

CentOS 安装svn服务And eclipse安装svn

1.CentOS系统(Linux系统安装svn)

安装说明
系统环境:CentOS-6.3
安装方式:yum install (源码安装容易产生版本兼容的问题)
安装软件:系统自动下载SVN软件


检查已安装版本
#检查是否安装了低版本的SVN
[root@localhost /]# rpm -qa subversion


#卸载旧版本SVN
[root@localhost modules]# yum remove subversion


安装SVN
[root@localhost modules]# yum install httpd httpd-devel subversion mod_dav_svn mod_auth_MysqL


确认已安装了svn模块
[root@localhost /]# cd /etc/httpd/modules
[root@localhost modules]# ls | grep svn
mod_authz_svn.so
mod_dav_svn.so


验证安装
检验已经安装的SVN版本信息
[root@localhost modules]# svnserve --version


svnserve,版本 1.6.11 (r934486)
编译于 Jun 23 2012,00:44:03
版权所有 (C) 2000-2009 CollabNet。
Subversion 是开放源代码软件,请参阅 http://subversion.tigris.org/ 站点
此产品包含由 CollabNet(http://www.Collab.Net/) 开发的软件。


下列版本库后端(FS) 模块可用:


* fs_base : 模块只能操作BDB版本库。
* fs_fs : 模块与文本文件(FSFS)版本库一起工作。


Cyrus SASL 认证可用。


代码库创建
SVN软件安装完成后还需要建立SVN库
[root@localhost modules]# mkdir -p /opt/svn/repositories
[root@localhost modules]# svnadmin create /opt/svn/repositories
执行上面的命令后,自动建立repositories库,查看/opt/svn/repositories 文件夹发现包含了conf,db,format,hooks,locks,README.txt等文件,说明一个SVN库已经建立。


配置代码
进入上面生成文件夹conf下,进行配置
[root@localhost modules]# cd /opt/svn/repositories/conf


用户密码passwd配置
[root@localhost password]# cd /opt/svn/repositories/conf
[root@admin conf]# vi + passwd
修改passwd为以下内容


[users]
# harry = harryssecret
# sally = sallyssecret
zhoulf=123456
权限控制authz配置
[root@admin conf]# vi + authz
目的是设置哪些用户可以访问哪些目录,向authz文件追加以下内容


#设置[/]代表根目录下所有的资源
[/]
zhoulf=rw
服务svnserve.conf配置
[root@admin conf]# vi + svnserve.conf


追加以下内容


[general]
#匿名访问的权限,可以是read,write,none,认为read
anon-access=none
#使授权用户有写权限
auth-access=write
#密码数据库的路径
password-db=passwd
#访问控制文件
authz-db=authz
#认证命名空间,subversion会在认证提示显示,并且作为凭证缓存的关键字
realm=/opt/svn/repositories
配置防火墙端口
[root@localhost conf]# vi /etc/sysconfig/iptables
添加以下内容
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3690 -j ACCEPT
保存后重启防火墙
[root@localhost conf]# service iptables restart


启动SVN
svnserve -d -r /opt/svn/repositories


查看SVN进程
[root@localhost conf]# ps -ef|grep svn|grep -v grep
root 12538 1 0 14:40 ? 00:00:00 svnserve -d -r /opt/svn/repositories


检测SVN 端口
[root@localhost conf]# netstat -ln |grep 3690
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN


停止重启SVN
[root@localhost password]# killall svnserve //停止
[root@localhost password]# svnserve -d -r /opt/svn/repositories // 启动


安装好的svn服务端,认是不会开机自启动的,每次开机自己启动会很麻烦,我们可以把它设成开机启动
首先:编写一个启动脚本svn_startup.sh,我放在/root/svn_startup.sh
#!/bin/bash
/usr/bin/svnserve -d -r /opt/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


Eclipse安装svn:

通过Eclipse安装

SVN插件下载地址及更新地址,你根据需要选择你需要的版本。现在最新是1.8.x
Links for 1.8.x Release:
Eclipse update site URL: http://subclipse.tigris.org/update_1.8.x
svn插件包下载: http://subclipse.tigris.org/servlets/ProjectDocumentList?folderID=2240


Links for 1.6.x Release:
Eclipse update site URL: http://subclipse.tigris.org/update_1.6.x
svn插件包下载: http://subclipse.tigris.org/servlets/ProjectDocumentList?folderID=2240


Links for 1.4.x Release:
Eclipse update site URL: http://subclipse.tigris.org/update_1.4.x
svn插件包下载: http://subclipse.tigris.org/servlets/ProjectDocumentList?folderID=2240


Linux下需安装如下:

安装subversion-javahl subclipse运用对应的Java库才能发挥作用,这一点挺麻烦的。如果是Ubuntu的Linux,Tigris.org给出了指令。 而我这里安装的CentOS 6.5 版本,也可以很容易解决,运行下列命令就OK了。 sudo yum install subversion-javahl

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。