Railings
Some private reactions to my dismissal of the Raspberry Pi involved the simplicity of setting up development environments in Linux.
The most hyped business development framework on that platform at the moment has to be Ruby on Rails. There are a lot of issues with its philosophy, but in general it is quite a good framework, if you ignore its database generation and employ a professional to design and build the database.
Setting it up has always been a nightmare though. I decided that I would go through the pain again, with the latest version of Ubuntu and the latest versions of Ruby and Rails, and document it. I won’t include rants about all the false starts before I got to this point.
I use Oracle’s VirtualBox for all my VM experiments. It’s free, and to my mind more efficient than the paid alternatives (Parallels and VMWare) which I’ve tried. It has a limitation on the Mac that you can only create 32-bit guests, but for experimental use that’s not a major limitation.
So I downloaded the latest 32-bit version of Ubuntu Server (don’t bother with the full desktop version for rails development, you’re better off using your normal machine and browser for testing.) I installed a basic setup, with only OpenSSH Server ticked in the optional installations (so that I could access it by ssh from the MacBook host.) I installed all required updates, then builtRuby from source:
First thing we need is the build environment (C and utilties)
sudo apt-get install build-essential
Then a load of stuff forming the ever-increasing list of things needed by Rails but not automatically installed by it, causing wacky runtime errors on first test (sorry, I did promise no ranting :-)
sudo apt-get install sqlite3 libsqlite3-dev \
zlib1g-dev libssl-dev libyaml-dev \
libreadline6-dev nodejs
Then get the source
wget htt p://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
tar zxvf ruby-1.9.3-p0.tar.gz
cd ruby-1.9.3-p0/
./configure --prefix=/usr/local/ruby
(I like to put ruby in its own part of /usr/local, because the makefiles provided in the source build don’t have an ‘uninstall’ target, so this makes it easier to remove manually.)
make
sudo make install
We then need to add the path into the system profile
sudo vi /etc/profile.d/ruby.sh
adding the lines:
PATH=$PATH:/usr/local/ruby/bin
export PATH
After logging out and back in, we should now be able to see the executable
ruby --version
Before installing the Rails gems, make sure the gem system is up-to-date (note the path modification doesn’t work for sudo)
sudo /usr/local/ruby/bin/gem update --system
sudo /usr/local/ruby/bin/gem install rails
And after all this, you should get a working Rails
rails new cwoir
cd cwoir
rails server
This really is a lot of faff. It’s very different to the last time I did it (Ubuntu 10 and Rails 3), and that was a pain as well. The Ubuntu and Rails communities both seem to delight in breaking everything at regular intervals, and going back to my point about the Pi, I can’t see how this is easier than downloading the Express versions of Visual C# and SQL Server from Microsoft on to a Windows PC. I know quite a lot about Linux, I know how to build things from source, modify the system, etc. A beginner wanting to explore programming would surely be put off by all the incantations above, just to get to a stage where you have a working tool.