Ubuntu on Mac for Web Development

Geek alert: this post gets into Linux and other such topics. More geeky than I usually get.

I have finally got my setup complete. I got tired of trying to find Mac binaries of all the libraries I wanted installed for web development, and I’ve been doing much more PHP this month than Flex. So I reworked things. Here’s my setup:

  • Ubuntu Server 8.0.4 running on VMWare Fusion
  • lighttpd web server, learned it in a few hours and loved it (thanks Jake)
  • sshfs to mount my ~/Sites folder to the /var/www/ folder on the Ubuntu VM

Installing Ubuntu Server on VMWare wasn’t a problem. I tried it on Parallels and it wouldn’t boot after the install, so thought I’d try the other. Now I may have to buy it unless they want to give me a copy for blogging about them (hint, hint). :)

After installing Ubuntu, I gave root a password I could connect with: sudo passwd root

Then I ssh’ed in from my terminal. Mostly because I can make the screen bigger and scroll it etc. I set the networking to bridged so my ubuntu install could be accessed from my Mac and also access the internet. Got the IP for it with: ifconfig

Installed lighttpd, php-cgi, mysql, etc. with apt-get.

Then I installed sshfs, again with apt-get. This allows me to mount a drive to a folder that uses SFTP under the hood. I went into my Mac settings and under “Sharing” clicked the checkbox next to “Remote Login” and then specified that only my user could be logged into remotely (keep it as secure as possible shall we?)

Then I mounted my Sites folder: sshfs myusername@ /var/www/ -o follow_symlinks,allow_other. The two options there at the end were to enable symlinks which I use in my sites folder to link to various folders on my Mac. And the allow_other ensures that other users on the ubuntu system (including my lighty user) can see the mount. Otherwise I get a Fobidden error in my browser.

I set up simple-vhosts with lighty and changed all my /etc/hosts entries to point to the ubuntu IP since I won’t be using apache anymore.

I think I covered it all. It’s not in great step-by-step detail, but hopefully there’s enough info that you might get something similar up and running if needed. :)

2 Responses to “Ubuntu on Mac for Web Development”

  1. shaun Says:

    why would you bother with Ubuntu when you have a perfectly good(great) unix OS in tiger/leopard?

  2. Oscar Gonzalez Says:

    In response to Shaun:

    You want ubuntu or any other VM running un your computer because it allows you to have different operating systems with different settings at only one click of distance.

    Another thing is that you can give that VM to your developers and they only need to mount the folder and they are ready to rumble.