我rbenv
在 vagrant 中安装的方式如下:
apt-get update
apt-get install -y automake bison build-essential git-core libffi-dev libreadline6-dev libgdbm3 libgdbm-dev libncurses5-dev libssl-dev libtool libyaml-dev vim zlib1g-dev
[ -e /bin/rbenv ] || {
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
ln -s ~/.rbenv/bin/rbenv /bin/rbenv
rbenv install 2.2.0
rbenv global 2.2.0
}
问题是:
root@vagrant-ubuntu-trusty-64:~/.rbenv# cat version
2.2.0
root@vagrant-ubuntu-trusty-64:~/.rbenv# ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
我如何为所有用户安装 2.2.0 作为默认 Ruby?
答案1
我找到了一种解决方法:
apt-get update
apt-get install -y automake bison build-essential git-core libffi-dev libreadline6-dev libgdbm3 libgdbm-dev libncurses5-dev libssl-dev libtool libyaml-dev vim zlib1g-dev
[ -e /opt/ruby-build ] || {
git clone git://github.com/sstephenson/ruby-build.git /opt/ruby-build
/opt/ruby-build/bin/ruby-build 2.2.0 /opt/ruby-2.2.0
echo PATH="/opt/ruby-2.2.0/bin:\$PATH" >> /etc/profile
PATH="/opt/ruby-2.2.0/bin:$PATH"
}