How to quickly and correctly install Ruby, Rails running environment

Source: Internet
Author: User

For newly-introduced developers, how to install Ruby, the operating environment of Ruby Gems and Rails can be a problem, this page focuses on how to quickly install a ruby development environment with a reliable path.
The secondary installation method is also applicable to the product environment!

System Requirements

First determine the operating system environment, it is not recommended to engage in Windows, so you need to use:

    • Mac OS X
    • Any Linux distribution (Ubuntu,centos, Redhat, ArchLinux ...)

Strong novice use Ubuntu saves unnecessary hassle!

The following code area, with a $ first representation, needs to be performed under the Console (terminal) (not including the $ symbol)

Step 0-Install the package required by the system
# For Mac # 先安装 [Xcode](http://developer.apple.com/xcode/) 开发工具,它将帮你安装好 Unix 环境需要的开发包# 然后安装 [Homebrew](http://brew.sh)$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

OS X Install Rails Some of the necessary three-party libraries

$ brew install libxml2 libxslt libiconv
Step 1-Install RVM

What is RVM do not explain here, you will slowly understand the back.

$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3$ curl -sSL https://get.rvm.io | bash -s stable# 如果上面的连接失败,可以尝试: $ curl -L https://raw.githubusercontent.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable

You may be asked for a sudo administrator password, and you Homebrew can install the RVM successfully after a period of time by installing the dependent packages automatically.

Then, load into the RVM environment (new open termal will not do so, will automatically reload)

$ source ~/.rvm/scripts/rvm

Modify RVM to download the source of Ruby to the image of Ruby China:

echo "ruby_url=https://cache.ruby-china.org/pub/ruby" > ~/.rvm/user/db

Check to see if the installation is correct

$ rvm -vrvm 1.27.0 (latest) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]
Step 2-Install the Ruby environment with RVM
$ rvm requirements$ rvm install 2.3.0

Also continue to wait for a lengthy download, the compilation process, after completion, Ruby, Ruby Gems is installed.

Step 3-Set up Ruby version

After the RVM is installed, you need to execute the following command to set the specified version of Ruby to the system default version

$ rvm use 2.3.0 --default

Also, you can use a different version number if you have a RVM install installed that version

This time you can test whether it is correct

$ ruby -vruby 2.3.0 ...$ gem -v2.5.1$ gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
Installing Bundler
$ gem install bundler
Step 4-Install the Rails environment

After the 3 steps above, the Ruby environment is installed, and the next step is to install Rails

$ gem install rails

Then test that the installation is correct

$ rails -v
Rails 5.0.0

Then start your ruby,rails trip.
Welcome to the world of Ruby!

How to quickly and correctly install Ruby, Rails running environment

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.