Digital Notepad

Internet, Mobility and Serious Geekery

Mac OS X – ideal development platform – VMware, Ruby on Rails & Ubuntu

December28

Mac as the ideal development platform? Maybe for the iPhone I hear you mumble. Until I found this nice, clean and extremely flexible solution I wholeheartedly agreed. The basic scheme goes like this:

As foundation I am now running a clean, basically stock OS X. On top of this I am running a bunch of VMware Fusion Virtual machines, ranging from OS X, Ubuntu down to Windows XP ;-). Basically I am running all the development environment in Ubuntu and doing all the research and editing on OS X natively.

To achieve this I have a Ubuntu Server 8.10 with PostgreSQL, Apache 2 prefork, Ruby Enterprise Edition and Rails 2.2.2 installed. This Linux VM shares my Mac OS X Project folder via VMware HGFS mount directly in /var/www/projectname. This setup enables me to work with Textmate and save/copy/mess around locally on my Mac OS X host system (10.5.6) and immediately have the changes reflected in the Ubuntu machine. So the basic workflow is the same than before with having RoR etc. installed locally on my OS X. Hope I made myself clear!?

Here is how to get there (you may have to adjust the version numbers and replace cabchap&tom with the required domain/user):

  1. Install Ubuntu Intrepid Ibex Server CD, using F4 – minimal system, then press “Install” and later select “Basic Ubuntu Server”, “SSH Server” and “PostgreSQL Server”.
  2. sudo apt-get update -o Acquire::http::No-Cache=True
  3. sudo apt-get dist-upgrade
  4. sudo apt-get install build-essential zlib1g-dev libssl-dev libpq-dev apache2-mpm-prefork apache2-prefork-dev libreadline5-dev git-core
  5. wget http://rubyforge.org/frs/download.php/48623/ruby-enterprise-1.8.6-20081215.tar.gz
  6. tar xvfz ruby-enterprise-1.8.6-20081215.tar.gz
  7. cd ruby-enterprise-1.8.6-20081215/
  8. sudo ./installer
  9. sudo ln -s /opt/ruby-enterprise-1.8.6-20081215/ /opt/ruby-enterprise
  10. sudo ln -s /opt/ruby-enterprise/bin/gem /usr/bin/gem
  11. sudo ln -s /opt/ruby-enterprise/bin/ruby /usr/bin/ruby
  12. sudo ln -s /opt/ruby-enterprise/bin/rake /usr/bin/rake
  13. sudo ln -s /opt/ruby-enterprise/bin/irb /usr/bin/irb
  14. sudo ln -s /opt/ruby-enterprise/bin/rails /usr/bin/rails
  15. sudo /opt/ruby-enterprise-1.8.6-20081215/bin/passenger-install-apache2-module
  16. sudo vi /etc/apache2/httpd.conf [and enter the following:]
    # General stuff
    ServerSignature Off
    LogLevel warn
     
    # Set Rails mode
    RailsEnv development
     
    # Lock down GIT files
    <Files ~ “^.git”>
        Order allow,deny
        Deny from all
    </Files>
     
    # Prepare for Rails
    LoadModule passenger_module /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so
    PassengerRoot /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/passenger-2.0.6
    PassengerRuby /opt/ruby-enterprise-1.8.6-20081215/bin/ruby
  17. cd /etc/apache2/sites-available/
  18. cp default default.orig
  19. sudo vi /etc/apache2/sites-available/default [fill only with:]
    <VirtualHost *>
      ServerName dev.cabchap.com
      ServerAdmin devmaster@cabchap.com
      DocumentRoot /var/www/cabchap/public
      ErrorLog /var/log/apache2/error.log
      CustomLog /var/log/apache2/access.log combined
    </VirtualHost>
  20. cd /var/www
  21. sudo mkdir cabchap
  22. sudo chown tom cabchap
  23. rails -d postgresql cabchap
  24. sudo -u postgres createuser cabchap [answer yes to superuser]
  25. sudo vi /etc/postgresql/8.3/main/pg_hba.conf
     host all all 192.168.0.0/16 md5
    Replace:
    local all all ident sameuser
    with this line:
    local all all md5
  26. sudo vi /etc/postgresql/8.3/main/postgresql.conf
    listen_addresses=’*’
  27. sudo /etc/init.d/postgresql-8.3 restart
  28. sudo /etc/init.d/apache2 restart
  29. Finally configure the VMware shared folder in VMware settings for the relevant machine:
  30. Name: cabchap (this name is mounted in fstab)
  31. Folder: dev (in Projects/Something/dev)
  32. In etc/fstab enter
     .host:/ /var/www vmhgfs defaults,ttl=5,uid=tom,gid=tom 0 0

Let me know if this interesting for someone out there. If it is, I will invest more time in clarifying these quick draft notes. May this be helpful.

posted under Tech
2 Comments to

“Mac OS X – ideal development platform – VMware, Ruby on Rails & Ubuntu”

  1. On January 8th, 2009 at 20:19 Nick Muller Says:

    This is perfect! Thanks Tom!

    Here are some detailed steps for getting from 29. to 33.:

    Install Linux headers (needed for vmware-tools binary compiling)
    [CODE]
    sudo apt-get install linux-headers-`uname -r`
    [/CODE]

    In VMware menu choose Virtual Machine > Install VMware Tools

    Mount VMware Tools CD:
    [CODE]
    sudo mount /dev/cdrom /mnt/cdrom
    [/CODE]

    Expand and install the vmware-tools from the ‘tmp’ directory
    [CODE]
    cd /tmp
    sudo tar zxpf /mnt/cdrom/VMwareTools-.tar.gz
    cd vmware-tools-distrib
    sudo ./vmware-install.pl
    [/CODE]

    then on to step 33.

  2. On February 23rd, 2009 at 17:07 Digital Notepad » Blog Archive » Quick checklist to railsify Ubuntu Desktop the kosher way Says:

    [...] now follow this post: Mac OS X – ideal development platform – VMware, Ruby on Rails & Ubuntu posted under [...]

Email will not be published

Website example

Your Comment: