27.02.2013 Views

Rails%203%20In%20Action

Rails%203%20In%20Action

Rails%203%20In%20Action

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

388 CHAPTER 14 Deployment<br />

useradd -d /home/user -m -s /bin/bash -G admin user<br />

This command will create a directory at /home/user and set this user’s home path to<br />

that directory. This is done with the -m and -d options, respectively. Next, the command<br />

sets the user’s shell to /bin/bash—which is the default shell of UNIX operating<br />

systems—using the -s option. Near the end of this command, the -G option specifies<br />

that this user will be a part of the admin group, which will let the user execute commands<br />

using sudo, a kind of super-user command. This part is important because<br />

you’ll need these permissions to set up your server. At the end of the command, specify<br />

the username of this new user.<br />

Next, you need to set a password for this user, which you can do with this<br />

command:<br />

passwd user<br />

You need to enter the new password for this user twice, and then you’re done. You<br />

mustn’t forget the password, otherwise you’ll have to reset it as the root user.<br />

With that done, let’s switch into this user by using this command:<br />

su user<br />

Now you’re all set up to go about installing the different software packages you’ll need<br />

to get your server up and running.<br />

14.1.2 Installing the base<br />

The majority of software packages are installed on Ubuntu using a system called Aptitude.<br />

You can install packages from their source code too, if you wish (with the help of<br />

a package called build_essential, which contains the build tools you need). These<br />

Aptitude packages are downloaded from a package repository and then installed for<br />

you. To ensure that the list of these packages are up-to-date, run this command:<br />

sudo aptitude update<br />

This command goes through the list of sources, connecting to each of them and<br />

downloading a package list that is then cached by Ubuntu. When you go to install a<br />

package (your next step), Ubuntu will reference these lists to find the packages and<br />

the necessary dependencies for them.<br />

Once this command is complete, continue the set up by configuring RVM and creating<br />

a deploy user.<br />

RVM is short for Ruby Version Manager and provides a simple way to install and<br />

maintain versions of Ruby on your system. You’re going to be using it today to install a<br />

single Ruby version on your system, but it’s good to learn it.<br />

To get started, you’re going to need to install some packages that will provide the<br />

necessary tools to use RVM. These packages are build-essential, git-core, and<br />

curl. RVM uses these packages to build the Ruby version for your server. The gitcore<br />

provides the base Git functionality that RVM uses to stay up to date, and is also

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

Saved successfully!

Ooh no, something went wrong!