Skip to content

Instantly share code, notes, and snippets.

@yn-misaki
Created September 9, 2016 09:14
Show Gist options
  • Save yn-misaki/0aa1cf604360c199dde8a0f16fe7d6c0 to your computer and use it in GitHub Desktop.
Save yn-misaki/0aa1cf604360c199dde8a0f16fe7d6c0 to your computer and use it in GitHub Desktop.
rubyを超高速でインストールする方法 ref: http://qiita.com/yn-misaki/items/23ff4e0f1268511aed41
# rbenv+ruby-buildでインストール
$ rbenv install 2.2.4
# rbenv+ruby-buildでインストール(rubyのドキュメントをインストールしない)
$ CONFIGURE_OPTS="--disable-install-rdoc" rbenv install 2.2.4
# rbenv+rubyをソースからビルド(rubyのドキュメントをインストールしない)
$ sh ruby_install.sh
# ruby_install.sh という名前のシェルを作ります。↓中身はこちら
==================================================================
#!/bin/sh
curl -O https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.4.tar.bz2
tar jxvf ruby-2.2.4.tar.bz2
cd ruby-2.2.4/
./configure --disable-install-doc --prefix=$HOME/.rbenv/versions/2.2.4 # rbenvで使えるように、rbenvのversions配下にインストールする設定をする
make -j 2 # 【並列化】今回はマシンのコア数が2なので2を指定します。
sudo make instal
==================================================================
# パッケージ化されたrubyを使ってインストール
$ sudo yum install -y
https://github.com/feedforce/ruby-rpm/releases/download/2.2.4/ruby-2.2.4-1.el7.centos.x86_64.rpm
# OS
$ cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
# memory
$ cat /proc/meminfo | grep Total
MemTotal: 1884064 kB
# core数
$ cat /proc/cpuinfo | grep "processor" | wc -l
2
$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
$ cd ~/.rbenv && src/configure && make -C src
# 設定の書き込み・反映(今回は、~/.bash_profileに書き込みます)
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
$ source ~/.bash_profile
$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment