source: server/other/svnserver.xml@ 01d5424

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 6.0 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 01d5424 was 01d5424, checked in by Randy McMurchy <randy@…>, 20 years ago

Updated to Subversion-1.1.0

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

  • Property mode set to 100644
File size: 9.2 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
3 "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6
7]>
8
9<sect1 id="svnserver" xreflabel="Running a Subversion Server">
10<sect1info>
11<othername>$LastChangedBy$</othername>
12<date>$Date$</date>
13</sect1info>
14<?dbhtml filename="svnserver.html"?>
15<title>Running a Subversion Server</title>
16
17<sect2>
18<title>Running a Subversion Server</title>
19<para>This section will describe how to set up, administer and secure
20a <application>Subversion</application> server.</para>
21
22<sect3><title><application>Subversion server</application> dependencies</title>
23<sect4><title>Required</title>
24<para><xref linkend="subversion"/> and <xref linkend="openssh"/></para>
25</sect4>
26</sect3>
27
28</sect2>
29
30<sect2>
31<title>Setting up a <application>Subversion</application> server.</title>
32
33<para>The following instructions will install a
34<application>Subversion</application> server, which will be set up to
35use <application>OpenSSH</application> as the secure remote access method, with
36<command>svnserve</command> available for anonymous access.</para>
37
38<para>Configuration of the <application>Subversion</application> server
39consists of the following steps:</para>
40
41<sect3><title>1. Setup users, groups, and permissions</title>
42<para>You'll need to be user root for the initial portion of
43configuration. Create the svn user and group with the following
44commands:</para>
45
46<screen><userinput><command>groupadd svn &amp;&amp;
47useradd -c "SVN Owner" -d /home/svn -m -g svn -s /bin/false svn</command></userinput></screen>
48
49<para>If you plan to have multiple repositories, you should have a
50group dedicated to each repository for ease of administration. Create
51the svntest group for the test repository and add the svn user to that
52group with the following commands:</para>
53
54<screen><userinput><command>groupadd svntest &amp;&amp;
55usermod -G svntest svn</command></userinput></screen>
56
57<para>Additionally you should set <command>umask 002</command> while working
58with a repository so that all new files will be writable by owner and group.
59This is made mandatory by creating a wrapper script for
60<command>svn</command> and <command>svnserve</command>:</para>
61
62<screen><userinput><command>mv /usr/bin/svn /usr/bin/svn.orig &amp;&amp;
63mv /usr/bin/svnserve /usr/bin/svnserve.orig &amp;&amp;
64cat &gt;&gt; /usr/bin/svn &lt;&lt; "EOF" &amp;&amp;</command>
65#!/bin/sh
66umask 002
67/usr/bin/svn.orig "$@"
68<command>EOF
69cat &gt;&gt; /usr/bin/svnserve &lt;&lt; "EOF" &amp;&amp;</command>
70#!/bin/sh
71umask 002
72/usr/bin/svnserve.orig "$@"
73<command>EOF
74chmod 0755 /usr/bin/svn{,serve}</command></userinput></screen>
75
76<note><para>If you use <application>Apache</application> for working with
77the repository over <acronym>HTTP</acronym>, even for anonymous access, you
78should wrap <command>/usr/sbin/httpd</command> in a similar
79script.</para></note>
80
81</sect3>
82
83<sect3><title>2. Create a <application>Subversion</application>
84repository.</title>
85<para>Create a new <application>Subversion</application> repository with
86the following commands:</para>
87
88<screen><userinput><command>install -d -m0755 /srv &amp;&amp;
89install -d -m0755 -o svn -g svn /srv/svn/repositories &amp;&amp;
90svnadmin create /srv/svn/repositories/svntest</command></userinput></screen>
91
92<para>Now that the repository is created, we need to populate it with
93something useful. You'll need to have a predefined directory layout
94setup exactly as you want your repository to look. For example, here
95is a sample BLFS layout setup with a root of <filename>svntest/</filename>.
96You'll need to setup a directory tree similar to the following:</para>
97
98<screen> svntest/ # The name of the repository
99 trunk/ # Contains the existing source tree
100 BOOK/
101 bootscripts/
102 edguide/
103 patches/
104 scripts/
105 branches/ # Needed for additional branches
106 tags/ # Needed for tagging release points</screen>
107
108<para>Once you've created your directory layout as shown above, you are ready
109to do the initial import:</para>
110
111<screen><userinput><command>svn import -m "Initial import." \
112 <replaceable>[/path/to/source/tree]</replaceable> \
113 file:///srv/svn/repositories/svntest</command></userinput></screen>
114
115<para>Now go ahead and change owner and group information on the
116repository, and add your normal user to the svn and svntest groups:</para>
117
118<screen><userinput><command>chown -R svn:svntest /srv/svn/repositories/svntest &amp;&amp;
119chmod -R g+w /srv/svn/repositories/svntest &amp;&amp;
120chmod g+s /srv/svn/repositories/svntest/db &amp;&amp;
121usermod -G svn,svntest,<replaceable>[insert existing groups]</replaceable> <replaceable>[username]</replaceable></command></userinput></screen>
122
123<para>svntest is the group assigned to the svntest repository. As
124mentioned earlier, this eases administration of multiple repositories
125when using <application>OpenSSH</application> for authentication. Going
126forward, you'll need to add your regular user, and any additional users
127that you wish to have write access to the repository, to the svn and
128svntest groups.</para>
129
130<para>In addition, you'll notice that the new repository's
131<filename>db</filename> directory is set-groupID. If the reasoning is
132not immediately obvious, when using any external authentication method
133(such as <command>ssh</command>), the sticky bit is set so that all new files
134will be owned by the user, but group of svntest. Anyone in the svntest group
135can create files, but still give the entire group write access to those
136files. This avoids locking out other users from the repository.</para>
137
138<para>Now, go ahead and return to your normal user account, and take a look at
139your new repository using <command>svnlook</command>:</para>
140
141<screen><userinput><command>svnlook tree /srv/svn/repositories/svntest/</command></userinput></screen>
142
143<note><para>You may need to log out and back in again to refresh your group
144memberships. '<command>su <replaceable>[username]</replaceable></command>'
145should work around this as well.</para></note>
146
147</sect3>
148
149<sect3><title>3. Configure the server</title>
150
151<para>As mentioned previously, these instructions will configure the
152server to use only <command>ssh</command> for write access to the repository
153and to provide anonymous access using <command>svnserve</command>. There are
154several other ways to provide access to the repository. These additional
155configurations are best explained at
156<ulink url="http://svnbook.red-bean.com/"/>.</para>
157
158<para>Access configuration needs to be done for each repository. Create
159the <filename>svnserve.conf</filename> file for the svntest repository
160using the following commands:</para>
161
162<screen><userinput><command>cp /srv/svn/repositories/svntest/conf/svnserve.conf \
163 /srv/svn/repositories/svntest/conf/svnserve.conf.default &amp;&amp;
164cat &gt; /srv/svn/repositories/svntest/conf/svnserve.conf &lt;&lt; "EOF"</command>
165[general]
166anon-access = read
167auth-access = write
168<command>EOF</command></userinput></screen>
169
170<para>There is not a lot to the configuration file at all. You'll notice
171that only the general section is required. Take a look at the
172<filename>svnserve.conf.default</filename> file for information on using
173<command>svnserve</command>'s built-in authentication method.</para>
174
175</sect3>
176
177<sect3><title>4. Starting the server</title>
178<para>There are a couple of ways to start <command>svnserve</command>. The
179most common way is to start it as an <command>inetd</command> or
180<command>xinetd</command> process. Alternately, you can use a
181bootscript to start the service at startup.</para>
182
183<note><para>If you do not wish to provide anonymous access to your svn
184repositories or use <command>svnserve</command>'s built-in
185authentication, you do not need to run
186<command>svnserve</command>.</para></note>
187
188<para>If you use <command>inetd</command>, add a line to
189<filename>/etc/inetd.conf</filename> using the following commands:</para>
190
191<screen><userinput><command>cat &gt;&gt; /etc/inetd.conf &lt;&lt; "EOF"</command>
192svn stream tcp nowait svn /usr/bin/svnserve svnserve -i
193<command>EOF</command></userinput></screen>
194
195<para>If you use <command>xinetd</command>, add the following
196lines to the <filename>/etc/xinetd.conf</filename> file:</para>
197
198<screen><userinput><command>cat &gt;&gt; /etc/xinetd.conf &lt;&lt; "EOF"</command>
199service svn
200{
201 port = 3690
202 socket_type = stream
203 protocol = tcp
204 wait = no
205 user = svn
206 server = /usr/bin/svnserve
207 server_args = -i -r /srv/svn/repositories
208}
209<command>EOF</command></userinput></screen>
210
211<para>Finally, if you wish to simply start the sever in daemon mode at
212startup, install the svn bootscript included in the
213<xref linkend="intro-important-bootscripts"/> package.</para>
214
215<screen><userinput><command>make install-svn</command></userinput></screen>
216
217</sect3>
218
219</sect2>
220
221</sect1>
222
Note: See TracBrowser for help on using the repository browser.