Последняя версия ruby для линукс

Download Ruby

Here you can get the latest Ruby distributions in your favorite flavor. The current stable version is 3.0.2. Please be sure to read Ruby’s License.

Ways of Installing Ruby

We have several tools on each major platform to install Ruby:

  • On Linux/UNIX, you can use the package management system of your distribution or third-party tools (rbenv and RVM).
  • On macOS machines, you can use third-party tools (rbenv and RVM).
  • On Windows machines, you can use RubyInstaller.

See the Installation page for details on using package management systems or third-party tools.

Of course, you can also install Ruby from source on all major platforms.

Compiling Ruby — Source Code

Installing from the source code is a great solution for when you are comfortable enough with your platform and perhaps need specific settings for your environment. It’s also a good solution in the event that there are no other premade packages for your platform.

See the Installation page for details on building Ruby from source. If you have an issue compiling Ruby, consider using one of the third party tools mentioned above. They may help you.

  • Stable releases:
    • Ruby 3.0.2
      sha256: 5085dee0ad9f06996a8acec7ebea4a8735e6fac22f22e2d98c3f2bc3bef7e6f1
    • Ruby 2.7.4
      sha256: 3043099089608859fc8cce7f9fdccaa1f53a462457e3838ec3b25a7d609fbc5b
  • In security maintenance phase (will EOL soon!):
    • Ruby 2.6.8
      sha256: 1807b78577bc08596a390e8a41aede37b8512190e05c133b17d0501791a8ca6d
  • Not maintained anymore (EOL):
    • Ruby 2.5.9
      sha256: f5894e05f532b748c3347894a5efa42066fd11cc8d261d4d9788ff71da00be68
  • Snapshots:
    • Stable Snapshot of ruby_3_0 branch: This is a tarball of the latest snapshot of the current ruby_3_0 branch.
    • Stable Snapshot of ruby_2_7 branch: This is a tarball of the latest snapshot of the current ruby_2_7 branch.
    • Stable Snapshot of ruby_2_6 branch: This is a tarball of the latest snapshot of the current ruby_2_6 branch.
    • Nightly Snapshot: This is a tarball of whatever is in Git, made nightly. This may contain bugs or other issues, use at your own risk!

For more information about specific releases, particularly older releases or previews, see the Releases page. Information about the current maintenance status of the various Ruby branches can be found on the Branches page.

For information about the Ruby Subversion and Git repositories, see our Ruby Core page.

The Ruby source is available from a worldwide set of Mirror Sites. Please try to use a mirror that is near you.

Источник

Как установить Ruby на Ubuntu 20.04

Ruby — один из самых популярных языков программирования сегодня. Он имеет элегантный синтаксис и ориентирован на простоту и производительность. Ruby — это язык, на котором стоит мощный фреймворк Ruby on Rails.

В этом руководстве мы покажем вам три разных способа установки Ruby на Ubuntu 20.04:

  • Из стандартных репозиториев Ubuntu. Это самый простой способ установить Ruby в Ubuntu, и его должно хватить для большинства случаев использования. Версия, включенная в репозитории Ubuntu, — 2.7.0 .
  • Используя Rbenv. Сценарий, позволяющий установить несколько версий Ruby на одном компьютере.
  • Использование RVM (ruby enVironment Manager). Более тяжелый и многофункциональный скрипт, который позволяет вам устанавливать, управлять и работать с несколькими версиями Ruby.

Выберите метод установки, подходящий для вашей среды. Если вы разрабатываете приложения Ruby и работаете в нескольких средах Ruby, то предпочтительным способом является установка Ruby с помощью Rbenv или RVM.

Читайте также:  Ati radeon x1400 drivers для windows

Если вы не уверены, какую версию Ruby установить, обратитесь к документации приложения, которое вы собираетесь развернуть.

Установка Ruby из репозиториев Ubuntu

Самый простой способ установить Ruby в Ubuntu — использовать менеджер пакетов apt . На момент написания в репозиториях Ubuntu используется 2.7.0 , которая не всегда может быть последней стабильной версией.

Установка довольно проста. Выполните следующие команды от имени пользователя root или пользователя с привилегиями sudo, чтобы обновить индекс пакета и установить Ruby:

После завершения проверьте установку, распечатав версию Ruby:

Результат будет выглядеть примерно так:

Ваша версия Ruby может отличаться от указанной выше.

Это оно! Вы успешно установили Ruby на свой компьютер с Ubuntu и можете начать его использовать.

Установка Ruby с помощью Rbenv

Rbenv — это легкий инструмент командной строки, который позволяет легко переключать версии Ruby.

По умолчанию rbenv не обрабатывает установку Ruby. Мы будем использовать ruby-build для установки Ruby. Он доступен как отдельная программа и как плагин для rbenv.

