Uli's Web Site
[ Zathras.de - Uli's Web Site ]
Other Sites: Stories
Pix
Abi 2000
Stargate: Resurgence
Lost? Site Map!
 
 
     home | blog | moose | programming | articles >> blog

 Blog Topics
 
 Archive
 

15 Most Recent [RSS]

 Less work through Xcode and shell scripts
2011-12-16 @600
 
 iTunesCantComplain released
2011-10-28 @954
 
 Dennis Ritchie deceased
2011-10-13 @359
 
 Thank you, Steve.
2011-10-06 @374
 
 Cocoa Text System everywhere...
2011-03-27 @788
 
 Blog migration
2011-01-29 @520
 
 All you need to know about the Mac keyboard
2010-08-09 @488
 
 Review: Sherlock
2010-07-31 @978
 
 Playing with Objective C on Debian
2010-05-08 @456
 
 Fruit vs. Obst
2010-05-08 @439
 
 Mixed-language ambiguity
2010-04-15 @994
 
 Uli's 12:07 AM Law
2010-04-12 @881
 
 Uli's 1:24 AM Law
2010-04-12 @874
 
 Uli's 6:28 AM Law
2010-04-12 @869
 
 Uli's 3:57 PM Law
2010-04-12 @867
 

More...

MAS - My own MAMP-like Subversion installation

You may be familiar with MAMP. MAMP is a desktop application that contains a complete Apache server, with PHP and SQL, which you can launch by simply double-clicking one application.

I always thought that all servers should work that way. Just an application package that you download and run. In particular, I'm kind of annoyed that setting up a Subversion repository these days requires scattering oodles of files and Unix libraries all across my file system. So, today I decided to roll my own MAMP-like system for running a Subversion repository under Apache 2.

I'll be doing this by trial and error, and I'll just start with the simplest possible approach I can think of and work my way up from there until it either works or I decide it's not worth the hassle. So, I'm going to sort-of-follow my directions on installing Subversion on a Mac to try and create a copy of all this software that runs in a folder of its own that I create (/Applications/MAS/, as in "Mac OS X, Apache, Subversion"). Once I have everything in that one folder, I'll have to find out what the best way is to copy these files to another volume or system, and once I have that all that's needed is a tiny little GUI app to launch and quit this thing.

Getting the packages

Since I need to configure the stuff to go in different folders, I'm downloading the sources from the public folder of wsanchez's public iDisk, not the finished installer packages. To prevent screwing up my current system, I'm also doing this on a separate partition on my external hard disk.

Once I had a fresh throw-away OS X plus Xcode tools installed (I left out stuff I wouldn't need like printer drivers, localisations etc.) I extracted the archives. This required use of the Terminal:

slab:~ ulikusterer$ tar -xvzf neon-0.26.0.tar.gz
and the likes, as OS X's built-in unzipper would simply hang trying to unpack these archives. No idea why, but Activity Monitor let me kill BOMArchiveHelper and its tar processes that had accumulated.

Building libxml2

To build libxml2, I first open its folder and read the file INSTALL. It tells me it follows the Unix standard, so I cd into its folder and type

slab:~ ulikusterer$ ./configure --help
to get a list of options. From that, I guess that I will have to use the following command to build libxml2:
slab:~ ulikusterer$ ./configure --prefix=/Applications/MASslab:~ ulikusterer$ makeslab:~ ulikusterer$ make install
Configure will now set up a lot of stuff for the build and spew a lot of messages until it displays: "Done Configuring", and then we'll get more spewage with warnings from the compiler before we have a build of the first library we need. So far, so good. On to the next one.

Building expat

I try the same procedure for expat, after cding into its folder:

slab:~ ulikusterer$ ./configure --prefix=/Applications/MASslab:~ ulikusterer$ makeslab:~ ulikusterer$ make install

Building gettext

During building of neon later on, I found out that it was missing a header named libint.h. A quick Google showed me that this was part of Gettext, which OS X seems to not include. So, I'm installing that as well. Since Wilfredo doesn't have it on his iDisk as far as I could see, I got the sources for that from the GNU Gettext Homepage. Then I built it using

slab:~ ulikusterer$ ./configure --prefix=/Applications/MAS        --enable-csharp=noslab:~ ulikusterer$ makeslab:~ ulikusterer$ make install
The C-Sharp part is necessary so we don't get errors when it can't find a copy of Mono or so on your system.

Building neon

Okay, next up is Neon. Neon doesn't have an INSTALL file, but luckily follows the standard anyway. So, once I've read configure's help, I go for:

slab:~ ulikusterer$ ./configure --prefix=/Applications/MAS        --with-libs=/Applications/MAS:/usrslab:~ ulikusterer$ makeslab:~ ulikusterer$ make install
I also wanted to pass --with-ssl=openssl, but for some reason got an "invalid argument to binary -" error. Since SSL isn't vital, I decided to skip and try the next library first.

Building APR

APR is easily built the same way, however for APR-util, we have to modify the configure call slightly:

slab:~ ulikusterer$ ./configure --prefix=/Applications/MAS        --with-libs=/Applications/MAS:/usr --with-apr=/Applications/MAS
to tell it where it can find its copy of APR.

Building Apache 2 (httpd)

Works with the following command:

slab:~ ulikusterer$ ./configure --prefix=/Applications/MAS        --with-libs=/Applications/MAS:/usr --enable-so --enable-dav-fs        --enable-dav-lock --enable-dav --with-port=8800

Building Subversion

Again, we need to add a few parameters to the configure line to make Subversion use the versions of APR and Neon we already built instead of compiling its own version of those:

slab:~ ulikusterer$ ./configure --prefix=/Applications/MAS        --with-libs=/Applications/MAS:/usr --with-apr=/Applications/MAS        --with-apr-util=/Applications/MAS --with-apxs=/Applications/MAS/bin/apxs
Here I get a few linker warnings about libiconv.la being moved. Anybody know whether this is bad? I also get an error because I have neon 0.26.0 instead of 0.25.5, so I'm not specifying --with-neon=/Applications/MAS here to get SVN to use its own copy of Neon, I hope that doesn't cause conflicts.

Configuring Apache

I'm no security guru, so I'm going to trust the Apache guys to ship with a reasonably safe default. The file we want to edit first is /Applications/MAS/conf/httpd.conf. Apache was smart enough to set up most things the way we wanted it already, like defaulting the ServerRoot to /Applications/MAS. However, a few things still need setup:

Change the Listen 80 directive to listen to a different port, so people who want to run Mac OS X's regular Apache along with the Apache 2 we're using for Subversion, they won't fight for the same port. I'm choosing

Listen 8800
like I did it for the previous Subversion installation (this may already be set due to the configure parameter above).

Change User and Group from daemon to www, to match what OS X's standard Apache uses.

Starting Apache for a short test run

To test whether everything's working so far, use the following command:

slab:~ ulikusterer$ /Applications/MAS/bin/apachectl start
Now you should be able to view your server at http://127.0.0.1:8800/ or whatever port you chose. To quit the server again, use
slab:~ ulikusterer$ /Applications/MAS/bin/apachectl stop
While I was at it, I zipped up the MAS folder, rebooted, copied it to the internal partition, and tried to run the unzipped version on the internal disk's system. It worked! Of course, like MAMP it is hard-wired to run in /Applications, but isn't that what we wanted to achieve? What doesn't work, however, is just copying over the file. Then you get an error about special permissions... hmmm... I'll have to work on that.

Setting up the Subversion Server

To get a working server, we need to create a repository, though:

slab:~ ulikusterer$ /Applications/MAS/bin/svnadmin create /Applications/MAS/repositories
Once that is done, we need to add some lines to the end of our httpd.conf file:
<Location /svn>  DAV svn  SVNPath /Applications/MAS/repositories  AuthType Basic  AuthName "Subversion Repository"  AuthUserFile /Applications/MAS/conf/svn-auth-file  Require valid-user</Location>
Note that this refers to the file svn-auth-file that will hold our passwords, which we have yet to create using:
htpasswd -c /Applications/MAS/conf/svn-auth-file username
(Where you'd replace username with whatever user name you want to use). This will create the file and ask you for a password to use for that account. If you want to, you can add more users using the same line (but without the -c option).

And now, we have a nice little subversion server. When we launch the server as described above and enter our subversion URL http://127.0.0.1:8800/svn/ we get asked for our password and we can access the (empty) repository.

A few minutes later, I've cobbled together a small GUI to start and stop the server, and to set up an initial password or add more users.

If you have comments, suggestions etc., feel free to leave them by using the comment form below, or visit the MAS Sourceforge project:

Reader Comments: (RSS Feed)
Peter Hosey writes:
Suggestion: Use something like $HOME/Library/SubversionRepositories for the repositories folder. This way, deleting MAS.app and installing a new one won't throw away your repos.
Ruth Less writes:
Dude! If MAMP is Mac + Apache + MySQL + PHP...<br /><br /> ... then what do you call Windows + IIS + MySQL + PHP?<br /><br /> WIMP! Muahahahah!
Hwangbo Hoon writes:
This is just what I've been found. Thank you man! I wish you to continue upgrade this app more!
Hwangbo Hoon writes:
And it's better linking your blog to the project on SourceForge. It was pretty hard to find here.
sonique writes:
Hello, nice article, and very nice work. Just to told you about SPMPT which include Trac, svn server, and python in a package. It's an add-on to MAMP.
Or E-Mail Uli privately.

 
Created: 2006-07-15 @526 Last change: 2024-12-26 @221 | Home | Admin | Edit
© Copyright 2003-2024 by M. Uli Kusterer, all rights reserved.