Skip to content

Commit 4f49dc6

Browse files
committed
Translate installation to latest content (zh_tw)
1 parent 8339201 commit 4f49dc6

File tree

1 file changed

+133
-33
lines changed
  • zh_tw/documentation/installation

1 file changed

+133
-33
lines changed

zh_tw/documentation/installation/index.md

Lines changed: 133 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ lang: zh_tw
77
有很多工具可以安裝 Ruby。本頁介紹如何使用主流的套件管理工具以及第三方工具來管理、安裝 Ruby 以及如何從原始碼來編譯 Ruby。
88
{: .summary}
99

10+
如果您已經在您的電腦上安裝了 Ruby。您可以在 [terminal emulator][terminal] 中執行以下指令確認:
11+
12+
{% highlight sh %}
13+
ruby -v
14+
{% endhighlight %}
15+
16+
輸出結果應該會顯示已安裝的 Ruby 版本資訊。
1017

1118
## 選擇安裝方式
1219

@@ -22,19 +29,26 @@ lang: zh_tw
2229
* [套件管理系統](#package-management-systems)
2330
* [Debian、Ubuntu](#apt)
2431
* [CentOS、Fedora、RHEL](#yum)
32+
* [Snap](#snap)
2533
* [Gentoo](#portage)
2634
* [Arch Linux](#pacman)
2735
* [macOS](#homebrew)
28-
* [Solaris、OpenIndiana](#solaris)
29-
* [其他發行版](#other-systems)
36+
* [FreeBSD](#freebsd)
37+
* [OpenBSD](#openbsd)
38+
* [OpenIndiana](#openindiana)
39+
* [Windows Package Manager](#winget)
40+
* [Chocolatey package manager for Windows](#chocolatey)
41+
* [其它發行版](#other-systems)
3042
* [安裝工具](#installers)
3143
* [ruby-build](#ruby-build)
3244
* [ruby-install](#ruby-install)
3345
* [RubyInstaller](#rubyinstaller) (Windows)
34-
* [RailsInstaller 和 Ruby 安裝包](#railsinstaller)
46+
* [Ruby Stack](#rubystack)
3547
* [版本管理](#managers)
48+
* [asdf-vm](#asdf-vm)
3649
* [chruby](#chruby)
3750
* [rbenv](#rbenv)
51+
* [rbenv for Windows](#rbenv-for-windows)
3852
* [RVM](#rvm)
3953
* [uru](#uru)
4054
* [從原始碼編譯](#building-from-source)
@@ -47,19 +61,31 @@ lang: zh_tw
4761

4862
許多 Ruby 社群的成員強烈建議不要使用套件管理工具來安裝 Ruby,應該使用下面羅列的工具來取代。完整的優缺點超出了本文的範疇,最簡單的理由是,多數的套件管理工具安裝的 Ruby 版本老舊,如果想要使用最新版的 Ruby,確認你安裝了正確名稱的套件,或使用下面其他的工具吧。
4963

64+
本文包含以下套件管理工具說明:
65+
66+
* [Debian, Ubuntu](#apt)
67+
* [CentOS, Fedora,RHEL](#yum)
68+
* [Snap](#snap)
69+
* [Gentoo](#portage)
70+
* [Arch Linux](#pacman)
71+
* [macOS](#homebrew)
72+
* [FreeBSD](#freebsd)
73+
* [OpenBSD](#openbsd)
74+
* [OpenIndiana](#openindiana)
75+
* [Windows Package manager](#winget)
76+
* [Chocolatey package manager for Windows](#chocolatey)
77+
* [Other Distribution](#other-systems)
5078

5179
### apt(Debian 或 Ubuntu)
5280
{: #apt}
5381

54-
Debian GNU/Linux 和 Ubuntu 的使用者可以使用 apt。
82+
Debian GNU/Linux 和 Ubuntu 的使用者可以使用 apt 套件管理工具
5583
用法:
5684

5785
{% highlight sh %}
58-
$ sudo apt-get install ruby
86+
$ sudo apt-get install ruby-full
5987
{% endhighlight %}
6088

61-
撰文當下 `ruby` 套件在 Debian 與 Ubuntu 平台上所提供的版本是老舊的穩定版 Ruby 2.3.1。
62-
6389

6490
### yum(CentOS、Fedora 或 RHEL)
6591
{: #yum}
@@ -73,6 +99,23 @@ $ sudo yum install ruby
7399

74100
安裝的版本通常是作業系統發行版發行日所打包的最新版 Ruby。
75101

102+
### snap (Ubuntu or other Linux distributions)
103+
{: #snap}
104+
105+
Snap 是 Canonical 所開發的套件管理工具。內建於 Ubuntu,但 snap 也能在許多其他的 Linux 發行版上使用。
106+
用法:
107+
108+
{% highlight sh %}
109+
$ sudo snap install ruby --classic
110+
{% endhighlight %}
111+
112+
我們為每個 Ruby 小版本提供了幾個 channel。
113+
例如,使用以下指令切換到 Ruby 2.3:
114+
115+
{% highlight sh %}
116+
$ sudo snap switch ruby --channel=2.3/stable
117+
$ sudo snap refresh
118+
{% endhighlight %}
76119

77120
### portage(Gentoo)
78121
{: #portage}
@@ -83,7 +126,7 @@ Gentoo 使用 portage 套件管理工具。
83126
$ sudo emerge dev-lang/ruby
84127
{% endhighlight %}
85128

86-
預設會試著安裝 1.9 和 2.0,但還能安裝更多版本。要安裝特定版本,在 `make.conf` 設定 `RUBY_TARGETS`。進一步了解請參考 [Gentoo Ruby 專案網站][gentoo-ruby]
129+
要安裝特定版本,在 `make.conf` 設定 `RUBY_TARGETS`。進一步了解請參考 [Gentoo Ruby 專案網站][gentoo-ruby]
87130

88131

89132
### pacman (Arch Linux)
@@ -102,39 +145,81 @@ $ sudo pacman -S ruby
102145
### Homebrew(macOS)
103146
{: #homebrew}
104147

105-
OS X El Capitan、Yosemite 以及 Mavericks 內建 Ruby 2.0。
106-
OS X Mountain Lion、Lion 以及 Snow Leopard 出廠內建 Ruby 1.8.7。
148+
從 macOS El Capitan(10.11) 以上內建 Ruby 2.0 以上版本。
107149

108-
macOS 的使用者使用 [Homebrew][homebrew] 作為套件管理工具。
150+
macOS 使用者多數使用 [Homebrew][homebrew] 作為套件管理工具。
109151
用法:
110152

111153
{% highlight sh %}
112154
$ brew install ruby
113155
{% endhighlight %}
114156

115-
會安裝最新穩定版的 Ruby。
157+
會安裝最新版的 Ruby。
158+
159+
### FreeBSD
160+
{: #freebsd}
161+
162+
FreeBSD 提供以預編譯和從原始碼編譯的方法安裝 Ruby。
163+
預編譯的套件可以透過 pkg 工具安裝:
164+
165+
{% highlight sh %}
166+
$ pkg install ruby
167+
{% endhighlight %}
116168

169+
從原始碼編譯的方法可以透過使用 [Ports Collection][freebsd-ports-collection] 來安裝 Ruby。
170+
當您想要客製化建置設定選項時,這非常好用。
117171

118-
### Solaris 和 OpenIndiana 平台
119-
{: #solaris}
172+
更多在 FreeBSD 上使用 Ruby 與其生態系的資訊,請參考 [FreeBSD Ruby Project website][freebsd-ruby]
120173

121-
[Sunfreeware][sunfreeware] 上的 Solaris 8 到 10 版有 Ruby 1.8.7 可用,同時 Blastwave 上也有 Ruby 1.8.7。Ruby 1.9.2p0 在 [Sunfreeware][sunfreeware] 也有,但版本已經過時了。
174+
### OpenBSD
175+
{: #openbsd}
122176

123-
要在 [OpenIndiana][openindiana] 安裝 Ruby,請使用:
124-
[Image Packaging System (IPS)][opensolaris-pkg] 客戶端。
125-
這會直接從 OpenSolaris 網路的原始碼庫安裝最新的 Ruby 1.9 以及 RubyGems:
177+
OpenBSD 在發行版本 adJ 中有三個主要 Ruby 版本套件。以下指令可以看到可用的版本並進行安裝:
126178

127179
{% highlight sh %}
128-
$ pkg install runtime/ruby-18
180+
$ doas pkg_add ruby
181+
{% endhighlight %}
182+
183+
您可以同時安裝多個主要版本,因為它們的執行檔的名稱不同 (例如:`ruby27`, `ruby26`)。
184+
185+
OpenBSD ports collection 的 `HEAD` 分支可能會在最新的 Ruby 版本釋出幾天後,在該平台提供,請參考 [最新 ports collections 的 lang/ruby][openbsd-current-ruby-ports]
186+
187+
### Ruby on OpenIndiana
188+
{: #openindiana}
189+
190+
[OpenIndiana][openindiana] 上安裝 Ruby,請使用 Image Packaging System (IPS) 客戶端。
191+
這將會直接從 OpenIndiana repositories 安裝 Ruby 與 RubyGems。用法:
192+
193+
{% highlight sh %}
194+
$ pkg install runtime/ruby
129195
{% endhighlight %}
130196

131197
但用第三方工具來獲得最新版本 Ruby 可能比較好。
132198

199+
### Windows Package Manager
200+
{: #winget}
201+
202+
在 Windows 上您可以使用 [Windows Package Manager CLI](https://github.com/microsoft/winget-cli) 來安裝 Ruby:
203+
204+
{% highlight sh %}
205+
> winget install RubyInstallerTeam.Ruby
206+
{% endhighlight %}
207+
208+
### Chocolatey package manager for Windows
209+
{: #chocolatey}
210+
211+
在 Windows 上您也可以使用 [Chocolatey Package Manager](https://chocolatey.org/install) 來安裝 Ruby:
212+
213+
{% highlight sh %}
214+
> choco install ruby
215+
{% endhighlight %}
216+
217+
它會使用現有的 `msys2` 或是進行安裝以提供完整的 Ruby 開發環境。
133218

134219
### 其它發行版
135220
{: #other-systems}
136221

137-
其它作業系統可以在發行版的套件庫上搜尋 Ruby,或是使用第三方工具可能會比較好
222+
其它作業系統可以在發行版的套件庫上搜尋 Ruby,或是使用[第三方工具](#installers)可能會比較好
138223

139224

140225
## 安裝工具
@@ -164,14 +249,11 @@ Windows 使用者,可以使用這個很棒的專案來幫助您安裝 Ruby:
164249
下載、執行,即可!
165250

166251

167-
### RailsInstaller 和 Ruby 安裝包
168-
{: #railsinstaller}
252+
### Ruby Stack
253+
{: #rubystack}
169254

170255
若安裝 Ruby 是為了要開發 Ruby on Rails,則可用下列的安裝工具:
171256

172-
* [RailsInstaller][railsinstaller],
173-
背後使用的是 RubyInstaller,但帶有 Rails 開發環境所需的工具。
174-
支援 OS X 與 Windows。
175257
* [Bitnami Ruby Stack][rubystack],
176258
提供完整的 Rails 開發環境。
177259
兼容 macOS、Linux、Windows、虛擬機器以及雲鏡像。
@@ -182,17 +264,26 @@ Windows 使用者,可以使用這個很棒的專案來幫助您安裝 Ruby:
182264

183265
許多 Rubyists 使用 Ruby 版本管理工具來管理多版本的 Ruby。版本管理工具有很多優點,但要注意 Ruby 官方並不提供技術支援。但要提的是每個工具背後的社群都非常有幫助。
184266

267+
### asdf-vm
268+
{: #asdf-vm}
269+
270+
[asdf-vm][asdf-vm] 是一個可擴展的版本管理工具,可基於個別專案來管理多語言執行版本。您需要 [asdf-ruby][asdf-ruby] 插件 (使用 [ruby-build][ruby-build]) 來安裝 Ruby。
271+
185272

186273
### chruby
187274
{: #chruby}
188275

189-
[chruby][chruby] 可以切換 Ruby 版本。chruby 可以管理由 [ruby-install](#ruby-install) 所安裝的 Ruby,或是從原始碼所編譯的 Ruby。
190-
276+
[chruby][chruby] 可以在系統上管理多個版本的 Ruby。chruby 本身無法安裝 Ruby 但可以透過插件像是 [ruby-install][ruby-install][ruby-build][ruby-build] 安裝 Ruby。支援 macOS、Linux 和其他類 UNIX 的作業系統。
191277

192278
### rbenv
193279
{: #rbenv}
194280

195-
[rbenv][rbenv] 可以在系統上安裝多個版本的 Ruby。rbenv 本身不能安裝 Ruby,但有一個流行的插件,叫做 ruby-build,可以用來安裝 Ruby。支援 macOS、Linux 和其它類 Unix 的作業系統。
281+
[rbenv][rbenv] 可以在系統上管理多個版本的 Ruby。rbenv 本身不能安裝 Ruby,但可以使用插件 [ruby-build][ruby-build] 安裝 Ruby。支援 macOS、Linux 和其它類 Unix 的作業系統。
282+
283+
### rbenv for Windows
284+
{: #rbenv-for-windows}
285+
286+
[rbenv for Windows][rbenv-for-windows] 可以在 Windows 作業系統上安裝多個版本的 Ruby。它是用 PowerShell 撰寫並提供 Windows 使用者原生方法來使用 Ruby。使用方式相容於在類 Unix 的作業系統上的 [rbenv][rbenv]
196287

197288

198289
### RVM ("Ruby Version Manager")
@@ -221,20 +312,29 @@ $ sudo make install
221312

222313
預設會安裝 Ruby 到 `/usr/local` 目錄。要更改安裝目錄請在使用 `./configure` 腳本時傳入 `--prefix=DIR` 選項。
223314

315+
您可以在 [Building Ruby instructions][building-ruby] 找到更多關於從原始碼編譯的資訊。
316+
224317
使用第三方工具或套件管理工具來安裝可能比較好,因為從原始碼編譯安裝的 Ruby 無法用任何工具管理。
225318

226319

227320
[rvm]: http://rvm.io/
228-
[rbenv]: https://github.com/rbenv/rbenv#readme
321+
[rbenv]: https://github.com/rbenv/rbenv
322+
[rbenv-for-windows]: https://github.com/ccmywish/rbenv-for-windows#readme
229323
[ruby-build]: https://github.com/rbenv/ruby-build#readme
230324
[ruby-install]: https://github.com/postmodern/ruby-install#readme
231-
[chruby]: https://github.com/postmodern/chruby#readme
232-
[uru]: https://bitbucket.org/jonforums/uru
325+
[chruby]: https://github.com/postmodern/chruby
326+
[uru]: https://bitbucket.org/jonforums/uru/src/master/
233327
[rubyinstaller]: https://rubyinstaller.org/
234-
[railsinstaller]: http://railsinstaller.org/
235328
[rubystack]: http://bitnami.com/stack/ruby/installer
236-
[sunfreeware]: http://www.sunfreeware.com
237329
[openindiana]: http://openindiana.org/
238330
[opensolaris-pkg]: http://opensolaris.org/os/project/pkg/
239331
[gentoo-ruby]: http://www.gentoo.org/proj/en/prog_lang/ruby/
332+
[freebsd-ruby]: https://wiki.freebsd.org/Ruby
333+
[freebsd-ports-collection]: https://docs.freebsd.org/en/books/handbook/ports/#ports-using
240334
[homebrew]: http://brew.sh/
335+
[terminal]: https://en.wikipedia.org/wiki/List_of_terminal_emulators
336+
[building-ruby]: https://github.com/ruby/ruby/blob/master/doc/contributing/building_ruby.md
337+
[wsl]: https://learn.microsoft.com/zh-tw/windows/wsl/about
338+
[asdf-vm]: https://asdf-vm.com/
339+
[asdf-ruby]: https://github.com/asdf-vm/asdf-ruby
340+
[openbsd-current-ruby-ports]: https://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/lang/ruby/?only_with_tag=HEAD

0 commit comments

Comments
 (0)