27.02.2013 Views

Rails%203%20In%20Action

Rails%203%20In%20Action

Rails%203%20In%20Action

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

390 CHAPTER 14 Deployment<br />

rvm group, which is a group created by the installation of RVM. To add your current<br />

user to this group, run this command:<br />

sudo usermod -a -G rvm user<br />

The -a option here tells the command to append some groups to the list of groups<br />

that the user is in, and the -G option (like you saw before with useradd) specifies the<br />

group. You specify your username on the end of this command, telling it who you<br />

want this new group applied to.<br />

To make the rvm command effective for all users, add a line to /etc/profile. Whenever<br />

new terminal sessions are launched, this file is read and run. Put a line in it using<br />

these commands:<br />

sudo su<br />

echo 'source "/usr/local/rvm/scripts/rvm"' >> /etc/profile<br />

exit<br />

The source command here will load the/usr/local/rvm/scripts/rvm file for each user<br />

whenever they start a new session. To make this change effective for the current session,<br />

exit out of your terminal and log back in. Once back in, you should be able to<br />

run rvm and have it output the help information.<br />

If that’s the case, then you are now ready to install Ruby.<br />

14.2.2 Installing Ruby<br />

Ruby 1.9.2 is considered the latest stable version of Ruby (at least, as of this writing).<br />

By installing it, you’re on your way to being able to run your Rails application on this<br />

server. To install this version of Ruby, run this command:<br />

rvm install 1.9.2<br />

This command will take some time to run as it needs to download, compile, and then<br />

install Ruby. To switch to using this Ruby, use this command:<br />

rvm use 1.9.2<br />

When you type ruby -v into the terminal, you should see something like this:<br />

ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]<br />

The value may be different, but as long as it begins with ruby 1.9.2, you know that<br />

you’ve got the right Ruby version installed. To make this the default version of Ruby<br />

for your user, run the rvm use command again, but pass in an option:<br />

rvm use --default 1.9.2<br />

Now every time that you log in to this server you’ll be using this version of Ruby. While<br />

you’re doing Ruby things, let’s install the Bundler gem, which you’ll need for your<br />

application to install its gems on the server and rake for running Rake tasks:<br />

gem install bundler rake

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!