source: server/other/svnserver.xml@ a0f03b0

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 a0f03b0 was a0f03b0, checked in by Archaic <archaic@…>, 20 years ago

Inserting sect1info

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

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