Sonntag Morgen

… nach dem gemeinsamen Frühstück bereitete ich frischen Orangensaft zu. Danach saßen wir beide vor unseren Computern. Sie las de.wikipedia.org/wiki/Werbung während ich mich mit de.wikipedia.org/wiki/Pyramiden beschäftigte. Dazu tranken wir den Orangensaft und sie sagte, aus dem Fenster schauend: »Schönes Wetter heute« …

Continue reading

Using OS X as a decent web server operating system

For quite some time I’m trying to figure out how I could use old and current Apple hardware as decent server platform. Somebody was asking why I wasn’t using Linux or BSD operating systems which are known to work smoothly. Actually I’m using FreeBSD where ever I can for servers but installing and running FreeBSD on PowerPC machines isn’t smooth at all. Linux is out of the question because – well because I’m into the BSD way of Unix. When you look at OS X you find a lot of BSD similarities. Apple is even »claiming« that OS X is based on FreeBSD technology although it is more like FrankensteinsBSD when you look at it – still it is the operating system which is made for that exact hardware, especially for the G4’s and G5’s.

Both, OS X and OS X server are shipping with apache and php but their versions are far behind of current development. Same thing for OS X Server and MySQL. But this is not really the worst part. Even more problematic is the lack of options for configuration. In OS X you can only click on the checkbox for »Personal Web Sharing« which starts / stops the pre-installed apache. That’s all. In OS X Server you got a lot more options but still not enough. The Interface for managing the MySQL daemon is a crime. It feels like somebody used InterfaceBuilder for less than two minutes.

Of course OS X has a Unix underneath the hood and you have a terminal but when you start editing config files for the pre-installed software packages and you change options that aren’t available in the graphical interface, everything blows up. Next time you start the GUI tools everything is a mess. The configurations is either completely lost or simply unusable. Things like apache is not starting anymore, PHP files won’t get executed or MySQL isn’t allowing any connections anymore and other weird stuff like that. So if you are using OS X Server and its graphical user interfaces for setting up a webserver you shouldn’t really use the command line for any configuration or modification of the pre-installed software. Did I mention that you shouldn’t try to replace or delete the pre-installed software either? If you want maximum pain – do it, if you don’t – let it be.

OS X Server is good for other things. Like setting up a mail server or a LDAP server. This part works really smooth via the GUI. I mean the web server part works too but only for setups that are within the limits of the GUI, besides its outdated software.

The other approach is to build all the necessary software manually. Fortunately there is an equivalent to the FreeBSD ports collection available for OS X which is called »MacPorts«. MacPorts are offering a huge collection of open source software and best of all it makes it easy to install, update and delete software. Of course you could download all the sources of apache, php, mysql and their dependencies in order to compile them by hand but MacPorts does all that for you so relax. There are even some useful tutorials out there, explaining how you get apache, mysql and php running. These are two of them which helped me:

But it’s not that easy. You are always encountering problems of ownership or permissions, weird paths and missing directories. You need a little of Unix experience and the ability to read logfiles from time to time (see the previous post on how to add users to the www group). The big advantage is you have up to date software, you can maintain the software and update it easily and you are able to make use of every configuration option offered by the software and not only the ones that Apple wants you to access. For example this way you could use your G4 or G5 to set up a current apache with the current version of ruby on rails, you could set up a mongrel cluster and lots of other custom setups which wouldn’t be possible if you’d be only using the graphical interface.

This whole article is true for OS X. I haven’t really played enough with OS X Server yet. I mean it is really convenient to use the GUI Server Tools but you have basically the same problems as on the client version. Since it is shipping with MySQL you have to make sure that you don’t accidently bind your self compiled software to the pre-installed versions – again – maximum pain. This is because of the different environments. MacPorts uses /opt for everything while the pre-installed software lives in /usr or even in / – so when it comes to sockets or databases which are either in /var/db/… or in /opt/local/var/db/… it is geting quite messy and hard to keep track of all the pathes for librarys, sockets, modules etc. Stick with one approach.

I’m going to write more about this when I had time to play with OS X Server a little bit more and feel free to leave interesting links on that topic.

Continue reading

Groups in OS X

The last couple of days I tried to set up an old G4 with OS X 10.4 Tiger to work as a webserver. I didn’t want to run the apache / php that ships with Tiger because these versions are far behind the current versions. So I installed everything via macports which worked pretty smooth. It is common practice to let apache run as www:www (user:group) and I wanted to stick with that. So I wondered how I could add me to the group www since OS X ignores the /etc/group file. The obvious solution was of course NetInfo Manager (in the Utilities folder) but since OS X 10.5 wont ship with NetInfo Manager I figured that there has to be a different way. There are two command line tools that can get the job done. The first is dscl which gives you full access to everything NetInfo Manager would do for you. The second tool however is especially for adding and removing users to / from groups.

dseditgroup -o edit -a hukl www

for adding me to the www group and

dseditgroup -o edit -d hukl www

will remove me from that group.

Works like a charm but I’m still wondering if there will be a Workgroup Manager for the regular OS X or some other replacement of NetInfo Manager

I know I’m posting too much technical stuff recently …

Continue reading

Rails and Postgres with MacPorts on OS X 10.4.8

I just got a new computer and one of the first things is to install rails and postgresql. For some reason this worked smoothly on my old Powerbook but I installed everything clean on my MacBookPro and for some reason it didn’t work so well. I install everything with MacPorts and the location of Postgres is a litte weird. Thanks to google I found the magic command line to install the ruby postgres gem with the proper parameters on »Tron Jonathans« Weblog. Just for those folks who find my post instead of his I give you the command line to install the gem for postgres8.2:

sudo gem install postgres -- --with-pgsql-include-dir=/opt/local/include/postgresql82/ --with-pgsql-lib-dir=/opt/local/lib/postgresql82/

Still no art for you dot com!

On short notice:

click me!

Continue reading