0
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.

CentOS 7.1 にrbenvでRubyをインストールする。そして、asciidoctorを使いたい。

Posted at

前提条件

  • CentOS 7.1 64bit
  • git(version 1.8.3.1)※ 早く試したかったのでyumで入れました。gitの最新版を使いたい人はソースコードから入れてください。

2016/09/27に作業しました。

この情報が古い可能性もありますので、うまくいかない場合はフィードバック頂けるとありがたいです。

この記事でわかること

  • rbenvのインストール方法
  • rbenvを使ったRubyのインストール方法
  • gemによるasciidoctorのインストール方法

この記事に書いていないこと

  • rbenvのその他設定方法
  • adciidoctorの使い方

rbenvのインストール

rbenvとは、1つの環境で、複数のRubyバージョンを切り替えて利用するためのツールです。

必要な依存関係をインストール

# yum -y install epel-release
# yum -y install gcc-c++ git glibc-headers libffi-devel libxml2 libxml2-devel libxslt libxslt-devel libyaml-devel make nodejs npm openssl-devel readline readline-devel sqlite-devel zlib zlib-devel bzip2

Githubからソースコードをチェックアウト

# git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
# git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
# git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash

シェルにパスを通す

すべてのユーザに反映させないので、/etc/profileに追記しました。

# echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> /etc/profile
# echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> /etc/profile
# echo 'eval "$(rbenv init -)"' >> /etc/profile
# source /etc/profile
# rbenv -v
rbenv 1.0.0-31-gd0779fc

これでrbenvのインストールは完了です。

Rubyをインストールする

インストール可能なRubyバージョンを確認する。

# rbenv install --list
Available versions:
  1.8.5-p113
  1.8.5-p114
  1.8.5-p115
  1.8.5-p231
  1.8.5-p52
  1.8.6-p110
  1.8.6-p111
  1.8.6-p114
・・・たくさん出てきます

指定のバージョンをインストールする。

# rbenv install 2.0.0-p648

取り急ぎ、ログイン中のユーザで使用するバージョンを指定する。

# rbenv global 2.0.0-p648
# ruby -v
ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-linux]

asciidoctorをインストールする

gemからインストールするだけです。

# gem install asciidoctor

1.5.4というバージョンが入りました。

0
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
0
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?