Monthly Archives: December 2009

Migration problems with Apache from Leopard to Snow Leopard

I migrated my machine from Leopard to Snow Leopard, a few days ago. Then, I applied the Apple’s latest security patch. Unfortunately, it broke the Apache WebServer. I had to dig into the Console log to fix the error. Apparently, there is an issue with the ‘/usr/libexec/apache2/mod_include.so‘ file.

Therefore, I commented out the inclusion of mod_include from ‘/private/etc/apache2/httpd.conf’ file.

#LoadModule include_module libexec/apache2/mod_include.so

Also, I had to install the lynx (text-based browser for apachectl)

$ sudo port install lynx

And, several packages needs to be upgraded, for patching for 32-bit architecture to 64-bit architecture of Snow Leopard

$ sudo port upgrade –enforce-variants ncursesw ncurses openssl readline

sudo port upgrade ruby

$ sudo env ARCHFLAGS=”-arch x86_64″ gem install –no-rdoc –no-ri mysql —   –with-mysql-dir=/usr/local/mysql –with-mysql-lib=/

Note: the architecture of the CPU is now purely 64-bit. Thus, MYSQL gem needs to be compiled as x86_64

Also, mongrel and mongrel_cluster needs to be installed as well. They don’t get copied over from Leopard to Snow Leopard migration. In the /Library/Ruby/Gems/1.8/gems will be those packages. And, in the /usr/bin will be the gem scripts, e.g. mongrel_rails and mongrel_cluster_ctl

$ sudo gem install mongrel mongrel_cluster

Additionally, it is necessary to modify the .profile file, as MacPort puts /opt/local/bin before /usr/bin in the path. This causes problem.

The problem is with mongrel_rails loading the necessary ruby libraries. Thus, I modified .profile to:

export PATH=/usr/bin:/usr:sbin:/opt/local/bin:/opt/local/sbin:$PATH

This allows /usr/bin/mongrel_rails to take precedence over /opt/local/bin/mongrel_rails and fixes $LOAD_PATH problem with ruby loading incorrect libraries.

The correct libraries should be coming from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/ruby/gems/1.8/gems and not /opt/local/lib/ruby/gems/1.8/gems

Setting up my Mac Mini Server

Last night and today, I have been busy setting up my Mac Mini Server. Here’s what I have done so far.

  1. Install XCode (without ‘cc‘ language package, Mac Port will not install).
  2. Install Mac Ports
  3. Using Mac Ports and install the following packages: (sudo port install …)
    • ruby, ruby-gems (not needed, ruby 1.8.7 and gem 1.3.4 already installed by the Snow Leopard by default)
    • Perl (not needed, already installed by the Snow Leopard by default)
    • rails 2.2.2 (not needed, already installed by the Snow Leopard by default)
    • pound
    • wget
  4. Install following Gems (sudo gem install …..), many gems are already installed by Snow Leopard by default. They are at located: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/, But, using sudo gem install xxx without additional installation of Ruby with MacPort, Mac will now put gems into /Library/Ruby/Gems/1.8/
    • RedCloth (not needed, already installed by the Snow Leopard by default)
    • BlueCloth
    • mongrel (not needed, already installed by the Snow Leopard by default)
    • mongrel_cluster
    • ruby-aaws
    • json
    • imdb
    • net-sftp (not needed, already installed by the Snow Leopard by default)
    • capistrano (not needed, already installed by the Snow Leopard by default)
    • httparty
    • MYSQL 2.8.1 adapter gem (note, that Snow Leopard is now pure 64-bits, and earlier 2.7 does not work. Therefore, x86_64 architecture is needed”. Furthermore, there is a bug with 2.8.1, rdoc and ri do not work.)
  5. sudo env ARCHFLAGS="-arch x86_64" gem install --no-rdoc --no-ri mysql --   --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib   --with-mysql-include=/usr/local/mysql/include
  6. Netbeans-ide 6.8 (NetBeans-6.7.1 was designed to work with Ruby 1.8.6, and therefore does not work with Snow Leopard correctly.)
  7. install Aquamac text editor

emacsclient -a /Applications/Aquamacs\ Emacs.app/Contents/MacOS/Aquamacs\ Emacs “$@”

  1. MYSQL (x86 and not PowerPC package)- It is important to read the instruction provided by Sun, because the default MYSQL installation that comes with Mac OSX does not offer a way for uninstallation. It must be manually aliased and the path in the .profile must be reconfigured. Setup MYSQL database & change root password (see http://www.cyberciti.biz/faq/mysql-change-root-password/)
  2. $ mysqladmin -u root password NEWPASSWORD
  3. Additionally, the /private/etc/php.ini file needs to modified to take MYSQL default values (see http://support.apple.com/kb/HT3077?viewlocale=en_US)
pdo_mysql.default_socket=
mysql.default_socket=
mysql.default_host=
mysql.default_port=
mysql.default_user=
mysql.default_password=
  1. PHPMyAdmin (requires enable the Apache server’s HTTPD.CONF file to accept PHP extension)
    uncomment the following file from httpd.conf file
  2. $ LoadModule php5_module        libexec/apache2/libphp5.so   # uncomment it in the httpd.conf file
  3. Move over the data from my existing server.

Am I a Mac Addict?

OK, I have lots of Mac @ home. Yesterday, I bought my 4th Mac of this year. It is a Mac Mini + Snow Leopard Server. Right now, I am busy setting that up as my staging server. My other macs are:

  1. iMac 24″ – 2.66 GHz / Core2, 4 GB RAM, 640 GB HD – upgraded to 8 GB later
  2. 17″ Macbook pro, 3.06 GHz, 500 GB HD, 4 GB RAM
  3. iMac 27″ – 2.88 Ghz Quad Core i7, 4GB  RAM, 2 TB HD
  4. Mac Mini + Snow Leopard Server

Why have I spend close to $10K this year on Apple H/W, one may ask? Well, it was a long trial and error process for me. At the beginning, I had my dedicated web hosting through a company in Florida using Ubuntu Linux. That experience was awful. But, it was not that company’s problem. Rather, it was my lack of experience with Linux and multiple deficiencies with Linux OS. Setting up remote desktop / management with Linux was extremely painful; and, I constantly suffered system downtime with Linux. Apache without patching on Linux was quite unreliable. The web server was down nearly every week. That was totally unacceptable. Plus, the package management system on Linux leaves a lot to be desired, in term of functionalities and manageabilities.

Financially, I was paying $75 per month for having a 2 GB RAM server without free telephone technical support. And, that was way too expensive. I decided to switch to Verizon and get a static IP address (the business package). With this new package, I am paying $144 per month, including Internet access and static IP for my staging server. In one year, I will save $900 of web hosting fee. That is enough to pay for the Mac Mini. Additionally, the server will sit next to me and be a lot more manageable. I also noticed that Apple Remote Desktop responses much better than VNC.

So, here are the reasons for switching from Linux to Mac.

  1. Manageability
  2. Cost
  3. Ease of use
  4. A single computing environment between home and work
  5. A way cool computer than cheap Windows clones

Of course, I can think 10 other reasons. But, I will save it for the next blog.

Now, smile, lay back and enjoy my happy Mac face.