<p>I have a laptop running Ubuntu that I would like to act as a Subversion server. Both for myself to commit to locally, and for others remotely. What are the steps required to get this working? Please include steps to:</p>

<ul>
<li>Get and configure Apache, and necessary modules (I know there are other ways to create a SVN server, but I would like it Apache-specific)</li>
<li>Configure a secure way of accessing the server (SSH/HTTPS)</li>
<li>Configure a set of authorised users (as in, they must authorised to commit, but are free to browse)</li>
<li>Validate the setup with an initial commit (a "Hello world" of sorts)</li>
</ul>

<p>These steps can involve any mixture of command line or GUI application instructions. If you can, please note where instructions are specific to a particular distribution or version, and where a users' choice of a particular tool can be used instead (say, <a href="https://en.wikipedia.org/wiki/GNU_nano" rel="noreferrer">nano</a> instead of <a href="http://en.wikipedia.org/wiki/Vi" rel="noreferrer">vi</a>).</p>

[{'answer_id': 60741, 'author': 'UnkwnTech', 'author_id': 115, 'author_profile': 'https://Stackoverflow.com/users/115', 'pm_score': -1, 'selected': False, 'text': "<p>For Apache:</p>\n\n<pre><code>sudo apt-get -yq install apache2\n</code></pre>\n\n<p>For SSH:</p>\n\n<pre><code>sudo apt-get -yq install openssh-server\n</code></pre>\n\n<p>For Subversion:</p>\n\n<pre><code>sudo apt-get -yq install subversion subversion-tools\n</code></pre>\n\n<p>If you'd like you can combine these into one command like:</p>\n\n<pre><code>sudo apt-get -yq install apache2 openssh-server subversion subversion-tools\n</code></pre>\n\n<p>I can't help with the rest...</p>\n"}, {'answer_id': 60792, 'author': 'Grundlefleck', 'author_id': 4120, 'author_profile': 'https://Stackoverflow.com/users/4120', 'pm_score': 8, 'selected': True, 'text': '<p>Steps I\'ve taken to make my laptop a Subversion server. Credit must go to <a href="http://alephzarro.com/blog/" rel="noreferrer">AlephZarro</a> for his directions <a href="http://alephzarro.com/blog/2007/01/07/installation-of-subversion-on-ubuntu-with-apache-ssl-and-basicauth/" rel="noreferrer">here</a>. I now have a working SVN server (which has currently only been tested locally).</p>\n\n<p>Specific setup:\n    Kubuntu 8.04 Hardy Heron</p>\n\n<p>Requirements to follow this guide:</p>\n\n<ul>\n<li>apt-get package manager program</li>\n<li>text editor (I use kate)</li>\n<li>sudo access rights</li>\n</ul>\n\n<p>1: Install Apache HTTP server and required modules:</p>\n\n<pre><code>sudo apt-get install libapache2-svn apache2\n</code></pre>\n\n<p>The following extra packages will be installed:</p>\n\n<pre><code>apache2-mpm-worker apache2-utils apache2.2-common\n</code></pre>\n\n<p>2: Enable SSL</p>\n\n<pre><code>sudo a2enmod ssl\nsudo kate /etc/apache2/ports.conf\n</code></pre>\n\n<p>Add or check that the following is in the file:</p>\n\n<pre><code>&lt;IfModule mod_ssl.c&gt;\n    Listen 443\n&lt;/IfModule&gt;\n</code></pre>\n\n<p>3: Generate an SSL certificate:</p>\n\n<pre><code>sudo apt-get install ssl-cert\nsudo mkdir /etc/apache2/ssl\nsudo /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem\n</code></pre>\n\n<p>4: Create virtual host</p>\n\n<pre><code>sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/svnserver\nsudo kate /etc/apache2/sites-available/svnserver\n</code></pre>\n\n<p>Change (in ports.conf):</p>\n\n<pre><code>"NameVirtualHost *" to "NameVirtualHost *:443"\n</code></pre>\n\n<p>and (in svnserver)</p>\n\n<pre><code>&lt;VirtualHost *&gt; to &lt;VirtualHost *:443&gt;\n</code></pre>\n\n<p>Add, under ServerAdmin (also in file svnserver):</p>\n\n<pre><code>SSLEngine on\nSSLCertificateFile /etc/apache2/ssl/apache.pem\nSSLProtocol all\nSSLCipherSuite HIGH:MEDIUM\n</code></pre>\n\n<p>5: Enable the site:</p>\n\n<pre><code>sudo a2ensite svnserver\nsudo /etc/init.d/apache2 restart\n</code></pre>\n\n<p>To overcome warnings:</p>\n\n<pre><code>sudo kate /etc/apache2/apache2.conf\n</code></pre>\n\n<p>Add:</p>\n\n<pre><code>"ServerName $your_server_name"\n</code></pre>\n\n<p>6: Adding repository(ies):\nThe following setup assumes we want to host multiple repositories.\nRun this for creating the first repository:</p>\n\n<pre><code>sudo mkdir /var/svn\n\nREPOS=myFirstRepo\nsudo svnadmin create /var/svn/$REPOS\nsudo chown -R www-data:www-data /var/svn/$REPOS\nsudo chmod -R g+ws /var/svn/$REPOS\n</code></pre>\n\n<p>6.a. For more repositories: do step 6 again (changing the value of REPOS), skipping the step <code>mkdir /var/svn</code></p>\n\n<p>7: Add an authenticated user</p>\n\n<pre><code>sudo htpasswd -c -m /etc/apache2/dav_svn.passwd $user_name\n</code></pre>\n\n<p>8: Enable and configure WebDAV and SVN:</p>\n\n<pre><code>sudo kate /etc/apache2/mods-available/dav_svn.conf\n</code></pre>\n\n<p>Add or uncomment:</p>\n\n<pre><code>&lt;Location /svn&gt;\nDAV svn\n\n# for multiple repositories - see comments in file\nSVNParentPath /var/svn\n\nAuthType Basic\nAuthName "Subversion Repository"\nAuthUserFile /etc/apache2/dav_svn.passwd\nRequire valid-user\nSSLRequireSSL\n&lt;/Location&gt;\n</code></pre>\n\n<p>9: Restart apache server:</p>\n\n<pre><code>sudo /etc/init.d/apache2 restart\n</code></pre>\n\n<p>10: Validation:</p>\n\n<p>Fired up a browser:</p>\n\n<pre><code>http://localhost/svn/$REPOS\nhttps://localhost/svn/$REPOS\n</code></pre>\n\n<p>Both required a username and password. I think uncommenting:</p>\n\n<pre><code>&lt;LimitExcept GET PROPFIND OPTIONS REPORT&gt;\n\n&lt;/LimitExcept&gt;\n</code></pre>\n\n<p>in <code>/etc/apache2/mods-available/dav_svn.conf</code>, would allow anonymous browsing. </p>\n\n<p>The browser shows "Revision 0: /"</p>\n\n<p>Commit something:</p>\n\n<pre><code>svn import --username $user_name anyfile.txt https://localhost/svn/$REPOS/anyfile.txt -m “Testing”\n</code></pre>\n\n<p>Accept the certificate and enter password.\nCheck out what you\'ve just committed:</p>\n\n<pre><code>svn co --username $user_name https://localhost/svn/$REPOS\n</code></pre>\n\n<p>Following these steps (assuming I haven\'t made any error copy/pasting), I had a working SVN repository on my laptop.</p>\n'}, {'answer_id': 3329059, 'author': 'PuO2', 'author_id': 399977, 'author_profile': 'https://Stackoverflow.com/users/399977', 'pm_score': 1, 'selected': False, 'text': '<p>If you get 403 forbidden when you hit the webserver it may be because you used a hostname that is not what you specified in your config file (ie localhost or 127.0.0.1). Try hitting <a href="https://whateveryousetasyourhostname" rel="nofollow noreferrer">https://whateveryousetasyourhostname</a> instead...</p>\n'}, {'answer_id': 5193555, 'author': 'Thierry M.S.', 'author_id': 282073, 'author_profile': 'https://Stackoverflow.com/users/282073', 'pm_score': 2, 'selected': False, 'text': '<p>Afterwards, I needed to execute (within the context of the example quoted above)</p>\n\n<p>$ sudo chmod g+w /var/svn/$REPOS/db/rep-cache.db</p>\n\n<p>$ sudo chown www-data:www-data /var/svn/$REPOS/db/rep-cache.db</p>\n\n<p>Otherwise I kept receiving a 409 error when committing local modifications \n(though the commitments were server side effective, I needed to follow up with local updates)</p>\n'}, {'answer_id': 26987985, 'author': 'Ashish Saini', 'author_id': 834799, 'author_profile': 'https://Stackoverflow.com/users/834799', 'pm_score': -1, 'selected': False, 'text': '<p>Please write a single command on the terminal.</p>\n\n<p>To open the terminal please press <kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kbd>T</kbd>, and then type this command:</p>\n\n<pre><code>$sudo apt-get install subversion\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/60736', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4120/']