How to update ruby on linux (ubuntu)?
sudo apt-get install ruby1.9
should do the trick.
You can find what libraries are available to install by
apt-cache search <your search term>
So I just did apt-cache search ruby | grep 9
to find it.
You'll probably need to invoke the new Ruby as ruby1.9
, because Ubuntu will probably default to 1.8 if you just type ruby
.
How do I install the latest version of ruby in Ubuntu?
I use Ubuntu, and I've found the easiest way to install newer versions of Ruby is to use rvm.
The instructions are here: https://rvm.io/rvm/install/
Basically, it installs different versions of Ruby locally for the user and updates environment variables for Ruby and gems based on which version you decide to use.
It's this easy:
jim@schubert:~$ rvm use system
Now using system ruby.
jim@schubert:~$ ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]
jim@schubert:~$ gem -v
1.3.7
jim@schubert:~$ rvm use 1.9.2
Using /home/jim/.rvm/gems/ruby-1.9.2-p180
jim@schubert:~$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
jim@schubert:~$ gem -v
1.5.2
jim@schubert:~$
how to upgrade ruby version from 2.3.1 to 2.5.1 in ubuntu
It seems a problem with rvm, first do this in a shell:
rvm get stable --auto-dotfiles
Then be sure that your .bashrc, or .zshrc, depending on what shell you use contains this at the last line
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
and restart your shell, it should work, if not try also addding this line to your .XXprofile file or .xxrc file
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
finally it should work, if not, try to reinstall rvm again as single user
Cannot update ruby version
Ruby 1.9.3 is already installed. To use it, write
rvm use 1.9.3
To make it the default version, use
rvm --default use 1.9.3
And to get all your ruby versions installed, use
rvm list
How to update ruby from 2.0.0 to 2.2.2 in ubuntu 16.04?
First off, you should upgrade your Rails version immediately:
Ruby on Rails 4.0 End of Life was in January 2015.
As for the other error it looks like apt-get update is choking somehow. I would try fixing that first before going through rvm.
apt-get update
and
apt-get dist-upgrade
(make sure you understand what these do before running them). If you get errors there, make sure your
/etc/apt/sources.list
/etc/apt/sources.list.d/*.list
files are all correct.
Related Topics
Why Does Ruby'S 'Gets' Includes the Closing Newline
Installing Jekyll Without Root
Why Does Adding "Sleep 1" in an After Hook Cause This Rspec/Capybara Test to Pass
Rails Model, View, Controller, and Helper: What Goes Where
Really Cheap Command-Line Option Parsing in Ruby
Read Binary File as String in Ruby
Passing a Method as a Parameter in Ruby
One-Liner to Recursively List Directories in Ruby
Reading the Last N Lines of a File in Ruby
Set Global Default Encoding For Ruby 1.9
Serving Static Files With Sinatra
How to Switch to Ruby 1.9.3 Installed Using Homebrew
How to Have Class.Property = X Return Something Other Than X