2012-12-02 151 views
1

問題:我安裝紅寶石,但它無法正確識別。 我正在關注的部署到VPShttps://github.com/railscasts/335-deploying-to-a-vps通過rbenv安裝Ruby失敗

我設置我的服務器上的Ubuntu 12.04 LTS部署我的Rails應用程序。我正在關注部署到VPS的railscast,並試圖通過rbenv安裝ruby。它似乎一切安裝正確,但當我試圖檢查紅寶石版本,它給了我錯誤。以下是我運行的命令。

[email protected]:~$ rbenv install 1.9.3-p125 
Downloading yaml-0.1.4.tar.gz... 
-> http://cloud.github.com/downloads/sstephenson/ruby-build-download-mirror/36c852831d02cf90508c29852361d01b 
Installing yaml-0.1.4... 
Installed yaml-0.1.4 to /home/deployer/.rbenv/versions/1.9.3-p125 

Downloading ruby-1.9.3-p125.tar.gz... 
-> http://cloud.github.com/downloads/sstephenson/ruby-build-download-mirror/e3ea86b9d3fc2d3ec867f66969ae3b92 
Installing ruby-1.9.3-p125... 
Installed ruby-1.9.3-p125 to /home/deployer/.rbenv/versions/1.9.3-p125 

Downloading rubygems-1.8.23.tar.gz... 
-> http://cloud.github.com/downloads/sstephenson/ruby-build-download-mirror/178b0ebae78dbb46963c51ad29bb6bd9 
Installing rubygems-1.8.23... 
Installed rubygems-1.8.23 to /home/deployer/.rbenv/versions/1.9.3-p125 

[email protected]:~$ rbenv global 1.9.3-p125 
[email protected]:~$ ruby -v 
'ruby' program can be found in the following packages: 
* ruby1.8 
* ruby1.9.1 

我該如何解決這個問題?

+0

你嘗試安裝[紅寶石建造(https://github.com/sstephenson/ruby -建立)? –

回答

5

你並不需要使用rbenv安裝Ruby的特定版本缺少

eval "$(rbenv init -)"; 

。而是使用ruby-build安裝1.9.3-P125爲/usr/local

ruby-build 1.9.3-p125 /usr/local/ 

或者,手動安裝Ruby:

# Compile Ruby (instead of rbenv) 
sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev 
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz 
tar -xvzf ruby-1.9.3-p125.tar.gz 
cd ruby-1.9.3-p125/ 
./configure --prefix=/usr/local 
make 
sudo make install 
sudo gem install bundler --no-ri --no-rdoc 
1

也許你在你的shell配置

+0

這不是。我已經在我的〜/ .bashrc中。 –

+0

您是否在安裝rbenv和ruby後通過註銷重新啓動bash? –

+0

是的。紅寶石-v仍然給我我還沒有安裝紅寶石,並獲得另一個錯誤。當我做 。 〜/ .bashrc,它說我不能/ root,因爲權限被拒絕 –

1

,應該重新啓動外殼,讓rbenv找到新的Ruby

$ exec $ SHELL
$ ruby​​ -v

紅寶石1.9.3p194(2012-04-20修訂35410)[i686的Linux的]