[英]Installing Ruby via rbenv fails
Problem: I installed ruby, but it is not recognized correctly. 问题:我安装了ruby,但是无法正确识别。 I'm following the deploying to VPS : https://github.com/railscasts/335-deploying-to-a-vps
我正在部署到VPS : https : //github.com/railscasts/335-deploying-to-a-vps
I am setting my server on ubuntu 12.04 LTS to deploy my rails app. 我正在ubuntu 12.04 LTS上设置服务器以部署我的rails应用程序。 I'm following the railscast on deploying to a VPS, and trying to install ruby through rbenv.
我正在跟踪部署到VPS的过程,并尝试通过rbenv安装ruby。 It seemed everything was installed correctly, but when I tried to check the ruby version, it gave me errors.
看来一切都已正确安装,但是当我尝试检查ruby版本时,它给了我错误。 The following are the commands that I ran.
以下是我运行的命令。
deployer@max:~$ 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
deployer@max:~$ rbenv global 1.9.3-p125
deployer@max:~$ ruby -v
'ruby' program can be found in the following packages:
* ruby1.8
* ruby1.9.1
How do I solve this? 我该如何解决?
You don't need to use rbenv to install a specific version of Ruby. 您不需要使用rbenv来安装特定版本的Ruby。 Instead use ruby-build to install 1.9.3-p125 into
/usr/local
: 而是使用ruby-build将1.9.3-p125安装到
/usr/local
:
ruby-build 1.9.3-p125 /usr/local/
Or, install Ruby manually: 或者,手动安装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
Maybe you are missing 也许你不见了
eval "$(rbenv init -)";
in your shell config 在您的shell配置中
You should restart the shell to allow rbenv
to find the new Ruby 您应该重新启动外壳程序,以允许
rbenv
查找新的Ruby。
$ exec $SHELL
$ exec $ SHELL
$ ruby -v$红宝石-v
ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]
红宝石1.9.3p194(2012-04-20修订版35410)[i686-linux]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.