2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

rbenvを使ったRubyインストール

Last updated at Posted at 2015-10-05

各種proxy設定(必要な場合のみ)

/etc/profile.d/proxy.sh
PROXY='http://user:password@hoge:8080'
export http_proxy=$PROXY
export HTTP_PROXY=$PROXY
export HTTPS_PROXY=$PROXY
export https_proxy=$PROXY
/etc/yum.conf
proxy_http=http://hoge:8080/
proxy_username=user
proxy_password=password
/etc/yum/pluginconf.d/fastestmirror.conf
prefer=ftp.jaist.ac.jp

以下のコマンドを実行することで、ターミナルからわざわざ抜けなくても済む

$ exec ${SHELL} -l

各種パッケージのインストール(必要な場合のみ)

$ yum install git sqlite sqlite-devel httpd-devel curl-devel apr-devel apr-util-devel libffi-devel openssh gcc gcc-c++ openssl-devel readline-devel

proxyの設定が必要な場合は以下も実施

$ echo proxy=http://user:password@hoge:8080/ >> ~root/.curlrc
$ git config --global http.proxy http://user:password@hoge:8080/
$ git config --global https.proxy http://user:password@hoge:8080/

rbenvのインストール

$ cd /usr/local
$ git clone https://github.com/sstephenson/rbenv.git rbenv
$ git clone https://github.com/sstephenson/ruby-build.git rbenv/plugins/ruby-build
$ bash -c 'cat <<\__EOT__ >> /etc/profile.d/rbenv.sh
export RBENV_ROOT="/usr/local/rbenv"
export PATH="${RBENV_ROOT}/bin:${PATH}"
eval "$(rbenv init -)"
__EOT__'
$ bash -c 'cat <<\__EOT__ >> /root/.gemrc
gem: --no-ri --no-rdoc
__EOT__'
$ source /etc/profile.d/rbenv.sh && exec ${SHELL} -l
$ echo $RBENV_ROOT
/usr/local/rbenv

rbenv-updateのインストール

mkdir -p "$RBENV_ROOT/plugins"
git clone https://github.com/rkh/rbenv-update.git "$RBENV_ROOT/plugins/rbenv-update"

Rubyのインストール

CONFIGURE_OPTS="--disable-install-rdoc"をつけることで、RDoc, RI 用情報を生成しない
インストールするバージョンはお好みで

$ CONFIGURE_OPTS="--disable-install-rdoc" rbenv install -v 2.4.2
$ rbenv rehash
$ rbenv global 2.4.2
$ ruby -v
ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]

Gemのアップデート(必要な場合)

$ gem install rubygems-update
$ update_rubygems
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?