Changes between Initial Version and Version 1 of howto/Subversion


Ignore:
Timestamp:
May 31, 2008, 10:23:02 PM (16 years ago)
Author:
jaguarcy+macports@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • howto/Subversion

    v1 v1  
     1[wiki:howto <- Back to the HOWTO section]
     2
     3= Getting Subversion under MacPorts =
     4
     5 * Audience: Anyone and everyone
     6 * Requires: MacPorts, Apache (for server installation)
     7
     8== Introduction ==
     9
     10The most expedient way to get Subversion up and running on Mac OS X is to do it under MacPorts. There are a number of secondary components that Subversion depends upon and the MacPorts portfiles take care of the tedium of doing all this by hand.
     11
     12These instructions assume you already have MacPorts installed and running.
     13
     14== Client-Only Installation ==
     15
     16=== Step 1: '''Turn off Apple's "Personal Web Sharing"''' ===
     17
     18This is the easiest option. Simply type
     19
     20%sudo port install subversion
     21
     22When MacPorts finishes, you can test out your installation by pulling down the actual Subversion project itself:
     23
     24%cd ~
     25%mkdir Subversion
     26%cd Subversion
     27%svn checkout http://svn.collab.net/repos/svn/trunk trunk
     28
     29== Full (Client+Server) Installation ==
     30
     31This option is is for people who want to host a Subversion server running under Apache. While MacPorts will take care of automatically downloading and installing Apache (the v2.x line), it's probably better if you get Apache configured and running first. That way, if there are problems, you can figure out whether it's with your Apache installation or with your Subversion installation. To get Apache installed, follow the Apache-specific instructions on the [wiki:howto/MAMP MAMP] page. (If you know you're going to need MySQL and PHP, you might as well get those installed and out of the way too and come back to this page when you're ready.)
     32
     33=== Step 1: '''Install Subversion''' ===
     34
     35First run the following command for a client + server installation:
     36
     37{{{
     38sudo port install subversion +mod_dav_svn
     39}}}
     40
     41=== Step 2: Create initial repository and set up apache ===
     42
     43Next, you will need to create a Subversion repository and tell Apache about it. Let's assume we want to set up a Subversion repository directory such that the collection of hosted repositories is accessed via http://localhost/svn/ for each repository. We're doing this so that we can host multiple repositories if we elect to do so. So, if we created two repositories, `repos-1` and `repos-2`, we would reference them as http://localhost/svn/repos-1 and http://localhost/svn/repos-2, respectively. Let's also assume that we want to host the repositories in a `/svn` directory. There are two key things you need to do to make all this work:
     44
     45  * Grant ownership of the `/www` directory to the `www` user
     46  * Establish the proper access controls in Apache's `httpd.conf` file to connect http://localhost/svn/ URLs to the `/svn` directory.
     47
     48First, let's set up the `/svn` directory and create a repository:
     49
     50{{{
     51cd /
     52sudo mkdir svn
     53cd svn
     54sudo mkdir repos-1
     55sudo svnadmin create --fs-type fsfs repos-1
     56}}}
     57
     58Next, we need to change the owner to be `www`:
     59
     60{{{
     61cd /
     62sudo chown -R www svn
     63}}}
     64
     65Now, we need to tell Apache to activate Subversion and how to access the repository. Go to the Apache config directory:
     66
     67{{{
     68cd /opt/local/apache2/conf/
     69}}}
     70
     71and edit the httpd.conf file. If you are using `vi`,
     72
     73{{{
     74sudo vi httpd.conv
     75}}}
     76
     77and if you are using `pico`,
     78
     79{{{
     80sudo pico httpd.conf
     81}}}
     82
     83Navigate to the "Dynamic Shared Object (DSO) Support" section (i.e., the section that has all the "`LoadModule`" statements) and add the following lines at the end:
     84
     85{{{
     86# ----- Subversion:
     87LoadModule dav_svn_module  modules/mod_dav_svn.so
     88LoadModule authz_svn_module modules/mod_authz_svn.so
     89}}}
     90
     91Next, navigate your editor down to the very end of the file and add the following lines:
     92
     93{{{
     94#
     95# Define Subversion access
     96#
     97<Location /svn/>
     98  DAV svn
     99  SVNParentPath /svn
     100  SVNListParentPath on
     101</Location>
     102}}}
     103
     104  ''Note that this is the world's simplest Subversion access configuration. It is meant only to be used to help verify that your installation is working properly. You should now be able to further configure your repository hosting according to the [[http://svnbook.red-bean.com/ Subversion documentation]].''
     105 
     106
     107  '''Note:'''   It is important to have the trailing slash ("/") character at the end of the directory in the `Location` directive. Older versions of Subversion didn't seem to care about the trailing slash, but versions 1.3.0 and later seem be really picky about it. It becomes an issue if you need to use an access control file to control access within the repository. So it's best to set things up correctly now, otherwise there will be great weeping and gnashing of teeth later on.
     108
     109=== Step 3: Restart Apache and test installation ===
     110
     111Restart Apache (`sudo /opt/local/apache2/bin/apachectl -k restart`) to activate your changes.
     112
     113Now, you should be ready to test your installation. First, point your browser to http://localhost/svn/ . You should see a "Collection of Repositories" page with your "repos-1" repository listed in it. It will be empty, so if you click on it, it will have nothing and be at Revision 0 (go ahead and try it!). Next, go to your home directory and create a template directory to import as your first revision:
     114
     115{{{
     116cd ~
     117mkdir svn-template
     118cd svn-template
     119mkdir trunk branches tags
     120}}}
     121
     122Import your template directory into the "repos-1" repository using
     123
     124{{{
     125svn import . http://localhost/svnrepo/repos-1 -m "Initial import."
     126}}}
     127
     128Go back to your browser and go to http://localhost/svn/repos-1/ (if you're there already, just refresh the page). You should now see the "`branches`", "`tags`", and "`trunk`" directories listed and the repository should be at Revision 1.
     129
     130That's it. You've got a Subversion server running!
     131
     132[wiki:howto <- Back to the HOWTO section]