Https://ruby-china.org/wiki/install_ruby_guide
How to quickly and correctly install Ruby and rails runtime Environments
For new entry-level developers, installing Ruby, Ruby gems, and rails running environments may be a problem. This section describes how to quickly install the ruby development environment using a reliable path.
The installation method is also applicable 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
- Any 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 executed under the console (terminal) (excluding the $ symbol)
Step 0-install the package required by the system
# For Mac
# Install [Xcode] (http://developer.apple.com/xcode/) development tools first, it will help you install the development packages needed 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
What rvm is doing is not explained here, and you will understand it later.
$ curl -L https://get.rvm.io | bash -s stable
During this period, you may be asked about the sudo administrator password and automatically passhomebrewInstall the dependency package. After a while, you can successfully install rvm.
Then, load the rvm environment (New termal does not need to be done, it will automatically reload)
$ 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
We will also continue to wait for a long download. After the compilation process is completed, Ruby and Ruby gems will be installed.
Step 3-set the ruby version
After the rvm is installed, You need to execute the following command to set the ruby of the specified version to the default version of the system.
$ rvm 2.0.0 --default
You can also use other versions, provided that you have installed the version with rvm install.
At this time, you can test whether 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 test whether the installation is correct.
$ rails -v
Rails 3.2.13
Start your ruby and rails journey.
Welcome to the ruby world!
Other resources
Https://github.com/huacnlee/init.d-quick installation of production environment for Ubuntu server Batch scripts