{"id":135,"date":"2013-03-13T19:13:01","date_gmt":"2013-03-13T19:13:01","guid":{"rendered":"http:\/\/devopsny.com\/blog\/?p=135"},"modified":"2013-08-31T20:20:47","modified_gmt":"2013-09-01T00:20:47","slug":"setting-up-a-subversion-repository","status":"publish","type":"post","link":"https:\/\/devopsny.com\/blog\/2013\/03\/13\/setting-up-a-subversion-repository\/","title":{"rendered":"Setting up a subversion repository"},"content":{"rendered":"<p>This is a bit old. From 2008 to be exact. But, I am putting it out there for reference anyway.<\/p>\n<p><b>1. Install packages:<\/b><br \/>\nsudo apt-get install subversion libapache2-svn <span style=\"text-decoration: line-through;\">libapache-mod-dav<\/span> apache2<\/p>\n<p>&nbsp;<\/p>\n<p>Note: libapache-mod-dav is included in libapache2.2-common, so it may be unavailable or you do not need it.<\/p>\n<p>&nbsp;<\/p>\n<p><b>2. Enable SSL:<\/b><br \/>\nsudo a2enmod ssl<\/p>\n<p>&nbsp;<\/p>\n<p>check the ports.conf file, if ssl is already enabled we do not need to do the following:<br \/>\nsudo sh -c &#8220;echo &#8216;Listen 443&#8217; &gt;&gt; \/etc\/apache2\/ports.conf&#8221;<\/p>\n<p>&nbsp;<\/p>\n<p><b>3. Generate Certificate:<\/b><br \/>\nUbuntu <b>&lt;<\/b> Feisty:<br \/>\nsudo apache2-ssl-certificate<br \/>\nUse the server name to be used for access the web server.<\/p>\n<p>Ubuntu <b>&gt;=<\/b> Feisty:<br \/>\nsudo apt-get install ssl-cert<br \/>\nsudo mkdir \/etc\/apache2\/ssl<br \/>\nsudo \/usr\/sbin\/make-ssl-cert \/usr\/share\/ssl-cert\/ssleay.cnf \/etc\/apache2\/ssl\/apache.pem<\/p>\n<p>&nbsp;<\/p>\n<p><b>4. Create Virtual Host:<\/b><br \/>\nsudo cp \/etc\/apache2\/sites-available\/default \/etc\/apache2\/sites-available\/<i>$SITENAME<\/i><br \/>\nsudo vim \/etc\/apache2\/sites-available\/<i>$SITENAME<\/i><br \/>\nchange:<br \/>\nNameVirtualHost *:443<br \/>\n&lt;VirtualHost *:443&gt;<br \/>\nadd:<br \/>\nSSLEngine on<br \/>\nSSLCertificateFile \/etc\/apache2\/ssl\/apache.pem<br \/>\nSSLProtocol all<br \/>\nSSLCipherSuite HIGH:MEDIUM<\/p>\n<p>&nbsp;<\/p>\n<p><b>5. Enable the site:<\/b><br \/>\nsudo a2ensite <i>$SITENAME<\/i><br \/>\nsudo \/etc\/init.d\/apache2 restart<\/p>\n<p>A warning that complaints about failure of server name determination can be fixed by adding ServerName <i>$SERVERNAME<\/i> to the main Apache config \/etc\/apache2\/apache2.conf<\/p>\n<p>&nbsp;<\/p>\n<p><b><br clear=\"all\" \/> <\/b><\/p>\n<p><b>6. Adding repository(ies):<\/b><br \/>\nThe following setup assumes we want to host multiple repositories.<\/p>\n<p>$REPOS is \u201cnbty\u201d currently<br \/>\nsudo mkdir \/var\/svn\/repositories<br \/>\nsudo svnadmin create \/var\/svn\/repositories\/<i>$REPOS<\/i><br \/>\nsudo chown -R www-data:www-data \/var\/svn\/repositories\/<i>$REPOS<\/i><br \/>\nsudo chmod -R g+ws \/var\/svn\/<i>$REPOS<\/i><\/p>\n<p>&nbsp;<\/p>\n<p><b>7. Adding Basic Authentication:<\/b><\/p>\n<p>$AUTH_USER is svn with password mypassword<br \/>\nsudo htpasswd -c -m \/etc\/apache2\/dav_svn.passwd <i>$AUTH_USER<\/i><\/p>\n<p>&nbsp;<\/p>\n<p><b>8. Enable and configure WebDAV and SVN:<\/b><br \/>\nAdd to \/etc\/apache2\/mods-available\/dav_svn.conf<br \/>\n<span style=\"text-decoration: line-through;\">DAV svn<br \/>\nSVNParentPath \/var\/svn\/repositories<br \/>\nAuthType Basic<br \/>\nAuthName &#8220;Subversion Repository&#8221;<br \/>\nAuthUserFile \/etc\/apache2\/dav_svn.passwd<br \/>\nRequire valid-user<br \/>\nSSLRequireSSL<\/span><\/p>\n<p><span style=\"text-decoration: line-through;\">and for non-anonymous access comment out:<br \/>\n#&lt;LimitExcept GET PROPFIND OPTIONS REPORT&gt;<br \/>\n#&lt;\/LimitExcept&gt;<\/span><\/p>\n<p>(optionally the same configuration can be set for particular virtual host only, i.e. \/etc\/apache2\/sites-available\/<i>$SITENAME<\/i>)<\/p>\n<p>&nbsp;<\/p>\n<p>$SITENAME is svn (ssl on svn01 and svn02)<\/p>\n<p>&nbsp;<\/p>\n<p>Add to $SITENAME in \/etc\/apache2\/sites-available:<\/p>\n<p># Specially log any Subversion operations.<\/p>\n<p>CustomLog \/var\/log\/apache2\/svn.log &#8220;%t %u %{SVN-ACTION}e&#8221; env=SVN-ACTION<\/p>\n<p>&nbsp;<\/p>\n<p>&lt;Location \/svn\/company&gt;<\/p>\n<p>DAV svn<\/p>\n<p>SVNPath \/var\/svn\/repositories\/company<\/p>\n<p>SVNReposName &#8220;Companies Main Subversion Repository&#8221;<\/p>\n<p>&lt;\/Location&gt;<\/p>\n<p>&nbsp;<\/p>\n<p><b><br clear=\"all\" \/> <\/b><\/p>\n<p><b>9. Finalization:<\/b><br \/>\nsudo \/etc\/init.d\/apache2 restart<\/p>\n<p><b>\u00a0<\/b><\/p>\n<p><b>Testing:<\/b><\/p>\n<p>$REPOS = company<br \/>\nWeb access:<br \/>\nlynx https:\/\/svn01\/svn\/$REPOS exposes the repository.<br \/>\nlynx http:\/\/localhost\/svn\/<i>$REPOS<\/i> says: eat my shorts , i.e. 403-forbidden.<\/p>\n<p>&nbsp;<\/p>\n<p>Now the sync:<\/p>\n<p>&nbsp;<\/p>\n<ol>\n<li>cd \/var<\/li>\n<li>sudo mkdir svn<\/li>\n<li>sudo mkdir svn\/repositories<\/li>\n<li>sudo svnadmin create \/var\/svn\/repositories\/company<\/li>\n<li>sudo adduser svn\n<ol>\n<li>yourpassword is pwd<\/li>\n<\/ol>\n<\/li>\n<li>sudo vipw\n<ol>\n<li>change svn line from \/bin\/bash to \/bin\/false\u2026.we don\u2019t want this user to log in to shell<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Need to<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>An initial import:<br \/>\nsvn import &#8211;username <i>$AUTH_USER $A_FILE<\/i> https:\/\/localhost\/svn\/<i>$REPOS<\/i>\/testdir -m \u201cTesting\u201d<\/p>\n<p>\u2026 and check-out:<br \/>\nsvn co &#8211;username <i>$AUTH_USER<\/i> https:\/\/localhost\/svn\/<i>$REPOS<\/i><\/p>\n<p>To add a new repository just repeat the step 6 (without making the root directory of course).<br \/>\nIf you wish to configure a single repository only, instead of point 6:<br \/>\nsudo svnadmin create \/var\/svn<br \/>\nsudo chown -R www-data:www-data \/var\/svn<br \/>\nsudo chmod -R g+ws \/var\/svn<\/p>\n<p>and in \/etc\/apache2\/mods-available\/dav_svn.conf (step 8) use this instead of SVNParentPath:<br \/>\nSVNPath \/var\/svn<\/p>\n<p>&nbsp;<\/p>\n<p>sudo svnsync initialize file:\/\/\/var\/svn\/repositories\/nbty https:\/\/svn01\/svn\/company &#8211;username svn &#8211;password yourpassword<\/p>\n<p>&nbsp;<\/p>\n<p>sudo svnsync synchronize file:\/\/\/var\/svn\/repositories\/company &#8211;username svn &#8211;password yourpassword<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a bit old. From 2008 to be exact. But, I am putting it out there for reference anyway. 1. Install packages: sudo apt-get install subversion libapache2-svn libapache-mod-dav apache2 &nbsp; Note: libapache-mod-dav is included in libapache2.2-common, so it may be unavailable or you do not need it. &nbsp; 2. Enable SSL: sudo a2enmod ssl [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[49,16,48],"tags":[21,50,51],"class_list":["post-135","post","type-post","status-publish","format-standard","hentry","category-development","category-linux","category-subversion","tag-linux-2","tag-subversion-2","tag-svn"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3fcrv-2b","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/posts\/135","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/comments?post=135"}],"version-history":[{"count":2,"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/posts\/135\/revisions"}],"predecessor-version":[{"id":319,"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/posts\/135\/revisions\/319"}],"wp:attachment":[{"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/media?parent=135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/categories?post=135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/tags?post=135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}