Project

General

Profile

Support #707

Setup Ruby on Rails Development Environment on Arch

Added by Daniel Curtis about 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Web Server
Target version:
Start date:
12/06/2015
Due date:
% Done:

100%

Estimated time:
1.00 h
Spent time:

Description

This is a guide on how I setup my Ruby on Rails development environment to create a new RoR web application on Arch Linux.

Prepare the Environment

  • Make sure the system is up to date:
    sudo pacman -Syu
    
  • Install a few dependencies:
    sudo pacman -S ruby nodejs npm python2
    
  • Add bob to the sudo group:
    sudo usermod -aG sudo bob
    
  • Enable systemd-timesyncd:
    sudo systemctl enable systemd-timesyncd
    sudo systemctl start systemd-timesyncd
    

Install Multi-user RVM

  • Imports the RVM signing key:
    sudo gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
    
    • NOTE: If that fails run the following:
      curl -sSL https://rvm.io/mpapis.asc | sudo gpg2 --import -
      
  • Download and install rvm as the bob user:
    curl -L get.rvm.io | sudo bash -s stable
    
  • After the script has finishes edit the ~/.bashrc file:
    nano ~/.bashrc
    
    • Then add the following line to the end of the file
      [[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm" 
      
  • Add bob to the rvm group:
    sudo usermod -aG rvm bob
    
    • Logout and then login again for the group changes to take effect.
  • Check any missing requirements for RVM:
    rvm requirements
    

Install Ruby

  • List the known available ruby versions:
    rvm list known
    
  • Install Ruby 2.2:
    rvm install 2.2
    
  • Install the rails gem:
    gem install rails
    
    • (Optional) Install libv8:
      gem install libv8 -- --with-system-v8
      

Create a New Web Application

  • Create the new Ruby on Rails web application:
    rails new new_app
    
  • Install the new web applications dependencies:
    bundle install --path vendor/bundle
    
  • Start the rails development web server:
    bundle exec rails s
    
    • NOTE: The development web server bind the IP address to the localhost by default, so accessing it over the network will not work. To allow network access to the development web server:
      bundle exec rails s -b 0.0.0.0
      

Resources

Also available in: Atom PDF