Ruby On Rails and rubyonrails
Development Environment: Ubuntu 16.4 LTS
Installing ruby through rvm
1. RVM Installation
$ Gpg -- keyserver hkp: // keys.gnupg.net -- recv-keys 409b6b1796c275462a1703111084bb82d39dc0e3
$ Curl-sSL https://get.rvm.io | bash-s stable
$ Source ~ /. Bashrc
$ Source ~ /. Bash_profile
Modify the Ruby installation source of RVM to the Ruby image server of Ruby China, which improves the installation speed $ echo "ruby_url = https://cache.ruby-china.org/pub/ruby "> ~ /. Rvm/user/db or echo "ruby_url = https://cache.ruby-china.org/pub/ruby ">/Usr/local/rvm/user/db check whether rvm-v 2 is installed correctly, installing and switching Ruby With RVM $ rvm requirements $ rvm install 2.3.1 (install Ruby with version 2.3.1 Note: After ruby is installed, it comes with a gem, in the current ruby version, the gem is 2.5.1. You 'd better upgrade it. Otherwise, an error may be reported during subsequent installation. The gem upgrade command $ gem udpate -- system gem source modification command $ gem source-r https://rubygems.org/ # Delete source $ gem source- https://gems.ruby-china.org/ # Add source $ gem source-l # View source installation Bundler $ gem install bundler 3 and install the Rails environment $ gem install rails-v 5.0.0.1 (if not specified, the latest version is installed by default) 4. Check whether the installation is correct. $ rails-v 5: Create a rails project and test step1: $ rails new Blog -- skip-bundle (create a Blog project,
-- Skip-bundle is used to skip the installation of the gem package in Gemfile.) Step 2: change the code source 'https: // rubygems.org 'in the first line of the Gemfile file in the Project to https://gems.ruby-china.org/step3: $ cd Blog step4 in the Progress Project folder: install the specified gem $ bundle install in the Gemfile file and then start the service. $ rails server. After the installation is successful, enter the address http: // localhost: 3000 (port 3000 by default), you can view the default welcome page 6. modify the Command line window Edit> Profile Preferences> Command> Run Command as a login shell to check the installation process of the rails environment. The installation may fail because some files on the computer do not have to be installed, the following files (installation command) are missing: 1. sudo apt-get install ruby-dev2. sudo apt-get install libz-dev3. sudo apt-get install nodejs4. sudo apt-get install sqlite3