May 30, 2012 1 Comment
Before I was playing with Debian on the Raspberry Pi I was messing with ArchLinux and managed to get Rails 3.2 running on the Pi. I’m posting this up as a quick guide for anyone else that might want it.
The first step is to log into the command prompt either directly or via ssh. I’m not going to add a different user at this point just set things up for the root user but you might want to consider doing this differently for anything but a toy project.
Next we need to install the dependancies. Arch uses a dependancy manager called pacman. Let’s start by updating pacman itself to make sure it’s up to date.
pacman -S pacman
We then need to install the rest of the dependancies:
I wanted to run solr for search so I also installed openJDK6 but I suspect most projects won’t need this.
pacman -S openjdk6
With the dependancies installed we should now have ruby 1.9 installed. We can just check this using the version flag on ruby.
Now we just need to install bundler:
gem install bundler
With bundler installed we’ll need to copy the code over to the device (or generate a new rails app by installing the rails gem and running the generator). You could easily do this yourself using scp or a similar tool but I used capistrano here with the following recipe:
set :application, "manifest" set :repository, "." set :deploy_via, :copy set :scm, :git set :user, "root" set :password, "root" set :use_sudo, false role :web, "192.168.1.190" role :app, "192.168.1.190"
Rather than checking out the git repo remotely I’m just asking capistrano to copy my local project which uses git and providing it the Raspberry Pi’s username, password and IP address.
Once the code is deployed simply run bundler to install the gems.
Once the gems are installed go ahead and migrate up the database:
and Start Rails!
script/rails server -p 80
You should now be able to access your rails app over the network!. There’s nothing groundbreaking in here but I thought I’d document this in case it helps anyone.