Ruby on rails 环境安装

来源:互联网 发布:阿里云按流量的划算吗 编辑:程序博客网 时间:2024/04/29 08:20

# ruby --version 
ruby 1.8.7 (2012-02-08 MBARI 8/0x6770 on patchlevel 358) [x86_64-linux], MBARI 0x6770, Ruby Enterprise Edition 2012.02 # rails -v Rails 2.3.11 

I need to upgrade the ruby and rails version, take a Live Chat with Bluehost support, the guy let me follow this post https://my.bluehost.com/cgi/help/rails but it just tell us how to deploy the rails, so I need to reinstall the rails. 


Install Ruby 1.9  


When I install RubyGems, it complains: 
[~/src/rubygems-1.8.24]# ruby setup.rb 
/home4/lytsingo/.local/lib/ruby/1.9.1/yaml.rb:56:in `<top (required)>': It seems your ruby installation is missing psych (for YAML output). To eliminate this warning, please install libyaml and reinstall your ruby. RubyGems 1.8.24 installed 
so need to install libyaml first 
# mkdir ~/src 
# cd ~/src 
# wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz 
# tar xvf yaml-0.1.4.tar.gz 
# cd yaml-0.1.4 
# ./configure -prefix=$HOME/.local 
# make -j8 

# make install 
# make clean 
*Note*: Let compile faster, I use make -j 8, it depends your cpu processors, see: 
cat /proc/cpuinfo |grep processor |wc -l 8 
# wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz 
# tar xvf ruby-1.9.3-p0.tar.gz 
# cd ruby-1.9.3-p0 
# ./configure -prefix=$HOME/.local --disable-install-doc --with-opt-dir=$HOME/.local 
# make -j8 
# make install 

# make clean 


Install gems 


# wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz 
# tar xvf rubygems-1.8.24.tgz 




# cd rubygems-1.8.24 

# ruby setup.rb  


Install Rails 3 


gem install rails -v 3.2.8 --no-rdoc --no-ri 


没反应的,因为gem install 安装在后台没有屏显,可以在命令结尾加上-V实时的显示安装进程
Check it out: 
# ruby -v 
ruby 1.9.3p0 (2011-10-30) [x86_64-linux] # rails -v Rails 3.2.8

 

 

ACTION:

Rails的ruby版本需要在1.90以上...大家可以自己下载一个版本,然后

1../configure

2.make

3.make  install

4.make clean

 

但是安装完成之后执行ruby 提示在/usr/bin 目录下找不到ruby

这个时候:

1、找到ruby安装的位置。执行:whereis ruby。应该可以看到一个xxxx/bin/ruby 的位置。假如为:/usr/local/bin/ruby2、编辑个人的.bashrc文件。执行:vi ~/.bashrc ,然后在最末尾添加一行:export PATH=/usr/local/bin:$PATH。重新登录linux或者执行 source ~/.bashrc后,执行ruby -v就可以找到ruby了。补充:第二步中编辑~/.bashrc文件,添加的环境变量只对自己有效,如果编辑/etc/profile就会对所有用户有效。

 


0 0
原创粉丝点击