BitNami RubyStack on Windows Vista

Some things have recently changed for those of us developing Rails applications in a Windows environment. First, InstantRails, an all-in-one package containing the complete Rails stack, has been superseded by BitNami RubyStack. Next, Windows machines now usually ship with Vista instead of XP. Finally, Rails 2.0 was released last week.

What does this mean to developers like me that use Windows? RubyStack is still in beta (currently 1.0-beta-2) and does not yet contain phpMyAdmin (or even Apache). While developing Rails applications, I have become dependent on using phpMyAdmin to manage databases and view data—RubyStack doesn’t support this out-of-the-box. Vista is stricter with its access rights. RubyStack and its projects folder installs into the Program Files folder. Vista makes it difficult to manage gems (including installing Rails 2.0 into RailsStack) and work on projects when RubyStack is installed in this location.

This post describes my experiences getting RubyStack to work in this environment, replacing RubyStack’s version of Rails (1.2.5) with Rails 2.0, and using phpMyAdmin with RubyStack’s MySQL database.

Installing BitNami RubyStack

First I download RubyStack from http://www.bitnami.org/stack/rubystack. The installation process, using a wizard, was straight forward. The one issue I have with the installer is that it insists on creating a Rails sample application. I accepted the default values whenever they were available.

Upgrading to Rails 2.0

My first major problem occurred when I tried to upgrade to Rails 2.0. After starting the “Use Ruby” Command Prompt (found in the Start menu) and executing gem install rails, I would get the message:

ERROR:  While executing gem ... (Errno::EACCES)
   Permission denied - C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/rails-2.0.1/html/javascripts/application.js

I realized that I didn’t have permissions to install the latest Rails gem or modify any files in the Program Files folder without having Administrator rights. To install the Rails 2.0 gem, I started the “Use Ruby” Command Prompt with administrator rights by finding “Use Ruby” in the Start menu, right-clicking on “Use Ruby” and choosing “Run as administrator”. This brought up a Command Prompt with the correct environment variables for RailsStack where I was able to install Rails 2.0 and remove Rails 1.2.5:

> gem install rails -y --source http://gems.rubyonrails.org
...
> gem cleanup
...
> rails -v
Rails 2.0.1

Locating My Rails Projects

My next problem occurred when I tried to generate a new Rails project. I started the “Use Ruby” Command Prompt, which opened a Ruby Environment command prompt with C:\Program Files\BitNami RubyStack as the default directory. I wasn’t pleased that RubyStack expected me to maintain my projects under the Program Files folder. Vista’s wasn’t about to let me create a new project or modify any files in an existing project in that folder without me having administrator rights.

What I did to overcome this problem was to update RubyStack’s “Use Ruby” batch files to allow my projects to be located in my User folder.

First I created a cd_projects_folder.bat file within C:\Program Files\BitNami RubyStack\scripts which changes the directory to a RubyStack project folder within the current user’s User folder. This batch file also creates the project folder if it does not exist. It’s a simple two lines:

if not exist "%USERPROFILE%\BitNami RubyStack projects" mkdir "%USERPROFILE%\BitNami RubyStack projects"
cd "%USERPROFILE%\BitNami RubyStack projects"

Next I edited launch.bat file within C:\Program Files\BitNami RubyStack\scripts to call cd_projects_folder.bat:

@echo off
CALL C:\PROGRA~1\BITNAM~1\scripts\cd_projects_folder.bat
CALL C:\PROGRA~1\BITNAM~1\scripts\load_path.bat
START "Ruby Environment" %*

Finally I deleted the projects folder in C:\Program Files\BitNami RubyStack (which contains the sample application generated during installation.

Now when I start “Use Ruby” it opens a Command Prompt and drops me in C:\Users\Dennis\BitNami RubyStack projects.

Using phpMyAdmin with RubyStack

I’ve grown accustomed to using phpMyAdmin when developing Rails applications. The RailsStack developers have stated that phpMyAdmin and Apache will be included in a future release of RailsStack. So my interim solution is to use the XAMPP stack for phpMyAdmin.

I download the XAMPP for Windows installer from http://www.apachefriends.org/en/xampp-windows.html and installed it using the default values. Once installed, I edited C:\xampp\hpMyAdmin\config.inc.php so that the user and password in the “Server(s) configuration” section reflect the username and password I entered when installing RubyStack. The two lines I modified look something like:

$cfg['Servers'][$i]['user']          = 'root';
$cfg['Servers'][$i]['password']      = 'impossible_to_guess_password';

Finally, to use phpMyAdmin, I start the XAMPP Control Panel from the Start menu, press the Start button for Apache, and then browse to http://localhost/phpmyadmin/.

This demonstrates some of the issues encountered when developing with a Windows environment. Another big issue is editors. Mac users seem very happy and productive using TextMate. I’ve begun to test out the E Text Editor, a Windows editor that features some of TextMate’s functionality. Now it’s time for me to try out some of the new Rails 2.0 features.

Thank You! It was helpful

Thanks, exactly what I needed! Inspired me to do a similar one for Vim on Vista: http://vim.wikia.com/wiki/Vim_On_Vista

For the benefit of those who stumbled upon this page: RubyStack 1.0-beta-3 includes PHPMyAdmin now... - Ruby 1.8.6 - RubyGems 0.9.4 - Rails 2.0.1 - ImageMagick 6.3.5 - Subversion 1.4.5 - SQLite 3.5.1 - MySQL 5.0.45 - Apache 2.0.61 - PHP 5.2.5 - phpMyAdmin 2.11.2 However, you still cannot (yet) create a new project or modify any files in an existing project in Program Files without having administrator rights in Vista. Thanks for the great post. It helped me alot too =)

Thanks a lot Sutch for reporting this. It has been fixed in the last version of RubyStack 1.0-beta-4. http://bitnami.org/stack/rubystack

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options