Quick and concise guide for installing Ruby on Rails and rubyonrails
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 # first install [Xcode] (http://developer.apple.com/xcode/) development tools, it will help you install the Unix environment requires Development Kit # 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 install the dependency package through homebrew. 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 <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [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 -vruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin13.0.0]$ gem -v2.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 -vRails 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