| 1 | |
| 2 | In order to get Trac with SVN running on Leopard, I followed the |
| 3 | following steps: |
| 4 | |
| 5 | 1. Create a user account (subversion) for file storage and enable |
| 6 | sudo. |
| 7 | * Use the Workgroup Administrator application and create the user |
| 8 | "Subversion" (with short name "subversion") |
| 9 | * Log in as an Administrator and edit the sudo file (using |
| 10 | ```sudo visudo```) |
| 11 | 1. Set up a simple test SVN repository. |
| 12 | {{{ |
| 13 | % cd /Users/subversion; svnadmin create test-repo |
| 14 | }}} |
| 15 | 1. Test that the SVN repository works |
| 16 | {{{ |
| 17 | % cd /tmp |
| 18 | % svn co file:///Users/subversion/test-repo |
| 19 | % cd test-repo |
| 20 | % svn mkdir tags branches trunk |
| 21 | % svn ci -m "Initial structure" |
| 22 | }}} |
| 23 | 1. With that simple repository, time to set up apache to get HTTP |
| 24 | access to this (via DAV). Later, this will facilitate moving the HTTP- |
| 25 | based authentication against the Mac OSX server directory. To do this, |
| 26 | create a file ```httpd-subversion.conf``` in ```/private/etc/apache2/ |
| 27 | extra``` with the following contents: |
| 28 | {{{ |
| 29 | DavLockDB var/DavLock |
| 30 | LoadModule dav_svn_module libexec/apache2/mod_dav_svn.so |
| 31 | LoadModule authz_svn_module libexec/apaache2/mod_authz_svn.so |
| 32 | |
| 33 | <Location /test-repo> |
| 34 | DAV svn |
| 35 | SNVPath /Users/subversion/test-repo |
| 36 | </Location> |
| 37 | }}} |
| 38 | 1. Add in a line into the ```httpd.conf``` file right after the SSL |
| 39 | lines that reads: |
| 40 | {{{ |
| 41 | # |
| 42 | # Subversion |
| 43 | Include /private/etc/apache2/extra/httpd-subversion.conf |
| 44 | # End of Subversion |
| 45 | # |
| 46 | }}} |
| 47 | 1. Restart apache and verify access to ```http://localhost/test- |
| 48 | repo``` |
| 49 | {{{ |
| 50 | sudo apachectl graceful-stop |
| 51 | sudo apachectl start |
| 52 | }}} |
| 53 | 1. Using Server Admin, enable SSL and restart Apache. This creates |
| 54 | the required SSL files. |
| 55 | 1. Enable access via both port ```80``` and ```443``` by changing ```/ |
| 56 | etc/apache2/sites/virtual_host_global.conf``` to end with: |
| 57 | {{{ |
| 58 | Listen *:80 |
| 59 | Listen *:443 |
| 60 | }}} |
| 61 | 1. Ensure that there are both ```0000_any_80_.conf``` and |
| 62 | ```0000_any_443_.conf`` files. If either are *.conf.default, rename |
| 63 | them, and then restart apache |
| 64 | {{{ |
| 65 | % mv 0000_any_80_.conf.default 0000_any_80_.conf |
| 66 | % mv 0000_any_443_.conf.default 0000_any_443_.conf |
| 67 | % sudo apachectl graceful-stop |
| 68 | % sudo apachectl start |
| 69 | }}} |
| 70 | 1. Check SSL operation, by going to ```https://localhost/``` and |
| 71 | ```http://localhost/``` |
| 72 | 1. Change the SVN repository to require SSL, by adding the following |
| 73 | lines in the ```httpd-subversion.conf``` |
| 74 | {{{ |
| 75 | SSLRequireSSL |
| 76 | }}} |
| 77 | 1. Now, make subversion require a valid user, validated against the |
| 78 | Open Directory accounts using ```apple_auth_module``` |
| 79 | (```mod_auth_apple.so```). Change ```extra/httpd-subversion.conf``` |
| 80 | to the following, restart apache and test again. |
| 81 | {{{ |
| 82 | DavLockDB var/DavLock |
| 83 | |
| 84 | LoadModule auth_basic_module libexec/apache2/mod_auth_basic.so |
| 85 | |
| 86 | LoadModule dav_module libexec/apache2/mod_dav.so |
| 87 | LoadModule dav_fs_module libexec/apache2/mod_dav_fs.so |
| 88 | LoadModule dav_svn_module libexec/apache2/mod_dav_svn.so |
| 89 | LoadModule authz_svn_module libexec/apache2/mod_authz_svn.so |
| 90 | LoadModule apple_auth_module libexec/apache2/mod_auth_apple.so |
| 91 | <Location /test-repo> |
| 92 | DAV svn |
| 93 | SVNPath /Users/subversion/test-repo |
| 94 | AuthType Basic |
| 95 | AuthName "SVN Repository" |
| 96 | AuthuserFile /dev/null |
| 97 | AuthBasicAuthoritative Off |
| 98 | Require valid-user |
| 99 | SSLRequireSSL |
| 100 | </Location> |
| 101 | }}} |
| 102 | 1. To install TRAC, download trac 0.11b1 from http://trac.edgewall.org, |
| 103 | unpack, and install: |
| 104 | {{{ |
| 105 | % gunzip Trac-0.11b1.tar.gz |
| 106 | % tar xf Trac-0.11b1.tar |
| 107 | % cd Trac-0.11b1 |
| 108 | % sudo python ./setup.py install |
| 109 | }}} |
| 110 | 1. Create a trac environment |
| 111 | {{{ |
| 112 | % trac-admin /Users/subversion/trac initenv |
| 113 | % sudo chown -R www /Users/subversion/trac |
| 114 | }}} |
| 115 | 1. Test this trac environment is running, by using the tracd first. |
| 116 | Since the directory is now owned by www, the sudo is required. Use |
| 117 | Safari to check this by opening http://localhost:8000 |
| 118 | {{{ |
| 119 | % sudo tracd --port 8000 /Users/subversion/trac |
| 120 | }}} |
| 121 | 1. To set up TRAC to run under Apache (so we can get a single |
| 122 | authentication system in place), we need to create ```httpd- |
| 123 | fastcgi.conf``` under ```/private/etc/apache2/extra``` with the |
| 124 | following content: |
| 125 | {{{ |
| 126 | # Enable FASTCGI for .fcgi files |
| 127 | <IfModule mod_fastcgi.c> |
| 128 | AddHandler fastcgi-script .fcgi |
| 129 | FastCgiIpcDir var/run/fastcgi |
| 130 | </IfModule> |
| 131 | |
| 132 | LoadModule fastcgi_module libexec/apache2/mod_fastcgi.so |
| 133 | }}} |
| 134 | 1. Configure apache to react to ```/trac``` references using fastcgi |
| 135 | with the following content in ```httpd-trac.conf``` (also in ```/ |
| 136 | private/etc/apache2/extra``` |
| 137 | {{{ |
| 138 | # |
| 139 | ScriptAlias /trac /Users/subversion/Trac-0.11b1/cgi-bin/trac.fcgi |
| 140 | FastCgiConfig -initial-env TRAC_ENV=/Users/subversion/trac |
| 141 | |
| 142 | <Location "/trac"> |
| 143 | SetEnv TRAC_ENV "/Users/subversion/trac" |
| 144 | SSLRequireSSL |
| 145 | </Location> |
| 146 | |
| 147 | <Directory "/Users/subversion/Trac-0.11b1/cgi-bin"> |
| 148 | AllowOverride None |
| 149 | Options None |
| 150 | Order allow,deny |
| 151 | Allow from all |
| 152 | </Directory> |
| 153 | }}} |
| 154 | 1. Modify ```httpd.conf``` to include these files, adding the |
| 155 | following lines just below the line for subversion (as added above) |
| 156 | {{{ |
| 157 | ## |
| 158 | ## TRAC |
| 159 | ## |
| 160 | Include /private/etc/apache2/extra/httpd-fastcgi.conf |
| 161 | Include /private/etc/apache2/extra/httpd-trac.conf |
| 162 | ## |
| 163 | ## End of TRAC changes |
| 164 | ### |
| 165 | }}} |
| 166 | 1. Test this by restarting apache and accessing ```http://localhost/ |
| 167 | trac``` |
| 168 | 1. Modify TRAC to require an authenticated user. Change the content |
| 169 | in ```httpd-trac.conf``` (in ```/private/etc/apache2/extra```) to that |
| 170 | shown below and restart apache: |
| 171 | {{{ |
| 172 | # |
| 173 | ScriptAlias /trac /Users/subversion/Trac-0.11b1/cgi-bin/trac.fcgi |
| 174 | FastCgiConfig -initial-env TRAC_ENV=/Users/subversion/trac |
| 175 | |
| 176 | <Location "/trac"> |
| 177 | SetEnv TRAC_ENV "/Users/subversion/trac" |
| 178 | AuthType Basic |
| 179 | AuthName "SVN Repository" |
| 180 | AuthuserFile /dev/null |
| 181 | AuthBasicAuthoritative Off |
| 182 | Require valid-user |
| 183 | SSLRequireSSL |
| 184 | </Location> |
| 185 | |
| 186 | <Directory "/Users/subversion/Trac-0.11b1/cgi-bin"> |
| 187 | AllowOverride None |
| 188 | Options None |
| 189 | Order allow,deny |
| 190 | Allow from all |
| 191 | </Directory> |
| 192 | }}} |
| 193 | 1. To enable the !WebAdmin page to all authenticated users, use the |
| 194 | following commands: |
| 195 | {{{ |
| 196 | % sudo trac-admin . |
| 197 | > permission add authenticated TRAC_ADMIN |
| 198 | > quit |
| 199 | }}} |
| 200 | |