如何在centos6.3中安装ruby和rails
时间:2019-08-20 17:58:10 来源:igfitidea点击:
安装gcc编译器和make程序
yum install gcc gcc-c++ make -y
安装ruby和gems
yum install ruby ruby-devel rubygems ruby-irb ruby-ri -y
更新gem
gem update –system
安装rails
gem install rails
检查ruby、gem和rails的状态
[root@localhost ~]# gem -v 2.0.0 [root@localhost ~]# rails -v Rails 3.2.12 [root@localhost ~]# ruby -v ruby 1.8.7 (2011-06-30 patchlevel 352) [i386-linux] [root@localhost ~]# [root@localhost ~]# gem list *** LOCAL GEMS *** actionmailer (3.2.12) actionpack (3.2.12)
如果缺少安装相关软件,安装过程可能会遇到下面这两个错误:
Error1 : Building native extensions. This could take a while… /usr/bin/ruby extconf.rb mkmf.rb can’t find header files for ruby at /usr/lib/ruby/ruby.h ERROR: Error installing rails: ERROR: Failed to build gem native extension. Building has failed. See above output for more information on the failure. Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/json-1.7.7 for inspection. Results logged to /usr/lib/ruby/gems/1.8/gems/json-1.7.7/ext/json/ext/generator/gem_make.out [root@localhost ~]#
Error 2: Building native extensions. This could take a while… /usr/bin/ruby extconf.rb creating Makefile make ERROR: Error installing rails: ERROR: Failed to build gem native extension. Building has failed. See above output for more information on the failure. Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/json-1.7.7 for inspection. Results logged to /usr/lib/ruby/gems/1.8/gems/json-1.7.7/ext/json/ext/generator/gem_make.out [root@localhost ~]#