Сценарий ruby-build устанавливает Ruby из исходного кода. Чтобы собрать Ruby, установите необходимые библиотеки и компиляторы:

Самый простой способ установить инструмент rbenv — использовать сценарий оболочки установки. Запустите следующий curl или, чтобы загрузить и выполнить скрипт:

Скрипт клонирует репозитории rbenv и ruby-build из GitHub в каталог

Сценарий установщика также вызывает другой сценарий, который проверяет установку. Результат скрипта будет выглядеть примерно так:

Чтобы начать использовать rbenv, вам нужно добавить $HOME/.rbenv/bin в ваш PATH .

Если вы используете Bash:

Если вы используете Zsh:

Выполните команду rbenv -v чтобы убедиться, что установка прошла успешно:

Чтобы получить список всех версий Ruby, которые можно установить с помощью rbenv введите:

Например, чтобы установить Ruby версии 2.7.1 и сделать ее глобальной версией, вы должны ввести:

Rbenv работает, вставляя каталог с именем shims в начало пути PATH . Этот каталог содержит сценарии (оболочки), задачей которых является перехват команд Ruby и выполнение соответствующих двоичных файлов.

Rbenv позволяет вам установить оболочку, локальную и глобальную версию Ruby:

  • Версия оболочки используется в текущей оболочке и имеет наивысший приоритет. Его можно определить, установив RBENV_VERSION среды RBENV_VERSION с помощью rbenv shell .
  • Локальная версия устанавливается для каждого каталога отдельно. Эта версия записана в .ruby-version . Когда вы запускаете сценарий Ruby, rbenv ищет файл в текущем и всех родительских каталогах. Он использует версию Ruby, хранящуюся в первом найденном файле. Чтобы установить локальную версию, перейдите в каталог и выполните rbenv local .
  • Глобальная версия используется во всех оболочках, если не установлена оболочка или локальная версия. Используйте rbenv global чтобы установить глобальную версию.

Не используйте sudo для установки гемов, если Ruby управляется с помощью rbenv. Каждая версия Ruby устанавливается в

/.rbenv/versions записи пользователем.

Установка Ruby с использованием RVM

RVM — это инструмент командной строки, который можно использовать для установки, управления и работы с несколькими средами Ruby.

Установите зависимости, необходимые для сборки Ruby из исходного кода:

Выполните следующие команды, чтобы добавить ключ GPG и установить RVM:

Чтобы начать использовать RVM, загрузите переменные среды сценария с помощью source команды:

Чтобы получить список всех версий Ruby, которые можно установить с помощью этого инструмента, введите:

Установите последнюю стабильную версию Ruby с RVM и установите ее как версию по умолчанию:

Убедитесь, что Ruby был правильно установлен, напечатав номер версии:

Если вы хотите установить определенную версию Ruby, введите следующие команды. Замените xxx версией Ruby, которую вы хотите установить:

Чтобы переключиться на другую версию, не устанавливая ее в качестве Ruby по умолчанию, введите:

Для получения дополнительной информации о том, как управлять установками Ruby с помощью RVM, посетите их страницу документации .

Выводы

Мы показали вам три разных способа установки Ruby на Ubuntu 20.04. Выбор метода зависит от ваших требований и предпочтений. Несмотря на то, что установка упакованной версии из репозитория Ubuntu проще, сценарии Rbenv и RVM дают вам больше гибкости для использования разных версий Ruby для каждого пользователя.

Читайте также:  Как удалить mysql linux mint

Если у вас есть какие-либо вопросы или отзывы, не стесняйтесь оставлять комментарии ниже.

Источник

Installing Ruby

With package managers or third-party tools, you have plenty of options to install and manage Ruby.

You may already have Ruby installed on your computer. You can check inside a terminal emulator by typing:

This should output some information on the installed Ruby version.

Choose Your Installation Method

There are several ways to install Ruby:

  • On a UNIX-like operating system, using your system’s package manager is easiest. However, the packaged Ruby version may not be the newest one.
  • Installers can be used to install a specific or multiple Ruby versions. There is also an installer for Windows.
  • Managers help you to switch between multiple Ruby versions on your system.
  • Finally, you can also build Ruby from source.

On Windows 10, you can also use the Windows Subsystem for Linux to install one of the supported Linux distributions and use any of the installation methods available on that system.

Here are available installation methods:

Package Management Systems

If you cannot compile your own Ruby, and you do not want to use a third-party tool, you can use your system’s package manager to install Ruby.

Some members of the Ruby community feel that you should avoid package managers to install Ruby and that you should use dedicated tools instead.

It is possible that major package managers will install older Ruby versions instead of the latest release. To use the latest Ruby release, check that the package name matches its version number. Or use a dedicated installer.

apt (Debian or Ubuntu)

Debian GNU/Linux and Ubuntu use the apt package manager. You can use it like this:

yum (CentOS, Fedora, or RHEL)

