Centos7 安装svn服务器
1. 安装软件包
需要安装下面的包来搭建svn服务器,mod_dav_svn是一个apache的一个模块,来整合svn服务器 yum install httpd subversion mod_dav_svn
systemctlenable httpd.service //设置开机自动启动 systemctlstart httpd.service //启动apache
systemctl restart httpd.service //重新启动apache
如果开启了SELinux,还需要下面的设置
chcon -R -t httpd_sys_content_t /var/www/svn/repo chcon -R -t httpd_sys_rw_content_t /var/www/svn/repo
And open the http and https ports in the firewall
firewall-cmd –permanent –zone=public –add-service=http firewall-cmd –permanent –zone=public –add-service=https firewall-cmd –reload
2. 配置svn服务器
创建svn的仓库目录及配置文件目录 mkdir /home/svnroot cd/home/svnroot mkdirconf
mkdirrepository
创建用户
htpasswd -cm /home/svnroot/conf/svn-auth-users.confyanyt htpasswd -m /home/svnroot/conf/svn-auth-users.confmafy htpasswd -m /home/svnroot/conf/svn-auth-users.confwangwei
创建第一个项目仓库
svnadmin create /home/svnroot/repository/testone 设置目录的属主
chown -R apache.apache /home/svnroot/repository/testone
创建第二个项目仓库
svnadmin create /home/svnroot/repository/testtwo
chown -R apache.apache /home/svnroot/repository/testtwo 设置用户对项目的访问权限
touch /home/svnroot/conf/svn-auth-access.conf
vi/home/svnroot/conf/svn-auth-access.conf
[groups]
#
admin=yanyt
#[
#@
#
#指定用户组成员可以读写根目录所有应用 @admin = rw
[testone:/] wangwei=rw [testtwo:/] mafy=rw
用户yanyt可以访问所有的项目 用户wangwei可以访问testone项目 用户mafy可以访问testtwo项目
编辑10-subversion.conf文件
vi /etc/httpd/conf.modules.d/10-subversion.conf
LoadModuledav_svn_module modules/mod_dav_svn.so LoadModuleauthz_svn_module modules/mod_authz_svn.so LoadModuledontdothat_module modules/mod_dontdothat.so
#增加下面的内容
DAV svn
#SVNListParentPath on
#如果你想对每个项目单独配置,使用该项
#SVNPath /home/svnroot/repository/project1
#设定一个根,所有项目均放在此目录下
SVNParentPath /home/svnroot/repository
SVNPathAuthzshort_circuit
SVNCacheTextDeltas off
SVNCacheFullTexts off
AuthType Basic
AuthBasicProvider file
AuthName \
AuthUserFile /home/svnroot/conf/svn-auth-users.conf
AuthzSVNAccessFile /home/svnroot/conf/svn-auth-access.conf
#AuthGroupFile /home/svnroot/conf/groups.conf
Require valid-user
重新启动apache服务器
systemctl restart httpd.service //重新启动apache
3. 关闭防火墙
CentOS 7.0默认使用的是firewall作为防火墙,使用iptables必须重新设置一下
1、直接关闭防火墙
systemctl stopfirewalld.service #停止firewall
systemctldisable firewalld.service #禁止firewall开机启动
2、设置iptables service
yum -y install iptables-services
如果要修改防火墙配置,如增加防火墙端口3306
vi /etc/sysconfig/iptables
增加规则
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
保存退出后
4. 测试
用svn客户端进行测试
项目仓库地址:
http://192.168.1.221/svn/repos/testone/ http://192.168.1.221/svn/repos/testtwo/
用户yanyt可以访问所有的项目 用户wangwei可以访问testone项目 用户mafy可以访问testtwo项目
5. 其他
增加用户
htpasswd -m /etc/svn-auth-confsvnphpdev 增加用户名为svnphpdev的账号
删除用户
htpasswd -D /etc/svn-auth-confsvnsimzongyh 删除用户名为svnsimzongyh的账号
修改密码(先删除,再增加,并没有直接修改密码的指令)
htpasswd -D /etc/svn-auth-confsvnuuudao
htpasswd -b /etc/svn-auth-confsvnuuudao uuyy65erc2
SVN服务器更改ip地址客户端怎么设置
1. 如果客户端工具是TortoiseSVN,直接在工作副本上右键,选择TortoiseSVN->relocation,再输入新的URL。
2. 如果netbeans,选择项目右键,选择Subverion->工作副本->重新定位