Installing Ruby on Rails (RoR) on Linux

Getting RoR up and running means working with a few moving parts. That said, with a little bit of tweaking of various config files and making sure that Ruby, Rails and various other subparts are all up and running, this is totally doable. If you're familiar with the various package managers (e.g. yum, apt) and comfortable updating config files, it's pretty straightforward.

DIFFICULTY Basic - 1 | Medium - 2 | Advanced - 3
TIME REQUIRED 30 min
RELATED PRODUCTS Linux-based VPS or dedicated servers

Install Git

sudo apt-get install git

or

yum install git

Install Ruby Version Manager (RVM)

curl -sSL https://get.rvm.io | bash

Start Ruby Version Manager (RVM)

source /etc/profile.d/rvm.sh

Test for successful RVM install.

Open terminal and execute the following:

type rvm | head -1

You should see the following result:

rvm is a function

Install additional dependencies.

rvm requirements

Install Ruby

rvm install 2.1.2

Select the version.

rvm use 2.1.2

Ensure the current Ruby version is installed

ruby -v

Install Rails

gem install rails

Install sqlite

apt-get install libsqlite3-dev

or

yum install sqlite-devel

Test your installation with a sample application using Ruby on Rails

rails new my_test_app
cd my_test_app

You'll need to ensure that JavaScript is set up in your Gemfile. To do this

nano Gemfile

Add the following two lines at the end:

gem 'execjs'
gem 'therubyracer'

Save and close the Gemfile.

Install everything and start the Rails server

bundle install
rails server

Things should now be running.

Check to make sure everything is working

Go to http://your_domain_or_IP_address:3000

You should see a page that indicates that
my_test_app is running.


Помогла ли вам эта статья?
Благодарим вас за отзыв. Чтобы связаться с сотрудником службы поддержки клиентов, позвоните по номеру этой службы или воспользуйтесь опцией чата выше.
Мы рады вам помочь! У вас остались вопросы?
Приносим извинения. Расскажите нам, какие затруднения вы испытываете или почему рекомендованное решение не помогло устранить проблему.