CentOS, Fedora, and RHEL use the yum package manager. You can use it like this:

The installed version is typically the latest version of Ruby available at the release time of the specific distribution version.

snap (Ubuntu or other Linux distributions)

Snap is a package manager developed by Canonical. It is available out-of-the-box on Ubuntu, but snap also works on many other Linux distributions. You can use it like this:

We have several channels per Ruby minor series. For instance, the following commands switch to Ruby 2.3:

portage (Gentoo)

Gentoo uses the portage package manager.

To install a specific version, set RUBY_TARGETS in your make.conf . See the Gentoo Ruby Project website for details.

pacman (Arch Linux)

Arch Linux uses a package manager named pacman. To get Ruby, just do this:

This should install the latest stable Ruby version.

Homebrew (macOS)

Ruby versions 2.0 and above are included by default in macOS releases since at least El Capitan (10.11).

Homebrew is a commonly used package manager on macOS. Installing Ruby using Homebrew is easy:

This should install the latest Ruby version.

FreeBSD

FreeBSD offers both pre-packaged and source-based methods to install Ruby. Prebuilt packages can be installed via the pkg tool:

A source-based method can be used to install Ruby using the Ports Collection. This is useful if you want to customize the build configuration options.

More information about Ruby and its surrounding ecosystem on FreeBSD can be found on the FreeBSD Ruby Project website.

OpenBSD

OpenBSD as well as its distribution adJ has packages for the three major versions of Ruby. The following command allows you to see the available versions and to install one:

You can install multiple major versions side by side, because their binaries have different names (e.g. ruby27 , ruby26 ).

Читайте также:  Как сделать bsod windows 10

The HEAD branch of the OpenBSD ports collection might have the most recent version of Ruby for this platform some days after it is released, see directory lang/ruby in the most recent ports collection.

Ruby on OpenIndiana

To install Ruby on OpenIndiana, please use the Image Packaging System (IPS) client. This will install the Ruby binaries and RubyGems directly from the OpenIndiana repositories. It’s easy:

However, the third-party tools might be a good way to obtain the latest version of Ruby.

Windows Package Manager

On Windows, you can use the Windows Package Manager CLI to install Ruby:

Other Distributions

On other systems, you can search the package repository of your Linux distribution’s manager for Ruby. Alternatively, you can use a third-party installer.

Installers

If the version of Ruby provided by your system or package manager is out of date, a newer one can be installed using a third-party installer.

Some installers allow you to install multiple versions on the same system; associated managers can help to switch between the different Rubies.

If you are planning to use RVM as a version manager you don’t need a separate installer, it comes with its own.

ruby-build

ruby-build is a plugin for rbenv that allows you to compile and install different versions of Ruby. ruby-build can also be used as a standalone program without rbenv. It is available for macOS, Linux, and other UNIX-like operating systems.

ruby-install

ruby-install allows you to compile and install different versions of Ruby into arbitrary directories. chruby is a complimentary tool used to switch between Ruby versions. It is available for macOS, Linux, and other UNIX-like operating systems.

RubyInstaller

On Windows, RubyInstaller gives you everything you need to set up a full Ruby development environment.

Just download it, run it, and you are done!

Ruby Stack

If you are installing Ruby in order to use Ruby on Rails, you can use the following installer:

  • Bitnami Ruby Stack provides a complete development environment for Rails. It supports macOS, Linux, Windows, virtual machines, and cloud images.

Managers

Many Rubyists use Ruby managers to manage multiple Rubies. They allow easy or even automatic switching between Ruby versions depending on the project and other advantages but are not officially supported. You can however find support within their respective communities.

asdf-vm

asdf-vm is an extendable version manager that can manage multiple language runtime versions on a per-project basis. You will need the asdf-ruby plugin (which in turn uses ruby-build) to install Ruby.

chruby

chruby allows you to switch between multiple Rubies. It can manage Rubies installed by ruby-install or even built from source.

rbenv

rbenv allows you to manage multiple installations of Ruby. While it can’t install Ruby by default, its ruby-build plugin can. Both tools are available for macOS, Linux, or other UNIX-like operating systems.

RVM (“Ruby Version Manager”)

RVM allows you to install and manage multiple installations of Ruby on your system. It can also manage different gemsets. It is available for macOS, Linux, or other UNIX-like operating systems.

Uru is a lightweight, multi-platform command line tool that helps you to use multiple Rubies on macOS, Linux, or Windows systems.

Building from Source

Of course, you can install Ruby from source. Download and unpack a tarball, then just do this:

By default, this will install Ruby into /usr/local . To change, pass the —prefix=DIR option to the ./configure script.

You can find more information about building from source in the Ruby README file.

Using the third-party tools or package managers might be a better idea, though, because the installed Ruby won’t be managed by any tools.

Источник

Оцените статью