source: server/other/svnserver.xml@ b785ab29

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 6.1 6.2 6.2.0 6.2.0-rc1 6.2.0-rc2 6.3 6.3-rc1 6.3-rc2 6.3-rc3 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 b785ab29 was b785ab29, checked in by Bruce Dubbs <bdubbs@…>, 19 years ago

Integrated system uid and gid values

into individual packages.

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

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