Construct the UbuntuRubyonRails Environment
0. System Environment
Uname-
Linux moyo-desktop 3.19.0-21-generic #21-Ubuntu SMP Sun Jun 14 18:31:11 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
1. Install curl
sudo apt-get install curl
2. install rvm
curl -L get.rvm.io | bash -s stable
> Note: if an error warning is prompted, run the following command to obtain the Public Key: gpg -- keyserver hkp: // keys.gnupg.net -- recv-keys success> If the error persists, run the following command: curl-sSL https://rvm.io/mpapis.asc | gpg -- import-> re-install rvm: curl-L get. rvm. io | bash-s stable
Activate rvm:
source /home/cbd/.rvm/scripts/rvm
3. install Ruby
Rvm install ruby
"Requires a password to automatically install some dependencies 』
"Optional" use taobao image acceleration: for mac $ sed-I. bak's! Cache.ruby-lang.org/pub/ruby! Ruby.taobao.org/mirrors/ruby! '$ Rvm_path/config/dbFOR LINUX $ sed-I' s! Cache.ruby-lang.org/pub/ruby! Ruby.taobao.org/mirrors/ruby! '$ Rvm_path/config/db replace gem Source: gem sources -- remove https://rubygems.org/gem sources-a http://ruby.taobao.org/gem sources-l
Check whether the installation is successful:
ruby -v
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]
4. install rails
gem install rails
5. new app
In the project folder, create the project app001:
rails new app001
"You still need to do something :』
Terminal will prompt you about the things required during bundle installation.
Q: I don't know how to install all the dependencies on the gem one time. Currently, I install them one by one, which is extremely time-consuming. If you want to know the method, please give me some advice!
Vim Gemfile
Modify Source Address:
Source 'HTTP: // ruby.taobao.org /'
Save.
Execute bundle to automatically install dependencies.
6. Run the service
Run rails server in the project folder
Visit http: // localhost: 3000 in the browser. The ROR welcome page is displayed.
Continue Happy Time ^_^