source: general/prog/svnserver.xml@ 8aeb474

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 7.10 7.4 7.5 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gnome kde5-13430 kde5-14269 kde5-14686 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts krejzi/svn lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition systemd-11177 systemd-13485 trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 8aeb474 was efd03f7, checked in by Bruce Dubbs <bdubbs@…>, 12 years ago

Update CVS/SVN server instructions.

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@10278 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 11.9 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6]>
7
8<sect1 id="svnserver" xreflabel="Running a Subversion Server">
9 <?dbhtml filename="svnserver.html"?>
10
11 <sect1info>
12 <othername>$LastChangedBy$</othername>
13 <date>$Date$</date>
14 </sect1info>
15
16 <title>Running a Subversion Server</title>
17
18 <sect2 role="package">
19 <title>Running a Subversion Server</title>
20
21 <para>This section will describe how to set up, administer and secure
22 a <application>Subversion</application> server.</para>
23
24 <!-- <note>
25 <para>The default build instructions for
26 <application>Subversion</application> disabled the
27 <application>Berkeley DB</application> repository back-end due to the
28 errors encountered in the test suite while building the
29 <xref linkend="subversion"/> package. This should not present a
30 functionality issue as the FSFS repository back-end is now the default,
31 and recommended by the <application>Subversion</application> development
32 team.</para>
33
34 <para>If you have existing repositories based on a
35 <application>Berkeley DB</application> back-end and you followed the
36 BLFS instructions for building <application>Subversion</application>,
37 you'll need to dump the databases, create new repositories using the
38 FSFS back-end, then then reload the data into the new repositories.
39 Instructions for performing these operations can be found at <ulink
40 url="http://svnbook.red-bean.com/en/1.1/ch05s03.html#svn-ch-5-sect-3.5"/>.
41 </para>
42 </note> -->
43
44 <bridgehead renderas="sect3">Subversion Server Dependencies</bridgehead>
45
46 <bridgehead renderas="sect4">Required</bridgehead>
47 <para><xref linkend="subversion"/> and
48 <xref linkend="openssh"/></para>
49
50 </sect2>
51
52 <sect2 role="configuration">
53 <title>Setting up a Subversion Server.</title>
54
55 <para>The following instructions will install a
56 <application>Subversion</application> server, which will be set up
57 to use <application>OpenSSH</application> as the secure remote access
58 method, with <command>svnserve</command> available for anonymous
59 access.</para>
60
61 <para>Configuration of the <application>Subversion</application> server
62 consists of the following steps:</para>
63
64 <sect3>
65 <title>1. Setup Users, Groups, and Permissions</title>
66
67 <para>You'll need to be user
68 <systemitem class='username'>root</systemitem> for the initial portion of
69 configuration. Create the <systemitem class="username">svn</systemitem>
70 user and group with the following commands:</para>
71
72<screen role="root"><userinput>groupadd -g 56 svn &amp;&amp;
73useradd -c "SVN Owner" -d /home/svn -m -g svn -s /bin/false -u 56 svn</userinput></screen>
74
75 <para>If you plan to have multiple repositories, you should have a
76 group dedicated to each repository for ease of administration. Create
77 the <systemitem class="groupname">svntest</systemitem> group for the test
78 repository and add the <systemitem class="username">svn</systemitem>
79 user to that group with the following commands:</para>
80
81<screen role="root"><userinput>groupadd -g 57 svntest &amp;&amp;
82usermod -G svntest -a svn</userinput></screen>
83
84 <para>Additionally you should set <command>umask 002</command> while
85 working with a repository so that all new files will be writable by
86 owner and group. This is made mandatory by creating a wrapper script for
87 <command>svn</command> and <command>svnserve</command>:</para>
88
89<screen role="root"><userinput>mv /usr/bin/svn /usr/bin/svn.orig &amp;&amp;
90mv /usr/bin/svnserve /usr/bin/svnserve.orig &amp;&amp;
91cat &gt;&gt; /usr/bin/svn &lt;&lt; "EOF"
92<literal>#!/bin/sh
93umask 002
94/usr/bin/svn.orig "$@"</literal>
95EOF
96cat &gt;&gt; /usr/bin/svnserve &lt;&lt; "EOF"
97<literal>#!/bin/sh
98umask 002
99/usr/bin/svnserve.orig "$@"</literal>
100EOF
101chmod 0755 /usr/bin/svn{,serve}</userinput></screen>
102
103 <note>
104 <para>If you use <application>Apache</application> for working with
105 the repository over HTTP, even for anonymous access, you should wrap
106 <command>/usr/sbin/httpd</command> in a similar script.</para>
107 </note>
108
109 </sect3>
110
111 <sect3>
112 <title>2. Create a Subversion repository.</title>
113
114 <para>With subversion-1.1.0 and greater, a new type of repository
115 data-store is available, FSFS. There is a tradeoff for speed with
116 the new backend, however, the repository can now be placed on a
117 network mount, and any corruption does not require an admin to
118 recover the repository. For more information and comparison between
119 FSFS and BDB, see <ulink
120 url="http://svnbook.red-bean.com/svnbook-1.1/ch05.html#svn-ch-5-sect-1.2.A"/>.
121 </para>
122
123 <para>Create a new <application>Subversion</application> repository with
124 the following commands:</para>
125
126<screen role="root"><userinput>install -v -m 0755 -d /srv &amp;&amp;
127install -v -m 0755 -o svn -g svn -d /srv/svn/repositories &amp;&amp;
128svnadmin create --fs-type fsfs /srv/svn/repositories/svntest</userinput></screen>
129
130 <para>Now that the repository is created, it should be populated with
131 with something useful. You'll need to have a predefined directory
132 layout set up exactly as you want your repository to look. For
133 example, here is a sample BLFS layout setup with a root of
134 <filename>svntest/</filename>. You'll need to setup a directory
135 tree similar to the following:</para>
136
137<screen><literal>svntest/ # The name of the repository
138 trunk/ # Contains the existing source tree
139 BOOK/
140 bootscripts/
141 edguide/
142 patches/
143 scripts/
144 branches/ # Needed for additional branches
145 tags/ # Needed for tagging release points</literal></screen>
146
147 <para>Once you've created your directory layout as shown above, you
148 are ready to do the initial import:</para>
149
150<screen role="root"><userinput>svn import -m "Initial import." \
151 <replaceable>&lt;/path/to/source/tree&gt;</replaceable> \
152 file:///srv/svn/repositories/svntest</userinput></screen>
153
154 <para>Now change owner and group information on the
155 repository, and add an unprivileged user to the
156 <systemitem class="groupname">svn</systemitem> and
157 <systemitem class="groupname">svntest</systemitem> groups:</para>
158
159<screen role="root"><userinput>chown -R svn:svntest /srv/svn/repositories/svntest &amp;&amp;
160chmod -R g+w /srv/svn/repositories/svntest &amp;&amp;
161chmod g+s /srv/svn/repositories/svntest/db &amp;&amp;
162usermod -G svn,svntest -a <replaceable>&lt;username&gt;</replaceable></userinput></screen>
163
164 <para><systemitem class="groupname">svntest</systemitem> is the group
165 assigned to the svntest repository. As mentioned earlier, this eases
166 administration of multiple repositories when using
167 <application>OpenSSH</application> for authentication. Going forward,
168 you'll need to add your unprivileged user, and any additional users that
169 you wish to have write access to the repository, to the
170 <systemitem class="groupname">svn</systemitem> and
171 <systemitem class="groupname">svntest</systemitem> groups.</para>
172
173 <para>In addition, you'll notice that the new repository's
174 <filename>db</filename> directory is set-groupID. If the reasoning is
175 not immediately obvious, when using any external authentication method
176 (such as <command>ssh</command>), the sticky bit is set so that all
177 new files will be owned by the user, but group of
178 <systemitem class="groupname">svntest</systemitem>. Anyone in the
179 <systemitem class="groupname">svntest</systemitem> group can create
180 files, but still give the entire group write access to those
181 files. This avoids locking out other users from the repository.</para>
182
183 <para>Now, return to an unprivileged user account, and take a
184 look at the new repository using <command>svnlook</command>:</para>
185
186<screen><userinput>svnlook tree /srv/svn/repositories/svntest/</userinput></screen>
187
188 <note>
189 <para>You may need to log out and back in again to refresh your group
190 memberships. '<command>su <replaceable>&lt;username&gt;</replaceable></command>'
191 should work as well.</para>
192 </note>
193
194 </sect3>
195
196 <sect3>
197 <title>3. Configure the Server</title>
198
199 <para>As mentioned previously, these instructions will configure the
200 server to use only <command>ssh</command> for write access to the
201 repository and to provide anonymous access using
202 <command>svnserve</command>. There are several other ways to provide
203 access to the repository. These additional configurations are best
204 explained at <ulink url="http://svnbook.red-bean.com/"/>.</para>
205
206 <para>Access configuration needs to be done for each repository.
207 Create the <filename>svnserve.conf</filename> file for the svntest
208 repository using the following commands:</para>
209
210<screen role="root"><userinput>cp /srv/svn/repositories/svntest/conf/svnserve.conf \
211 /srv/svn/repositories/svntest/conf/svnserve.conf.default &amp;&amp;
212
213cat &gt; /srv/svn/repositories/svntest/conf/svnserve.conf &lt;&lt; "EOF"
214<literal>[general]
215anon-access = read
216auth-access = write</literal>
217EOF</userinput></screen>
218
219 <para>There is not a lot to the configuration file at all. You'll
220 notice that only the general section is required. Take a look at the
221 <filename>svnserve.conf.default</filename> file for information on using
222 <command>svnserve</command>'s built-in authentication method.</para>
223
224 </sect3>
225
226 <sect3 id="svnserver-init">
227 <title>4. Starting the Server</title>
228<!--
229 <para>There are a couple of ways to start <command>svnserve</command>.
230 The most common way is to start it as an <command>inetd</command> or
231 <command>xinetd</command> process. Alternately, you can use a
232 bootscript to start the service at startup.</para>
233
234 <note>
235 <para>If you do not wish to provide anonymous access to your svn
236 repositories or use <command>svnserve</command>'s built-in
237 authentication, you do not need to run
238 <command>svnserve</command>.</para>
239 </note>
240
241 <para>If you use <command>inetd</command>, add a line to
242 <filename>/etc/inetd.conf</filename> using the following
243 commands:</para>
244
245 <indexterm zone="svnserver svnserver-init">
246 <primary sortas="e-etc-inetd.conf">/etc/inetd.conf</primary>
247 </indexterm>
248
249<screen role="root"><userinput>cat &gt;&gt; /etc/inetd.conf &lt;&lt; "EOF"
250<literal>svn stream tcp nowait svn /usr/bin/svnserve svnserve -i</literal>
251EOF</userinput></screen>
252
253 <para>If you use <command>xinetd</command>, the following command will
254 create the <application>Subversion</application> server file as
255 <filename>/etc/xinetd.d/svn</filename>:</para>
256
257 <indexterm zone="svnserver svnserver-init ">
258 <primary sortas="e-etc-xinetd.d-svn">/etc/xinetd.d/svn</primary>
259 </indexterm>
260
261<screen role="root"><userinput>cat &gt;&gt; /etc/xinetd.d/svn &lt;&lt; "EOF"
262<literal># Begin /etc/xinetd.d/svn
263
264service svn
265{
266 port = 3690
267 socket_type = stream
268 protocol = tcp
269 wait = no
270 user = svn
271 server = /usr/bin/svnserve
272 server_args = -i -r /srv/svn/repositories
273}
274
275# End /etc/xinetd.d/svn</literal>
276EOF</userinput></screen> -->
277
278 <para>To start the server at boot time, install the svn bootscript included
279 in the <xref linkend="bootscripts"/> package.</para>
280
281 <indexterm zone="svnserver svnserver-init">
282 <primary sortas="f-svn">svn</primary>
283 </indexterm>
284
285<screen role="root"><userinput>make install-svn</userinput></screen>
286
287 </sect3>
288
289 </sect2>
290
291</sect1>
Note: See TracBrowser for help on using the repository browser.