• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Friday, May 9, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System CentOS

Install Ruby on Rails with Rbenv on CentOS 7

How VPS by How VPS
October 1, 2019
in CentOS
0
0
SHARES
59
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Introduction
  2. Prerequisites
  3. Step one: Install and configure git
  4. Step two: Install rbenv and its ruby-build plug-in
  5. Step three: Install Ruby with rbenv
  6. Step four: Install Rails
  7. Step five: Install Node.js for full functionality
  8. Step six: Create a pilot application
  9. Want to contribute?


Introduction

Ruby on Rails is a popular open-source web framework that can help Ruby programmers develop web applications rapidly. However, during the development of Ruby on Rails applications, a common demand is to test application’s compatibility among various versions of Ruby, which can be satisfied with rbenv’s Ruby version management ability.

In this article, I will show you how to install Ruby on Rails with rbenv on a Vultr CentOS 7 server instance, building a solid Ruby development environment.

Prerequisites

Before we move on, I assume you have:

  • Deployed a CentOS 7 Vultr server instance from scratch.

  • Logged in as a non-root user with sudo privileges. You can find how to create a non-root user in other articles at Vultr Docs by searching “non-root system user”.

Step one: Install and configure git

One of the best coding practices for programmers is to pick a handy version control tool. Here, I chose git.

The easiest way to install git is with yum:

sudo yum update
sudo yum install git

Check whether git is installed properly:

git --version

Configure git:

git config --global user.name "Your Name"
git config --global user.email "[email protected]"

Replace the contents in quotes with your own information.

Verify your configuration:

git config --list

Step two: Install rbenv and its ruby-build plug-in

First, you need to install dependencies for rbenv and Ruby:

sudo yum install -y git-core zlib zlib-devel gcc-c++ patch readline readline-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison curl sqlite-devel

Install rbenv and ruby-build, be sure that you are in your non-root sudo user’s home directory:

cd ~
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile

Step three: Install Ruby with rbenv

You need to determine the version of Ruby that you need. You can list available Ruby versions for installation with the following command:

rbenv install -l

Here, I will install the latest stable version, Ruby 2.2.3:

rbenv install -v 2.2.3
rbenv rehash

Remember to run the command rbenv rehash every time after you install a new version of Ruby or a gem that provides commands.

If you want to use another version, just install the version as above:

rbenv install -v 2.2.0
rbenv rehash

You can check all the versions you have installed with:

rbenv versions

The version with * is the active version.

In rbenv, the level of versions can be global, local (application-specific), or shell; each of them with an increasing priority. That’s to say, rbenv will try to find and use the version in the order of shell version > local version > global version. If none of the three versions were found, rbenv assumes you want to use the “system” Ruby – meaning whatever version would be run if rbenv weren’t in your path.

So, at the very least, you need to set your favorite version as global version for daily use:

rbenv global 2.2.3

Verify your choice with:

ruby -v

Also, you need to install the bundler gem to manage your application dependencies:

gem install bundler

Step four: Install Rails

Install the latest version of Rails:

gem install rails
rbenv rehash

Still, remember to use the command rbenv rehash here.

Check if Rails is installed properly:

rails -v

Step five: Install Node.js for full functionality

Some Rails features rely on a Javascript runtime to provide functionality. Node is a reasonable choice.

sudo yum install nodejs

Step six: Create a pilot application

You can create a pilot application in your home directory to make sure your installation is successful.

cd ~
rails new pilotapp
cd pilotapp
rake db:create

If you are running a firewall on your server, configure it to allow traffic to TCP port 3000.

Start your pilot application:

rails server --binding=[YourServerIP]

Replace [YourServerIP] with your server IP.

Visit http://[YourServerIP]:3000 from your browser. If you see the “Welcome aboard” message, your Ruby on Rails installation is successful.

When finished, you can press Ctrl + C to stop your application.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
Previous Post

Boost Productivity with Z and Zsh on CentOS

Next Post

How to Install Gradle on CentOS 7

Next Post

How to Install Gradle on CentOS 7

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet