Using Capistrano to deploy Drupal (or other non-Rails) projects – step 1

Step 1: install RVM, Ruby 1.9.2 and Capistrano (or skip to step 2)

These instructions will leave you with a single-user RVM installation. This works for me because I’m only deploying with one user. If you want more than one user to have access to RVM-installed Rubies on your server, you’ll need go the Multi-User install route as described here.


bash < <(curl -s
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bashrc
source ~/.bashrc

Ruby 1.9.2 and Capistrano

If you’re installing Ruby on a fresh Ubuntu server, you might need to install dependencies. See here.

sudo apt-get install build-essential git-core zlib1g-dev libssl-dev libreadline5-dev
rvm package install zlib

Then, install Ruby 1.9.2…

rvm install 1.9.2

* This will take a while. If it throws an error about missing zlib, try this:

rvm get
rvm package install zlib
rvm remove 1.9.2
rvm install 1.9.2 --with-zlib-dir=$rvm_path/usr

* This ^ will update your RVM install, install the zlib package, remove the previously-installed Ruby 1.9.2, and install Ruby 1.9.2, explicitly setting the path to the zlib binary

rvm use 1.9.2 --default
rvm gemset create drupal

* set your system to use Ruby 1.9.2 by default, and create a gemset. Creating the gemset is not necessary, but helps keep things organized.

rvm use 1.9.2@drupal
gem install capistrano --no-ri --no-rdoc

* delete –no-ri and –no-rdoc if you want to download documentation

Now you have RVM, Ruby and the Capistrano gem installed on your server. Do the same thing on your local machine.

If you’re on a Mac, instead of apt-get, you should install Homebrew and install packages by running something like: brew install … If you’re on Windows, you’re on your own :)


    Terrence |

    Uber post! Loved it very much