1.2. Ruby on Rails 4.0 on Debian 7.1 (Wheeze)

There are two main reasons for installing a Ruby on Rails system with RVM (Ruby Version Manager):
  • You simply do not have any root rights on the system. In that case, you have no other option.
  • You want to run several Rails systems that are separated cleanly, and perhaps also separate Ruby versions. This can be easily done with RVM on the Linux system. Then you can run Ruby 1.9.3 with Rails 3.2 and in parallel Ruby 2.0.0 with Rails 4.0 on the same computer.

Buy the new Rails 5.1 version of this book.

Detailled information on RVM can be found on the RVM homepage at https://rvm.io/.
This description assumes that you have a freshly installed Debian GNU/Linux 7.1 (Wheeze). You will find an ISO image for the installation at http://www.debian.org. I recommend the approximately 250 MB net installation CD image. For instructions on how to install Debian-GNU/Linux, please go to http://www.debian.org/distrib/netinst.


If you have root rights on the target system, you can use the following commands to ensure that all required programs for a successful installation of RVM are available. If you do not have root rights, you have to either hope that your admin has already installed everything you need, or send them a quick e-mail with the corresponding lines.
First, an update of the package lists:
root@debian:~# aptitude update

Buy the new Rails 5.1 version of this book.

Of course, you can optionally install a SSH server on the system, so you can work on the system via SSH instead of on the console:
root@debian:~# aptitude -y install openssh-server
And now the installation of the packages required for the RVM installation:
root@debian:~# apt-get -y install gawk libgdbm-dev pkg-config libffi-dev build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion python
Now is a good time to log out as root:
root@debian:~# exit

Installing Ruby 2.0.0 and Ruby on Rails 4.0 with RVM

Log in with your normal user account (in our case, it's the user xyz).
RVM, Ruby, and Ruby on Rails can be installed in various ways. I recommend using the following commands and get at least one cup of tea/coffee/favorite drink:
deployer@debian:~$ curl -L https://get.rvm.io | bash -s stable --rails
deployer@debian:~$ source /home/deployer/.rvm/scripts/rvm
RVM, Ruby 2.0.0 and Rails 4.0 are now fully installed.

Thank you for your support and the visibility by linking to this website on Twitter and Facebook. That helps a lot!