代码之家  ›  专栏  ›  技术社区  ›  Evelin Ponce

如何在Windows10中安装Ruby2.4.0

  •  0
  • Evelin Ponce  · 技术社区  · 6 年前

    我有个ror项目需要不同版本的Ruby,其中一个需要Ruby2.4.0。有PostgreSQL。i_m使用带Windows 10的PC。

    如何在Linux中安装多个Ruby版本 旅游价值管理 是吗?在哪里可以下载Ruby2.4.0 for Windows?(我看到rubyinstaller.org没有这个版本)

    1 回复  |  直到 6 年前
        1
  •  -1
  •   Evelin Ponce    6 年前

    在本教程中,我们将在Windows、Ruby2.4.0、Rails 5.0.1和PostgreSQL上设置Ubuntu。

    1. 首先在您的计算机上启用开发人员模式 https://www.youtube.com/watch?v=S6NvjvL3xaI

    2. https://www.youtube.com/watch?v=g_5hxfFKDL8

    3. 然后重新启动计算机。

    4. > bash
      
    5. 您将看到下一条消息

      This will install Ubuntu on Windows, distributed by Canonical
      and licensed under its terms available here:
      https://aka.ms/uowterms
      Press "y" to continue: y
      
    6. Downloading from the Windows Store... 100%
      Extracting filesystem, this will take a few minutes….
      
    7. bash会向您请求一个用户,请记住这个用户,因为每次您需要bash中的根权限时,bash都会向您询问。同样,当你给密码计时时,你不会看到击键,这是正常的,只需继续输入并按 当你完成的时候。

      Please create a default UNIX user account. The username does not need to match your Windows username.
      For more information visit: https://aka.ms.wslusers
      Enter new UNIX username:
      Enter new UNIX password:
      
    8. mnt/c/Users/your_username 目录。

    安装RVM和Ruby

    1. $ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
      
    2. 然后安装GNUP2

      $ sudo apt-get install gnupg2
      

    sudo 在命令中,您将被要求输入密码。

    1. https://get.rvm.io

      $ cat rvm.sh | bash -s stable
      
      $ source ~/.rvm/scripts/rvm
      
    2. $ rvm install ruby-2.4.0
      

    如果需要安装其他版本的Ruby,请运行如下相同的命令

    $ rvm install ruby-2.3.5

    $ rvm --default use 2.3.5

    $ ruby -v

    1. 安装rubys包管理器bundler

      $ gem install bundler 
      
    2. $ curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
      
      $ sudo apt-get install -y nodejs
      
    3. 安装导轨

      $ gem install rails
      

    1. 下载PostgreSQL安装程序并按照安装说明操作 https://www.openscg.com/bigsql/postgresql/installers.jsp/

    2. database.yml

    3. 安装完成后,返回bash并键入下一个命令

      $psql -p 5432 -h localhost -U your_postgresql_username
      
    4. psql (9.5.6, server 9.6.2)
      WARNING: psql major version 9.5, server major version 9.6.
      Some psql features might not work.
      Type "help" for help.
      postgres=#
      

    1. development:
        database: your_app_name_development
        username: your_postgres_user
        password: your_postgres_password
        host: localhost
        port: 5432
      
      test:
        database: your_app_name_test
        username: your_postgres_user
        password: your_postgres_password
        host: localhost
        port: 5432
      
    2. $ cd Projects/my_app
      

    要了解有关bash导航的更多信息,请访问 https://www.pluralsight.com/guides/beginner-linux-navigation-manual

    1. $ rake db:create
      
    2. $ rails s
      
    3. 去你的浏览器访问

      $ localhost:3000
      

    >bash -l

    https://www.digitalocean.com/community/tutorials/how-to-install-ruby-and-set-up-a-local-programming-environment-on-windows-10

    https://medium.com/@colinrubbert/installing-ruby-on-rails-in-windows-10-w-bash-postgresql-e48e55954fbf