Set Up Rails Development Environment

A Couple of months back I had a situation, which concerned about installing Ruby on Rails and rails on my system. After reading through many blogs and posts related with installation, at last I found RVM (Ruby Version Manager) as the best option among all which is a neater way of installing Ruby on Rails. Most importantly I didn’t need to Google all the errors, which pops up while installing them using other methods. With RVM, comes lots of flexibility and installation is pretty easier.

These installation steps have been tested on ubuntu versions.

Verhaltensregeln

  • This beginner’s guide will set up a Rails Development Environment with Ruby 1.9.3, RVM and Rails 3.1.3 and is specifically written for a development environment on Ubuntu 10.10, but will probably work on many other operating systems, including older / newer versions of Ubuntu and Debian.
  • Wenn man nach einer Möglichkeit sucht, dies auf einem Produktionsserver einzurichten, empfiehlt sich die Verwendung des „Railsready-Skripts“, das alle notwendigen Pakete für Ruby 1.9.3p0 und dann diese Version von Ruby selbst, Bundler und Rails installiert. Dann bleibt es dem Benutzer überlassen, Apache oder Nginx zu installieren, um Ihre Anwendung online zu stellen.
  • Under no circumstance should one install Ruby, Rubygems or any Ruby-related packages from apt-get. This system is out-dated and leadsto major headaches. Avoid it for Ruby-related packages.

Installation steps

  • First of all update the system,so that all the latest resources are updated to install latest packages.
    1. Öffnen Sie das Terminal (Alt+Strg+T).
    2. In terminal type:- sudo apt-get update
  • Next, we’re going to install Git (a version control system) and curl which are both required to install and use RVM, and build-essential which is required to compile Ruby versions, amongst other compilable things. To install these three packages we use this command:
  • sudo apt-get install build-essential git-core curl
  • Installing RVM(Ruby Version Manager)
  • RVM is a Ruby Version Manager created by Wayne E. Seguin and is extremely helpful for installing and managing many different versions of Ruby all at once. Sometimes you could be working on a project that requires an older (1.8.7) version of Ruby but also need a new version (1.9.3) for one of your newer projects. This is a problem that RVM solves beautifully.
  • Eine andere Situation könnte sein, dass Sie unterschiedliche Sätze von Edelsteinen in derselben Ruby-Version haben möchten, sich aber nicht mit der Gem Conflict Hell herumschlagen müssen. RVM verfügt hierfür über Gemsets. Dies ist eine Funktion, die Sie nicht hätten, wenn Sie das Ruby-Paket verwenden würden.
  • With git-core and curl installed we’ll be able to install RVM with this command: => Run this command in terminal bash < <(curl –s https://rvm.beginrescueend.com/install/rvm) =>The beautiful part of this is that it installs Ruby to our home directory, providing a sandboxed environment just for us.
  • Once that is done add following line to your
~/.bashrc file. => echo ‘[[ -s $HOME/.rvm/scripts/rvm” ]] && source “$HOME/.rvm/scripts/rvm”‘ >> ~/.bashrc //.bashrc file is responsible for setting up the bash session
  • Then we’ll need to reload ~/.bashrc file,which can be done using this small command. => . ~/.bashrc => After using above command,if error comes i.e. rvm(command not found) etc…Then simply close this terminal and start again(Believe me,few times such things do work!!!)
  • Next we have to see what are the things required by RVM to install Ruby on Rails..Just use:- => rvm requirements //this will show all the packages required to be installed before,few of which we may have already installed.

To install all the required packages mentioned by rvm requirements,just run following command:- =>sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core //please note these all should be contained in single line,otherwise zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev //few packages may not get installed. libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion

 

Installing Ruby and Rails

Installing Ruby

  • With RVM and packages installed,we can install ruby using :- => rvm install 1.9.3 //this will install ruby with 1.9.3 version and it takes a little time to get installed. Be patient.
  • With RVM installed,we can use that particular version to be used:- => rvm use 1.9.3 //now the ruby 1.9.3 will be used as a ruby version
  • To check the version of the ruby version installed:- => ruby -v //check the current version being used
  • To make a particular version to be used as default,we can use:- => rvm –default use 1.9.3

Installing Rails

  • As we have installed ruby in our home directory,we don’t need to use sudo command for rails installation. Simply type following command:-
  • gem install rails -v 3.0.9 //This will install 3.0.9 version. Any suitable version can be downloaded by just mentioning the version here.
  • //Es werden auch das Rails-Gem und die anderen 22 Gems installiert, von denen es und seine Abhängigkeiten abhängen, einschließlich Bundler.

Well,Thats it! Enjoy coding!

 Nehmen Sie Kontakt mit uns auf.

Abonnieren Sie die neuesten Updates

zusammenhängende Posts

Hinterlasse einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

de_DEGerman