アーカイブ

‘rvm’ タグのついている投稿

rvmを使ってrubyをインストール

2013 年 7 月 1 日 コメントはありません

CentOS6.3にrvmを使ってrubyをインストールします。

rvmは(Ruby enVironment Manager)の略で、rubyに必要なライブラリをインストールしたり、1つの環境に複数バージョンのrubyをインストールしたりできるようにするプログラムです。
>rvmのインストール方法はこちら。

インストール可能なプログラムの一覧を表示する

rvm list known

# rvm list known
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-p371]
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p320]
[ruby-]1.9.3-p125
[ruby-]1.9.3-p194
[ruby-]1.9.3-p286
[ruby-]1.9.3-p327
[ruby-]1.9.3-p362
[ruby-]1.9.3-p374
[ruby-]1.9.3-p385
[ruby-]1.9.3-p392
[ruby-]1.9.3[-p429]
[ruby-]1.9.3-head
[ruby-]2.0.0-rc1
[ruby-]2.0.0-rc2
[ruby-]2.0.0-p0
[ruby-]2.0.0[-p195]
ruby-head

# GoRuby
goruby

# Topaz
topaz

# TheCodeShop - MRI experimental patches
tcs

# jamesgolick - All around gangster
jamesgolick

# Minimalistic ruby implementation - ISO 30170:2012
mruby[-head]

# JRuby
jruby-1.2.0
jruby-1.3.1
jruby-1.4.0
jruby-1.6.5.1
jruby-1.6.6
jruby-1.6.7.2
jruby-1.6.8
jruby[-1.7.4]
jruby-head

# Rubinius
rbx-1.0.1
rbx-1.1.1
rbx-1.2.3
rbx-1.2.4
rbx[-head]
rbx-2.0.testing
rbx-2.0.0-rc1

# Ruby Enterprise Edition
ree-1.8.6
ree[-1.8.7][-2012.02]

# Kiji
kiji

# MagLev
maglev[-head]
maglev-1.0.0

# Mac OS X Snow Leopard Or Newer
macruby-0.10
macruby-0.11
macruby[-0.12]
macruby-nightly
macruby-head

# Opal
opal

# IronRuby
ironruby[-1.1.3]
ironruby-head
#

rubyをインストールする

rvm install <<インストールするrubyのバージョン>>

# rvm install 1.9.3
Searching for binary rubies, this might take some time.
No binary rubies available for: centos/6.3/x86_64/ruby-1.9.3-p429.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Installing requirements for centos, might require sudo password.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-1.9.3-p429, this may take a while depending on your cpu(s)...
ruby-1.9.3-p429 - #downloading ruby-1.9.3-p429, this may take a while depending on your connection...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 9806k  100 9806k    0     0  1422k      0  0:00:06  0:00:06 --:--:-- 1496k
ruby-1.9.3-p429 - #extracting ruby-1.9.3-p429 to /usr/local/rvm/src/ruby-1.9.3-p429
ruby-1.9.3-p429 - #extracted to /usr/local/rvm/src/ruby-1.9.3-p429
ruby-1.9.3-p429 - #configuring.............................................................................................................................................................................................................................................................................................................................................................................................................................................................
ruby-1.9.3-p429 - #compiling..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
ruby-1.9.3-p429 - #installing ............................................................................................................................................................................................................................................
Retrieving rubygems-1.8.25
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  371k  100  371k    0     0   792k      0 --:--:-- --:--:-- --:--:-- 2692k
Extracting rubygems-1.8.25 ...
Removing old Rubygems files...
Installing rubygems-1.8.25 for ruby-1.9.3-p429.....................
Installation of rubygems completed successfully.
Saving wrappers to '/usr/local/rvm/wrappers/ruby-1.9.3-p429'........

ruby-1.9.3-p429 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-1.9.3-p429 - #importing default gemsets, this may take time.......................
Install of ruby-1.9.3-p429 - #complete 

#

デフォルトで使用するrubyを選択する

rvm use <<使用するrubyのバージョン>>

# rvm use 1.9.3
Using /usr/local/rvm/gems/ruby-1.9.3-p429
# 
# ruby -v
ruby 1.9.3p429 (2013-05-15 revision 40747) [x86_64-linux]
# 

カテゴリー: Linux, ruby, 開発 タグ: ,

CentOS6.3にrvmをインストールする

2013 年 6 月 26 日 コメントはありません

rvmのソースコードをダウンロード

gitを使って、githubからrvmのソースコードをダウンロードします。

# git clone git://github.com/wayneeseguin/rvm.git
Initialized empty Git repository in /root/rvm/.git/
remote: Counting objects: 40694, done.
remote: Compressing objects: 100% (16957/16957), done.
remote: Total 40694 (delta 24103), reused 38179 (delta 21633)
Receiving objects: 100% (40694/40694), 16.10 MiB | 391 KiB/s, done.
Resolving deltas: 100% (24103/24103), done.

