Environment configuration before learning ruby on rails

     Learn the environment configuration before ruby ​​on rails, here I choose to install ruby ​​with rvm.

     rvm stands for Ruby Version Manager, which is a very useful ruby ​​version management and installation command line tool

     First, install rvm ($ is the command line flag, it should not be included in the code when inputting in the terminal)

$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
$ curl -sSL https://get.rvm.io | bash -s stable
# Usually there is no error, if there is an error, you can try:
$ curl -L https://raw.githubusercontent.com/wayneeseguin/rvm/master/binscripts/rvm-installer |
 bash -s stable

    Load the rvm environment

$ source ~ / .rvm / scripts / rvm

    Mirroring using Ruby China  

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

    List the existing rvm list

$ rvm list

    Select a version to install (2.3.0 is selected here)

$ rvm install 2.3.0

    set default version

$ rvm use 2.3.0 --default

    If you want to uninstall an older version of ruby, you can do

$ rvm list
$ rvm remove [version number you want to uninstall]

    change source

$ gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
#To ensure that only the previous line of gems.ruby-china.org can be executed separately
$ gem sources --remove https://rubygems.org/
$ gem sources --add https://gems.ruby-china.org/

    Install bundler 

$ gem install bundler
#bundler is a tool for managing gems, which can check whether the gems and dependencies specified in the Gemfile are installed

   install rails

$ gem install rails

   If there is no problem here, the environment is basically configured, but there is still a possible problem. You use the terminal every time you close it.

$ ruby -v

    To check that the ruby ​​version is still the old version of ruby, you can use the command

$ /bin/bash --login

    So you can use the new version

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327080308&siteId=291194637