svn搭建http、https访问

svn搭建http、https访问 &Visual SVN

http访问

[root@svn /]# yum install httpd mod_dav_svn subversion mod_ssl openssl
[root@svn /]#  htpasswd -c /svn/passwd svn  #创建apache登陆的用户svn
[root@svn /]# mkdir -p  /svn/data
[root@svn /]# svnadmin create  /svn/data
[root@svn /]# vi /etc/httpd/conf.d/svn.conf
<Location /svn>
	DAV svn
	SVNParentPath /svn
	AuthType Basic
	AuthName "svn"
	AuthUserFile /svn/passwd
	AuthzSVNAccessFile /svn/auth.conf
	Require valid-user
</Location>
[root@svn /]# vi /svn/auth.conf
[groups]
admin = svn
[/]
svn=rw
[root@svn /]# chown -R apache:apache /svn/data
[root@svn /]# systemctl start httpd
[root@svn /]# svnserve -d -r /svn/data/

http://IP地址/svn/data    #弹出登陆界面登陆,显示

开机启动

[root@svn /]# vim /etc/sysconfig/svnserve
OPTIONS="-rd /svn/data"
[root@svn /]# systemctl enable svnserve.service
[root@svn /]# systemctl enable httpd

配置https访问

[root@svn /]# cd /svn/
[root@svn svn]# openssl genrsa -out httpd.key 1024
[root@svn svn]# openssl req -new -key httpd.key -out httpd.pem -days 3650 -x509
[root@svn svn]# ls
auth.conf  data  httpd.key  httpd.pem  passwd
[root@svn svn]# vi /etc/httpd/conf.d/ssl.conf
...
SSLCertificateFile /svn/httpd.pem
SSLCertificateKeyFile /svn/httpd.key
...
[root@svn svn]# vim /etc/httpd/conf.d/svn.conf
<Location /svn>
	DAV svn
	SVNParentPath /svn
	AuthType Basic
	AuthName "svn"
	AuthUserFile /svn/passwd
	AuthzSVNAccessFile /svn/auth.conf
	Require valid-user
	SSLRequireSSL     #添加此行
</Location>
[root@svn /]# systemctl restart httpd

https://IP地址/svn/data    #弹出登陆界面登陆,显示

备份迁移了解

svnadmin dump /svn/data > full.svn.bak 

svnadmin create /svn/repo1
cd /svn/repo1
svnadmin load repo1 < full.svn.bak 

原始端口访问

[root@svn /]# yum -y install subversion
[root@svn /]# mkdir -p /data/svn/repo
[root@svn /]# svnadmin create  /data/svn/repo
[root@svn /]# cd /data/svn/repo/conf
[root@svn conf]# vi passwd   #创建用户名密码
[users]
hello=world

[root@svn conf]# vi  authz   #配置访问用户及权限
...
[/]
hello = rw
[root@svn conf]# vi svnserve.conf   #服务读取配置
...
[general]
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz
realm = /data/svn/repo
...

[root@svn conf]# svnserve -d -r /data/svn/repo  --listen-port=3690

#配置开机启动
[root@svn conf]# ps -ef | grep svn
root       185     0  0 06:11 ?        00:00:00 svnserve -d -r /data/svn/repo --listen-port=3690
root       211    85  0 06:23 pts/0    00:00:00 grep --color=auto svn
[root@svn conf]# kill -9  185
[root@svn conf]# vi  /etc/sysconfig/svnserve
OPTIONS="-d  -r /data/svn/repo"    #创建的仓库目录
[root@svn conf]# systemctl enable svnserve.service  --now
[root@svn conf]# systemctl status svnserve.service


#优化调整  更改authz和passwd文件时则不需要重启服务。

[root@8c916fc1e525 conf]# vi passwd
[users]

hello=123
admin1 = 123456
admin2 = 123456
test1 = 123456
test2 = 123456

[root@8c916fc1e525 conf]# vim authz
...
[groups]
admin = admin1,admin2
test = test1,test2

[/]
hello = rw
@admin = rw     #群组使用
@test = r      #test组不能修改文件           #访问控制实际测试并没有实现,待真实需求时了解
* = r

Visual SVN Server windows的企业级svn,下载安装即可,暂时不深入研究

你可能感兴趣的:(http,svn,https)