首页 > 代码库 > ubuntu 安装ruby

ubuntu 安装ruby

1、安装所需依赖
sudo apt-get update sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev

 2、安装git sudo apt-get install git

 3、http://stackoverflow.com/questions/26595620/how-to-install-ruby-2-1-4-on-ubuntu-14-04

  下载rbenv 并设置好环境变量:

git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo ‘export PATH="$HOME/.rbenv/bin:$PATH"‘ >> ~/.bashrc
echo ‘eval "$(rbenv init -)"‘ >> ~/.bashrc
exec $SHELL

下载ruby源码 设置环境变量
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo ‘export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"‘ >> ~/.bashrc
exec $SHELL

 安装:

rbenv install 2.3.1
rbenv global 2.3.1
ruby -v

rbenv --》ruby envirement 大概是这两个单词的缩写,用来配置ruby的环境和安装的

ubuntu 安装ruby