Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How can one install ruby on ubuntu

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 91
    Comment on it

    Choose the version of ruby you want to install for example : 2.2.3

    After choosing the right version of ruby first step is to install some dependencies :

    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
    

    Next we can install ruby using any of the below three ways :

    1) Using rbenv (Recommended)

    cd
    git clone git://github.com/sstephenson/rbenv.git .rbenv
    echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
    echo 'eval "$(rbenv init -)"' >> ~/.bashrc
    exec $SHELL
    
    git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
    echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
    exec $SHELL
    
    git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash
    
    rbenv install 2.2.3
    rbenv global 2.2.3
    ruby -v
    

    2) Using rvm

    sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
    curl -L https://get.rvm.io | bash -s stable
    source ~/.rvm/scripts/rvm
    rvm install 2.2.3
    rvm use 2.2.3 --default
    ruby -v
    

    3) From source

    cd
    wget http://ftp.ruby-lang.org/pub/ruby/2.2/ruby-2.2.3.tar.gz
    tar -xzvf ruby-2.2.3.tar.gz
    cd ruby-2.2.3/
    ./configure
    make
    sudo make install
    ruby -v
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: