在Linux上安装RVM

介绍 ( Introduction )

Getting your Linux environment set up for RVM is the hardest part of installing RVM itself. If you're unfamiliar with the process of compiling Ruby from source, you can get a little lost. Thankfully, distributions like Ubuntu make things pretty easy.

为RVM设置Linux环境是安装RVM本身最困难的部分。 如果您不熟悉从源代码编译Ruby的过程,可能会有些迷失。 幸运的是,像Ubuntu这样的发行版使事情变得很容易。

These instructions are written on Ubuntu. For the most part, they will apply to any Debian or Ubuntu based distribution. For other distributions, the package names may differ, but the same libraries and such need to be installed.

这些说明是在Ubuntu上编写的。 在大多数情况下,它们将适用于任何基于Debian或Ubuntu的发行版。 对于其他发行版,程序包名称可能不同,但是需要安装相同的库。

安装GCC和其他工具 ( Install GCC and Other Tools )

First and foremost you need the C compiler and the Make utility. These are usually bundled together with some other tools and behind the scenes magic in a package called build-essential. So this is the first package that should be installed.

首先,您需要C编译器和Make实用程序。 这些通常与其他一些工具捆绑在一起,并在一个称为build-essential的软件包中隐藏在魔术中。 因此,这是应该安装的第一个软件包。

$ sudo apt-get install build-essential
$ sudo apt-get install build-essential

In addition, RVM will also need curl to download files. This is also a simple apt-get.

此外,RVM还需要curl才能下载文件。 这也是一个简单的apt-get。

$ sudo apt-get install curl
$ sudo apt-get安装curl

安装开发库 ( Install Development Libraries )

Next, you're going to need a few libraries and their development package counterparts. Two of these libraries are readline, which lets you edit lines of text in bash or IRB, and zlib, which Rubygems will need to function. Also included is OpenSSL and LibXML.

接下来,您将需要一些库及其对应的开发包。 这些库中有两个是readline,它使您可以编辑bash或IRB中的文本行以及Rubygems需要运行的zlib。 还包括OpenSSL和LibXML。

$ sudo apt-get install zlib1g-dev libreadline-dev libssl-dev libxml2-dev
$ sudo apt-get install zlib1g-dev libreadline-dev libssl-dev libxml2-dev

安装RVM ( Install RVM )

Now that you're all set up, install RVM itself. This is done via a shell script which you can download and run directly with a single command.

现在已经完成所有设置,请自行安装RVM。 这是通过Shell脚本完成的,您可以通过一个脚本直接下载并运行它。

$ bash -s stable

Append the following line to your ~/.bashrc file.

将以下行添加到〜/ .bashrc文件中。

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM

And then reload your bash environment (or close the terminal window and open a new one).

然后重新加载您的bash环境(或关闭终端窗口并打开一个新窗口)。

$ source ~/.bashrc

有关要求的更多信息 ( More About Requirements )

In later versions of RVM, an rvm requirements command was added to give you more information about the build and run requirements for various rubies. You can see and peruse this list of requirements by running rvm requirements.

在更高版本的RVM中,添加了rvm requirements命令,以为您提供有关各种Ruby的构建和运行要求的更多信息。 您可以通过运行rvm requirements查看并仔细阅读此需求列表。

$ rvm requirements

It even gives you handy apt-get commands you can simply copy and paste.

它甚至为您提供了方便的apt-get命令,您只需复制和粘贴即可。

安装一个Ruby ( Install a Ruby )

You'll probably want to install the MRI Ruby interpreter (the official Ruby interpreter, the one you're probably already familiar with). To do that (after you installed the build dependencies, see the previous steps), it's a simple rvm install 1.9.3. This will give you the MRI interpreter version 1.9.3 (the stable release at the time this article was written) at the latest patch level.

您可能需要安装MRI Ruby解释器(正式的Ruby解释器,您可能已经很熟悉了)。 为此(在安装了构建依赖项之后,请参见前面的步骤),这是一个简单的rvm install 1.9.3 。 这将为您提供最新补丁程序级别的MRI解释器1.9.3版(在撰写本文时为稳定版本)。

$ rvm install 1.9.3

And that's it. Remember to rvm use 1.9.3 before you start using Ruby and that's it, Ruby is installed.

就是这样。 在开始使用Ruby之前,请记住要在rvm中使用1.9.3 ,就是这样,已经安装了Ruby。

翻译自: https://www.thoughtco.com/installing-rvm-on-linux-2908252

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值