Projekt

Allgemein

Profil

Setup svn » Historie » Version 4

Jeremias Keihsler, 12.01.2017 14:29

1 1 Jeremias Keihsler
h1. Install SVN-Server
2
3
h2. Requirements
4
5 2 Jeremias Keihsler
To install svn you will need the following:
6 1 Jeremias Keihsler
* a installed and supported operating system (e.g. CentOS 7.x)
7
* root-access
8
* a fast internet connection
9
10
h2. Preliminary note
11
12
most of this is taken from 
13
* [[http://www.if-not-true-then-false.com/2010/install-svn-subversion-server-on-fedora-centos-red-hat-rhel/]]
14
* [[http://www.petefreitag.com/item/665.cfm]]
15
16
* setup rules-file [[http://www.startupcto.com/server-tech/subversion/locking-a-branch-in-svn]]
17
* @ssh+svn@ may be taken from [[http://www.startupcto.com/server-tech/subversion/setting-up-svn]]
18
This procedure is for a vanilla OS, if @Apache@ is already installed and configured you may have to rethink the configuration.
19
20
h2. Install
21
22
<pre><code class="bash">
23
yum install mod_dav_svn subversion
24
</code></pre>
25
26
h2. Configuration
27
28
h3. /etc/http/conf.d/subversion.conf
29
30
modify the preinstalled @etc/http/conf.d/subversion.conf@ analogue to
31
<pre>
32
LoadModule dav_svn_module     modules/mod_dav_svn.so
33
LoadModule authz_svn_module   modules/mod_authz_svn.so
34
 
35
<Location /svn>
36
   DAV svn
37
   SVNParentPath /var/www/svn
38
   AuthType Basic
39
   AuthName "Subversion repositories"
40
   AuthUserFile /etc/svn-auth-users
41
   AuthzSVNAccessFile  /etc/svn-authz-users
42
   Require valid-user
43
</Location>
44
</pre>
45
46
h3. Add SVN users
47
48
* first-time usage
49
<pre><code class="bash">
50
htpasswd -cm /etc/svn-auth-users testuser
51
</code></pre>
52
* follow up usage
53
<pre><code class="bash">
54
htpasswd -m /etc/svn-auth-users testuser
55
</code></pre>
56
Note: Use exactly same file and path name as used on @subversion.conf@ file. This example use @/etc/svn-auth-users@ file.
57
58
h3. Create SVN repository
59
60
<pre><code class="bash">
61
mkdir /var/www/svn
62
cd /var/www/svn
63
 
64
svnadmin create testrepo
65
chown -R apache:apache testrepo
66
 
67
chcon -R -t httpd_sys_content_t /var/www/svn/testrepo
68
</code></pre>
69
Following enables commits over http
70
<pre><code class="bash">
71
chcon -R -t httpd_sys_rw_content_t /var/www/svn/testrepo
72
</code></pre>
73
74
h3. Configure SVN repository
75
76
To *disable anonymous access* and enable *access control* add following rows to @testrepo/conf/svnserve.conf@
77
<pre>
78
## Disable anonymous access ##
79
anon-access = none
80
 
81
## Enable access control ##
82
authz-db = authz
83
</pre>
84
85
h3. Create trunk, branches and tags structure under testrepo
86
87
Create “template” directories with following command:
88
<pre><code class="bash">
89
mkdir -p /tmp/svn-structure-template/{trunk,branches,tags}
90
</code></pre>
91
Then import template to project repository using @svn import@ command:
92
<pre><code class="bash">
93
svn import -m 'Initial import' /tmp/svn-structure-template/ http://localhost/svn/testrepo/
94
</code></pre>
95
96
h3. Setup User/Repo based access control
97
98
Create “template” directories with following command:
99
<pre><code class="bash">
100
vim /etc/svn-authz-users
101
</code></pre>
102
Then import template to project repository using @svn import@ command:
103
<pre>
104
# Allow full access to all repos
105
[/]
106
* = 
107
master = rw
108
109
[homepage:/]
110
* =
111
master = rw
112
external_chk = r
113
114
# Lock MyRepo Branch_A
115
# Note that you only need the MyRepo: prefix if you have more than one repo
116
[janus:/z_Deploy]
117
* = r
118
master = rw
119
120
[janus:/11002]
121
* = r
122
master = rw
123
developer = rw
124
125
[ATX_Neuenstein:/]
126
* = 
127
master = rw
128
client = r
129
130
# Lock all tags in all repos; only allow 'master' to create new tags.
131
[/tags]
132
* = r
133
master = rw
134
135
</pre>
136
137
h2. Usage
138
139
open in your browser
140
<pre><code class="bash">
141
http://localhost/svn/testrepo/
142
</code></pre>
143
144
h2. SSL secured web-server
145
146
see also http://wiki.centos.org/HowTos/Https
147
148
h2. Backup/Restore SVN repositories
149
150 3 Jeremias Keihsler
[[dw_dr:SVN16| Backup/Restore SVN]]