[http://totutotu.hatenablog.com/entry/2015/08/30/Amazon_LinuxにRails用の環境構築](http://totutotu.hatenablog.com/entry/2015/08/30/Amazon_Linux%E3%81%ABRails%E7%94%A8%E3%81%AE%E7%92%B0%E5%A2%83%E6%A7%8B%E7%AF%89)  
上記サイトを参考にrails環境を構築していますが、途中でエラーのなってしまいます。  
nokogiriをインストールするとの記述ですが、インストールでエラーになってしまいます、どこの修正が必要になりますか？

`# gem install nokogiri -- --use-system-libraries`

```

    Fetching: mini_portile2-2.0.0.gem (100%)
    Successfully installed mini_portile2-2.0.0
    Fetching: nokogiri-1.6.7.2.gem (100%)
    Building native extensions with: '--use-system-libraries'
    This could take a while...
    ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.
    
    current directory: /usr/local/share/ruby/gems/2.0/gems/nokogiri-1.6.7.2/ext/nokogiri
    /usr/bin/ruby2.0 -r ./siteconf20160211-17517-htr7sm.rb extconf.rb --use-system-libraries
    mkmf.rb can't find header files for ruby at /usr/share/ruby/include/ruby.h
    
    extconf failed, exit code 1
    
    Gem files will remain installed in /usr/local/share/ruby/gems/2.0/gems/nokogiri-1.6.7.2 for inspection.
    Results logged to /usr/local/lib64/ruby/gems/2.0/gems/nokogiri-1.6.7.2/gem_make.out
    
```

`# gem install --no-ri --no-rdoc rails`

```

    Fetching: rack-1.6.4.gem (100%)
    Successfully installed rack-1.6.4
    Fetching: concurrent-ruby-1.0.0.gem (100%)
    Successfully installed concurrent-ruby-1.0.0
    Fetching: sprockets-3.5.2.gem (100%)
    Successfully installed sprockets-3.5.2
    Fetching: thread_safe-0.3.5.gem (100%)
    Successfully installed thread_safe-0.3.5
    Fetching: tzinfo-1.2.2.gem (100%)
    Successfully installed tzinfo-1.2.2
    Fetching: minitest-5.8.4.gem (100%)
    Successfully installed minitest-5.8.4
    Fetching: i18n-0.7.0.gem (100%)
    Successfully installed i18n-0.7.0
    Fetching: activesupport-4.2.5.1.gem (100%)
    Successfully installed activesupport-4.2.5.1
    Building native extensions.  This could take a while...
    ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.
    
    current directory: /usr/local/share/ruby/gems/2.0/gems/nokogiri-1.6.7.2/ext/nokogiri
    /usr/bin/ruby2.0 -r ./siteconf20160211-17550-1i040vi.rb extconf.rb
    mkmf.rb can't find header files for ruby at     /usr/share/ruby/include/ruby.h
    
    extconf failed, exit code 1
    
    Gem files will remain installed in     /usr/local/share/ruby/gems/2.0/gems/nokogiri-1.6.7.2 for inspection.
    Results logged to /usr/local/lib64/ruby/gems/2.0/gems/nokogiri-1.6.7.2/gem_make.out
    
```
CC BY-SA 3.0
2016-02-11T03:09:16.530
21962
2016-06-30T11:37:48.717
10980
question
ruby-on-rails
Amazon Linux EC2にRailsをインストールする
```

    sudo yum install -y httpd24 php56 mysql55-server php56-mysqlnd
    
```

で最初にLAMPを構築すると、rubyのバージョンが2.0.0なので、

```

    rbenv global 2.2.2
    
```

で切り替え、再度インストールすると、できました。
CC BY-SA 3.0
2016-02-11T03:52:01.187
21966
2016-02-11T03:52:01.187
10980
21962
answer