简体   繁体   English

在Ubuntu 14.04上安装ruby的合适方法是什么

[英]What is appropriate way to install ruby on Ubuntu 14.04

I have a computer serves as a server. 我有一台计算机充当服务器。 I have bitnami-gitlab stack on it. 我上面有bitnami-gitlab堆栈。 And now I want to install my rails app to this server. 现在,我想将Rails应用程序安装到该服务器上。 The thing confuses me, bitnami-gitlab has ruby interpreter and other apps (rails , gem, bundler etc.). 令我感到困惑的是,bitnami-gitlab具有ruby解释器和其他应用程序(rails,gem,bundler等)。 Gitlab application uses git user on ubuntu. Gitlab应用程序在ubuntu上使用git用户。 When I type; 当我打字时

sudo su git
which ruby

It gives me the directory of ruby which is inside of bitnami installation directory. 它为我提供了bitnami安装目录中的ruby目录。 Now, I want to install ruby, rails, apache and passenger to deploy my rails app. 现在,我想安装ruby,rails,apache和passenger来部署我的rails应用程序。 What is the appropriate way to do? 合适的方法是什么? I want to start my rails app as boot time. 我想以启动时间启动我的Rails应用程序。 Should I install ruby to root user or my own user? 我应该为root用户还是我自己的用户安装ruby? When I install ruby, will my gitlab application crahs? 当我安装ruby时,我的gitlab应用程序会崩溃吗?

Here is how I do it > 这是我的方法>

First, update apt-get: 首先,更新apt-get:

sudo apt-get update

Then if you do not have it install Curl, for installing RVM 然后,如果没有安装Curl,则用于安装RVM

 sudo apt-get install curl

Then run the appropriate RVM install there are multiple options like added rails, puma JRuby etc. check RVM website for more info. 然后运行适当的RVM安装,有多个选项,例如添加的rails,puma JRuby等。请查看RVM网站以获取更多信息。 For just ruby run > 对于仅红宝石运行>

\curl -L https://get.rvm.io | bash -s stable

Now exit the shell session and start a new one 现在退出shell会话并开始一个新的会话

source ~/.rvm/scripts/rvm

RVM has its own requirements that can be auto installed by running > RVM有其自己的要求,可以通过运行>自动安装

rvm requirements

Now managing you ruby environments is easy and you can have multiple versions without making a mess. 现在,您可以轻松管理红宝石环境,并且可以拥有多个版本而不会造成混乱。

To install any ruby version you need just run (xxx) version of the ruby> 要安装任何红宝石版本,您只需要运行(xxx)版本的红宝石>

rvm install x.x.x

To list versions you have installed run > 要列出已安装的版本,请运行>

rvm list 

Note also that now you can specify in your GEMFILE what version to use. 还请注意,现在您可以在GEMFILE中指定要使用的版本。 Simply add ruby 'xxx' and rvm uses the version you specified as long as its already installed. 只需添加ruby'xxx ruby 'xxx'并且rvm使用您指定的版本(只要已安装)即可。 Not having it raises error. 没有它会引发错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM