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

systemd-13485
Last change on this file since 8cf08a11 was 8cf08a11, checked in by DJ Lucas <dj@…>, 8 years ago

Remove -systemd nameing for xml files and move entities to packages.ent for Chapter 13

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/branches/systemd@16858 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 11.7 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 </sect3>
85
86 <sect3>
87 <title>2. Create a Subversion repository.</title>
88
89 <para>With subversion-1.1.0 and greater, a new type of repository
90 data-store is available, FSFS. There is a tradeoff for speed with
91 the new backend, however, the repository can now be placed on a
92 network mount, and any corruption does not require an admin to
93 recover the repository. For more information and comparison between
94 FSFS and BDB, see <ulink
95 url="http://svnbook.red-bean.com/svnbook-1.1/ch05.html#svn-ch-5-sect-1.2.A"/>.
96 </para>
97
98 <para>Create a new <application>Subversion</application> repository with
99 the following commands:</para>
100
101<screen role="root"><userinput>install -v -m 0755 -d /srv/svn &amp;&amp;
102install -v -m 0755 -o svn -g svn -d /srv/svn/repositories &amp;&amp;
103svnadmin create --fs-type fsfs /srv/svn/repositories/svntest</userinput></screen>
104
105 <para>Now that the repository is created, it should be populated with
106 with something useful. You'll need to have a predefined directory
107 layout set up exactly as you want your repository to look. For
108 example, here is a sample BLFS layout setup with a root of
109 <filename>svntest/</filename>. You'll need to setup a directory
110 tree similar to the following:</para>
111
112<screen><literal>svntest/ # The name of the repository
113 trunk/ # Contains the existing source tree
114 BOOK/
115 bootscripts/
116 edguide/
117 patches/
118 scripts/
119 branches/ # Needed for additional branches
120 tags/ # Needed for tagging release points</literal></screen>
121
122 <para>Once you've created your directory layout as shown above, you
123 are ready to do the initial import:</para>
124
125<screen role="root"><userinput>svn import -m "Initial import." \
126 <replaceable>&lt;/path/to/source/tree&gt;</replaceable> \
127 file:///srv/svn/repositories/svntest</userinput></screen>
128
129 <para>Now change owner and group information on the
130 repository, and add an unprivileged user to the
131 <systemitem class="groupname">svn</systemitem> and
132 <systemitem class="groupname">svntest</systemitem> groups:</para>
133
134<screen role="root"><userinput>chown -R svn:svntest /srv/svn/repositories/svntest &amp;&amp;
135chmod -R g+w /srv/svn/repositories/svntest &amp;&amp;
136chmod g+s /srv/svn/repositories/svntest/db &amp;&amp;
137usermod -G svn,svntest -a <replaceable>&lt;username&gt;</replaceable></userinput></screen>
138
139 <para><systemitem class="groupname">svntest</systemitem> is the group
140 assigned to the svntest repository. As mentioned earlier, this eases
141 administration of multiple repositories when using
142 <application>OpenSSH</application> for authentication. Going forward,
143 you'll need to add your unprivileged user, and any additional users that
144 you wish to have write access to the repository, to the
145 <systemitem class="groupname">svn</systemitem> and
146 <systemitem class="groupname">svntest</systemitem> groups.</para>
147
148 <para>In addition, you'll notice that the new repository's
149 <filename>db</filename> directory is set-groupID. If the reasoning is
150 not immediately obvious, when using any external authentication method
151 (such as <command>ssh</command>), the sticky bit is set so that all
152 new files will be owned by the user, but group of
153 <systemitem class="groupname">svntest</systemitem>. Anyone in the
154 <systemitem class="groupname">svntest</systemitem> group can create
155 files, but still give the entire group write access to those
156 files. This avoids locking out other users from the repository.</para>
157
158 <para>Now, return to an unprivileged user account, and take a
159 look at the new repository using <command>svnlook</command>:</para>
160
161<screen><userinput>svnlook tree /srv/svn/repositories/svntest/</userinput></screen>
162
163 <note>
164 <para>You may need to log out and back in again to refresh your group
165 memberships. '<command>su <replaceable>&lt;username&gt;</replaceable></command>'
166 should work as well.</para>
167 </note>
168
169 </sect3>
170
171 <sect3>
172 <title>3. Configure the Server</title>
173
174 <para>As mentioned previously, these instructions will configure the
175 server to use only <command>ssh</command> for write access to the
176 repository and to provide anonymous access using
177 <command>svnserve</command>. There are several other ways to provide
178 access to the repository. These additional configurations are best
179 explained at <ulink url="http://svnbook.red-bean.com/"/>.</para>
180
181 <para>Access configuration needs to be done for each repository.
182 Create the <filename>svnserve.conf</filename> file for the svntest
183 repository using the following commands:</para>
184
185<screen role="root"><userinput>cp /srv/svn/repositories/svntest/conf/svnserve.conf \
186 /srv/svn/repositories/svntest/conf/svnserve.conf.default &amp;&amp;
187
188cat &gt; /srv/svn/repositories/svntest/conf/svnserve.conf &lt;&lt; "EOF"
189<literal>[general]
190anon-access = read
191auth-access = write</literal>
192EOF</userinput></screen>
193
194 <para>There is not a lot to the configuration file at all. You'll
195 notice that only the general section is required. Take a look at the
196 <filename>svnserve.conf.default</filename> file for information on using
197 <command>svnserve</command>'s built-in authentication method.</para>
198
199 </sect3>
200
201 <sect3 id="svnserver-init">
202 <title>4. Starting the Server</title>
203<!--
204 <para>There are a couple of ways to start <command>svnserve</command>.
205 The most common way is to start it as an <command>inetd</command> or
206 <command>xinetd</command> process. Alternately, you can use a
207 bootscript to start the service at startup.</para>
208
209 <note>
210 <para>If you do not wish to provide anonymous access to your svn
211 repositories or use <command>svnserve</command>'s built-in
212 authentication, you do not need to run
213 <command>svnserve</command>.</para>
214 </note>
215
216 <para>If you use <command>inetd</command>, add a line to
217 <filename>/etc/inetd.conf</filename> using the following
218 commands:</para>
219
220 <indexterm zone="svnserver svnserver-init">
221 <primary sortas="e-etc-inetd.conf">/etc/inetd.conf</primary>
222 </indexterm>
223
224<screen role="root"><userinput>cat &gt;&gt; /etc/inetd.conf &lt;&lt; "EOF"
225<literal>svn stream tcp nowait svn /usr/bin/svnserve svnserve -i</literal>
226EOF</userinput></screen>
227
228 <para>If you use <command>xinetd</command>, the following command will
229 create the <application>Subversion</application> server file as
230 <filename>/etc/xinetd.d/svn</filename>:</para>
231
232 <indexterm zone="svnserver svnserver-init ">
233 <primary sortas="e-etc-xinetd.d-svn">/etc/xinetd.d/svn</primary>
234 </indexterm>
235
236<screen role="root"><userinput>cat &gt;&gt; /etc/xinetd.d/svn &lt;&lt; "EOF"
237<literal># Begin /etc/xinetd.d/svn
238
239service svn
240{
241 port = 3690
242 socket_type = stream
243 protocol = tcp
244 wait = no
245 user = svn
246 server = /usr/bin/svnserve
247 server_args = -i -r /srv/svn/repositories
248}
249
250# End /etc/xinetd.d/svn</literal>
251EOF</userinput></screen> -->
252
253 <para>
254 To start the <command>svnserve</command> daemon at boot,
255 install the systemd unit from the <xref linkend="bootscripts"/>
256 package by running the following command as the
257 <systemitem class="username">root</systemitem> user:
258 </para>
259
260 <indexterm zone="svnserver svnserver-init">
261 <primary sortas="f-svnserve">svnserve</primary>
262 </indexterm>
263
264<screen role="root"><userinput>make install-svnserve</userinput></screen>
265
266 <para>Additionally, the instructions above require that svn server
267 uses <command>umask 002</command> so that all new files will
268 be writable by owner and group. This can be achieved by creating
269 a systemd unit override file by running the following command:</para>
270
271<screen role="root"><userinput>mkdir -p /etc/systemd/system/svnserve.service.d
272echo "UMask=0002" > /etc/systemd/system/svnserve.service.d/99-user.conf</userinput></screen>
273
274 <para>Options which are passed to <command>svnserve</command> daemon
275 can be changed in <filename>/etc/default/svnserve</filename>.</para>
276
277 </sect3>
278
279 </sect2>
280
281</sect1>
Note: See TracBrowser for help on using the repository browser.