How to install the ruby and rails execution environment quickly and correctly

Source: Internet
Author: User

For beginners, how to install Ruby, Ruby gems, and rails execution environments may be a problem. This section describes how to install the ruby development environment quickly with a reliable path.
The same installation method applies to the product environment!

System Requirements

First, determine the operating system environment. It is not recommended to do this on windows, so you need to use:

  • Mac OS X
  • Free Linux release version (Ubuntu, centos, RedHat, archlinux ...)

It is strongly recommended that new users use Ubuntu to save unnecessary trouble!

In the following code area, the $ header must be run (excluding the $ symbol) below the console (terminal)

Step 0-install the required package
# For Mac
# First install [Xcode] (http://developer.apple.com/xcode/) development tools, it will help you install the development packages required by the Unix environment
# Then install [Homebrew] (http://brew.sh)
ruby -e "$ (curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"
Step 1-install rvm

Here we will not explain what rvm is doing, but you will make it clearer later.

$ curl -L https://get.rvm.io | bash -s stable

During this period, you may be asked about the sudo administrator password and manually passhomebrewInstall the dependency package. After a while, you can install rvm successfully.

Then, load the rvm environment (the new termal does not need to be done, and will automatically load it again)

$ source ~/.rvm/scripts/rvm

Check whether the installation is correct

$ rvm -vrvm 1.22.17 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]
Step 2-Use rvm to install the ruby Environment
$ rvm install 2.0.0

The same continues to wait for a long download and compilation process. After compilation, Ruby and Ruby gems will be installed.

Step 3-set the ruby version

After rvm is installed, run the following command to set the ruby of the specified version number to the default version number of the system.

$ rvm 2.0.0 --default

Similarly, other version numbers are enough, provided that you have installed the version number on rvm install.

At this time, you can try again to see if it is correct.

$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin13.0.0] $ gem -v
2.1.6 $ gem source -r https://rubygems.org/ $ gem source -a https://ruby.taobao.org
Step 4-install the rails Environment

After the above three steps, the ruby environment is installed, and then the rails

$ gem install rails

Then, verify that the installation is correct.

$ rails -vRails 3.2.13

Start your ruby and rails journey.
Welcome to the ruby world!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.