diff --git a/en/documentation/installation/index.md b/en/documentation/installation/index.md index 2488273194..9f0253b89a 100644 --- a/en/documentation/installation/index.md +++ b/en/documentation/installation/index.md @@ -35,6 +35,7 @@ Here are available installation methods: * [Package Management Systems](#package-management-systems) * [Debian, Ubuntu](#apt) * [CentOS, Fedora, RHEL](#yum) + * [Snap](#snap) * [Gentoo](#portage) * [Arch Linux](#pacman) * [macOS](#homebrew) @@ -96,6 +97,23 @@ 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 distribution) +{: #snap} + +Snap is a package manager developed by Canonical. It's available out-of-the-box on Ubuntu, but snap also works on many Linux distributions. +You can use it like this. + +{% highlight sh %} +$ sudo snap install ruby --classic +{% endhighlight %} + +We have several channels per Ruby minor series. For instance, the following commands switch to Ruby 2.3: + +{% highlight sh %} +$ sudo snap switch ruby --channel=2.3/stable +$ sudo snap refresh +{% endhighlight %} + ### portage (Gentoo) {: #portage} diff --git a/en/news/_posts/2018-11-08-snap.md b/en/news/_posts/2018-11-08-snap.md new file mode 100644 index 0000000000..320fc93017 --- /dev/null +++ b/en/news/_posts/2018-11-08-snap.md @@ -0,0 +1,39 @@ +--- +layout: news_post +title: The official ruby snap is available +author: Hiroshi SHIBATA +translator: +date: 2018-11-08 14:58:28 +0000 +lang: en +--- + +We released the official snap package of Ruby language. + +https://snapcraft.io/ruby + +Snap is a package system developed by Canonical. It allows you to distribute a software with its dependencies for many different Linux systems. This solves the problem that a user cannot install the latest Ruby release from the default repository of their system like in rpm or apt. + +On Ubuntu 16.04 or later, you can use Ruby snap with the following command: + +    sudo snap install ruby -classic + +(If you use other Linux distributions, please refer to https://docs.snapcraft.io/installing-snapd/6735) + +Our snap uses the "channel" feature to release multiple Ruby series concurrently. For example, without specifying a channel, 2.5.3 will be installed. But if you want to use Ruby 2.4, specify the 2.4 channel like the following: + +    sudo snap install ruby --classic --channel=2.4/stable + +You can also use multiple channels. The following commands switch to Ruby 2.3: + +    sudo snap switch ruby --channel=2.3/stable +    sudo snap refresh + +Our snap set `$HOME/.gem` to `GEM_HOME` and `GEM_PATH` environment variable. So if you want to execute commands installed by rubygems such as rails and rspec without using bundle exec, you have to add the following line to your shell rc files (like .bashrc): + +    eval `ruby.env` + +Since `$HOME/.gem` is shared by multiple versions, if you switch versions and use them, you will need to recompile C extensions using the `gem pristin --extensions` command. + +The initial version of official Ruby snap has released during Snapcraft summit held at Canonical office in London on Nov 6-8th, 2018. Any feedbacks are welcomed at https://github.com/ruby/snap.ruby. + +Enjoy! diff --git a/ja/news/_posts/2018-11-08-snap.md b/ja/news/_posts/2018-11-08-snap.md new file mode 100644 index 0000000000..1e7b392e52 --- /dev/null +++ b/ja/news/_posts/2018-11-08-snap.md @@ -0,0 +1,37 @@ +--- +layout: news_post +title: The official ruby snap is available +author: Hiroshi SHIBATA +translator: +date: 2018-11-08 14:58:28 +0000 +lang: ja +--- + +Ruby の公式 snap パッケージをリリースしました。 + +https://snapcraft.io/ruby + +snap は canonical が開発している新しいパッケージシステムです。独自のファイルシステムを利用して、バイナリの動作に必要なライブラリを全てパッケージングして配布することができます。snap を利用することで、 yum や apt のような Linux ディストリビューションのパッケージシステムを利用した時に、任意のバージョンをユーザーが自由に使うことができない問題を解決しました。 + +Ubuntu 16.04 以降のディストリビューションなら以下のコマンドで snap ruby を使うことができます。 + + sudo snap install ruby --classic + +Ubuntu 以外のディストリビューションで snap を利用する場合の準備については https://docs.snapcraft.io/installing-snapd/6735 を参照してください。 + +Ruby の snap パッケージは channel と呼ばれる機能を用いて、現在メンテナンスしているバージョンを配信しています。例えば、2018/11 現在 channel を指定しない場合は 2.5.3 がインストールされますが、2.4 を利用したい場合は以下のように指定します。 + + sudo snap install ruby --classic --channel=2.4/stable + +snap の機能を使うと複数の Ruby のバージョンを利用することができます。例えば、Ruby 2.3 に切り替えるには以下のコマンドを実行します。 + + sudo snap switch ruby --channel=2.3/stable + sudo snap refresh + +また、snap の制限事項として、RubyGems は `$HOME/.gem` にインストールされるように GEM_HOME と GEM_PATH を設定しています。そのため、rails や rspec などのコマンドを `bundle exec` を用いずに実行したい場合は以下の行を `.bashrc` などに設定する必要があります。 + + eval `ruby.env` + +`$HOME/.gem` は複数のバージョンで共有されるため、バージョンを切り替えて利用した場合、C 拡張などは `gem pristin --extensions` コマンドを用いて再コンパイルする必要があります。 + +この ruby snap は 11/6-8 にロンドンの canonical オフィスで開催された snapcraft summit で初めて公式バージョンをリリースしました。不具合やフィードバックは https://github.com/ruby/snap.ruby で受け付けています。お楽しみください。