Changeset 42c74de for server


Ignore:
Timestamp:
07/18/2004 06:31:59 PM (20 years ago)
Author:
DJ Lucas <dj@…>
Branches:
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
Children:
d7c8734
Parents:
2e35470
Message:

added svnserver instructions

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/other/svnserver.xml

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