# ll
合計 4
drwxr-xr-x 20 root root 4096  6月 26 02:10 2013 rvm

rvmのインストール

rvmディレクトリに移動して「install」コマンドを実行します。

# cd rvm
# ./install

Installing RVM to /usr/local/rvm/
    Creating group 'rvm'

# RVM:  Shell scripts enabling management of multiple ruby environments.
# RTFM: https://rvm.io/
# HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)
# Cheatsheet: http://cheat.errtheblog.com/s/rvm
# Screencast: http://screencasts.org/episodes/how-to-use-rvm

# In case of any issues run 'rvm requirements' or read 'rvm notes'

Installation of RVM in /usr/local/rvm/ is almost complete:

  * First you need to add all users that will be using rvm to 'rvm' group,
    and logout - login again, anyone using rvm will be operating with `umask u=rwx,g=rwx,o=rx`.

  * To start using RVM you need to run `source /etc/profile.d/rvm.sh`
    in all your open shell windows, in rare cases you need to reopen all shell windows.

# root,
#
#   Thank you for using RVM!
#   I sincerely hope that RVM helps to make your life easier and
#   more enjoyable!!!
#
# ~Wayne 

インストール確認

「/usr/local/rvm/」にインストールされます。

# ll /usr/local/rvm/bin
合計 52
-rwxrwxr-x 1 root rvm   859  6月 26 02:13 2013 bundle
-rwxrwxr-x 1 root rvm   556  6月 26 02:13 2013 rake
-rwxrwxr-x 1 root rvm  1307  6月 26 02:13 2013 rvm
-rwxrwxr-x 1 root rvm  1512  6月 26 02:13 2013 rvm-auto-ruby
-rwxrwxr-x 1 root rvm  1803  6月 26 02:13 2013 rvm-exec
-rwxrwxr-x 1 root rvm 13376  6月 26 02:13 2013 rvm-installer
-rwxrwxr-x 1 root rvm  3850  6月 26 02:13 2013 rvm-prompt
-rwxrwxr-x 1 root rvm  2263  6月 26 02:13 2013 rvm-shell
-rwxrwxr-x 1 root rvm   648  6月 26 02:13 2013 rvm-smile
-rwxrwxr-x 1 root rvm  2619  6月 26 02:13 2013 rvmsudo

rvmを最新版に更新

rvmコマンドを使って、rvmを最新版に更新します。

# /usr/local/rvm/bin/rvm get latest
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13376  100 13376    0     0   6512      0  0:00:02  0:00:02 --:--:-- 12.7M
Downloading RVM version 1.21.2
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1070k  100 1070k    0     0   224k      0  0:00:04  0:00:04 --:--:--  404k

Upgrading the RVM installation in /usr/local/rvm/
    Group 'rvm' already exists
type rvm >/dev/null 2>/dev/null || echo ${PATH} | GREP_OPTIONS="" \grep "/usr/local/rvm/bin" > /dev/null || export PATH="${PATH}:/usr/local/rvm/bin"
    Adding rvm PATH line to /root/.bashrc /root/.zshrc.
    Adding rvm loading line to /root/.bash_profile /root/.zprofile.

Upgrade Notes:

  * No new notes to display.

# RVM:  Shell scripts enabling management of multiple ruby environments.
# RTFM: https://rvm.io/
# HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)
# Cheatsheet: http://cheat.errtheblog.com/s/rvm
# Screencast: http://screencasts.org/episodes/how-to-use-rvm

# In case of any issues run 'rvm requirements' or read 'rvm notes'

Upgrade of RVM in /usr/local/rvm/ is complete.

# root,
#
#   Thank you for using RVM!
#   I sincerely hope that RVM helps to make your life easier and
#   more enjoyable!!!
#
# ~Wayne


RVM reloaded!
# 

アップグレードを確認

最新版に更新した際に、rvmコマンドへのパス設定と、rvmのリロードが行われました。
「.bashrc」のリロードをして、パスの確認とrvmのバージョンの確認をします。

# source ~/.bashrc
# which rvm
/usr/local/rvm/bin/rvm
# rvm -v

rvm 1.21.2 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

rvmに必要なパッケージの確認&インストール

rvmに必要なパッケージを確認&インストールします。

# rvm requirements
Installing requirements for centos, might require sudo password.
Installing required packages: patch, gcc-c++, patch, readline-devel, zlib-devel, libyaml-devel, libffi-devel, openssl-devel, autoconf, automake, libtool, bison, libxml2-devel, libxslt-devel................................................................................................................................................................................................................................................................................................................................................................................................................................................
# 

■参考サイト

>rvmのダウンロードとインストール
>RVMを使ってRuby on RailsをUbuntu 12.04LTSにインストールする


カテゴリー: Linux, 開発 タグ: , ,