How to install last stable version of Ruby with RVM without root privileges?
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
0
down vote
favorite
I'm creating a bash script to install automatically the last stable version of ruby without root privileges. This is what I have so far:
#Install GPG Keys
curl -sSL https://rvm.io/mpapis.asc | gpg2 --import
#Install RVM
curl -sSL https://get.rvm.io | bash -s -- --ignore-dotfiles
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile
#Set environment
source $HOME/.rvm/scripts/rvm
#Install Ruby
rvm install $RUBY_VERSION
I need to find the last stable Ruby version to set RUBY_VERSION
variable.
command-line bash ruby
add a comment |Â
up vote
0
down vote
favorite
I'm creating a bash script to install automatically the last stable version of ruby without root privileges. This is what I have so far:
#Install GPG Keys
curl -sSL https://rvm.io/mpapis.asc | gpg2 --import
#Install RVM
curl -sSL https://get.rvm.io | bash -s -- --ignore-dotfiles
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile
#Set environment
source $HOME/.rvm/scripts/rvm
#Install Ruby
rvm install $RUBY_VERSION
I need to find the last stable Ruby version to set RUBY_VERSION
variable.
command-line bash ruby
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm creating a bash script to install automatically the last stable version of ruby without root privileges. This is what I have so far:
#Install GPG Keys
curl -sSL https://rvm.io/mpapis.asc | gpg2 --import
#Install RVM
curl -sSL https://get.rvm.io | bash -s -- --ignore-dotfiles
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile
#Set environment
source $HOME/.rvm/scripts/rvm
#Install Ruby
rvm install $RUBY_VERSION
I need to find the last stable Ruby version to set RUBY_VERSION
variable.
command-line bash ruby
I'm creating a bash script to install automatically the last stable version of ruby without root privileges. This is what I have so far:
#Install GPG Keys
curl -sSL https://rvm.io/mpapis.asc | gpg2 --import
#Install RVM
curl -sSL https://get.rvm.io | bash -s -- --ignore-dotfiles
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile
#Set environment
source $HOME/.rvm/scripts/rvm
#Install Ruby
rvm install $RUBY_VERSION
I need to find the last stable Ruby version to set RUBY_VERSION
variable.
command-line bash ruby
asked Jun 6 at 20:07
![](https://i.stack.imgur.com/b2iwn.jpg?s=32&g=1)
![](https://i.stack.imgur.com/b2iwn.jpg?s=32&g=1)
Facundo Chambo
11
11
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
Assuming the last stable version is always the last file with a filename like ruby-2.5.1.tar.gz
on https://cache.ruby-lang.org/pub/ruby/, you can extract the version number with:
curl -s https://cache.ruby-lang.org/pub/ruby/ | sed -nr '1h;1!H;$!d;x;s/.*ruby-([0-9.]+).tar.gz.*/1/p'
This approach uses curl
to retrieve the file list and GNU
sed
to cut out the version number as explained in this SO answer. You could also use
grep
with lookarounds instead, it even may be slightly faster:
curl -s https://cache.ruby-lang.org/pub/ruby/ | grep -oP '(?<=ruby-)d.d.d(?=.tar.gz)' | tail -1
Just add a line setting the RUBY_VERSION
variable to your script:
#Get version number of latest stable Ruby version
RUBY_VERSION=$(curl -s https://cache.ruby-lang.org/pub/ruby/ | sed -nr '1h;1!H;$!d;x;s/.*ruby-([0-9.]+).tar.gz.*/1/p')
#Install Ruby
rvm install $RUBY_VERSION
Example run
$ curl -s https://cache.ruby-lang.org/pub/ruby/ | sed -nr '1h;1!H;$!d;x;s/.*ruby-([0-9.]+).tar.gz.*/1/p'
2.5.1
$ curl -s https://cache.ruby-lang.org/pub/ruby/ | grep -oP '(?<=ruby-)d.d.d(?=.tar.gz)' | tail -1
2.5.1
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Assuming the last stable version is always the last file with a filename like ruby-2.5.1.tar.gz
on https://cache.ruby-lang.org/pub/ruby/, you can extract the version number with:
curl -s https://cache.ruby-lang.org/pub/ruby/ | sed -nr '1h;1!H;$!d;x;s/.*ruby-([0-9.]+).tar.gz.*/1/p'
This approach uses curl
to retrieve the file list and GNU
sed
to cut out the version number as explained in this SO answer. You could also use
grep
with lookarounds instead, it even may be slightly faster:
curl -s https://cache.ruby-lang.org/pub/ruby/ | grep -oP '(?<=ruby-)d.d.d(?=.tar.gz)' | tail -1
Just add a line setting the RUBY_VERSION
variable to your script:
#Get version number of latest stable Ruby version
RUBY_VERSION=$(curl -s https://cache.ruby-lang.org/pub/ruby/ | sed -nr '1h;1!H;$!d;x;s/.*ruby-([0-9.]+).tar.gz.*/1/p')
#Install Ruby
rvm install $RUBY_VERSION
Example run
$ curl -s https://cache.ruby-lang.org/pub/ruby/ | sed -nr '1h;1!H;$!d;x;s/.*ruby-([0-9.]+).tar.gz.*/1/p'
2.5.1
$ curl -s https://cache.ruby-lang.org/pub/ruby/ | grep -oP '(?<=ruby-)d.d.d(?=.tar.gz)' | tail -1
2.5.1
add a comment |Â
up vote
0
down vote
Assuming the last stable version is always the last file with a filename like ruby-2.5.1.tar.gz
on https://cache.ruby-lang.org/pub/ruby/, you can extract the version number with:
curl -s https://cache.ruby-lang.org/pub/ruby/ | sed -nr '1h;1!H;$!d;x;s/.*ruby-([0-9.]+).tar.gz.*/1/p'
This approach uses curl
to retrieve the file list and GNU
sed
to cut out the version number as explained in this SO answer. You could also use
grep
with lookarounds instead, it even may be slightly faster:
curl -s https://cache.ruby-lang.org/pub/ruby/ | grep -oP '(?<=ruby-)d.d.d(?=.tar.gz)' | tail -1
Just add a line setting the RUBY_VERSION
variable to your script:
#Get version number of latest stable Ruby version
RUBY_VERSION=$(curl -s https://cache.ruby-lang.org/pub/ruby/ | sed -nr '1h;1!H;$!d;x;s/.*ruby-([0-9.]+).tar.gz.*/1/p')
#Install Ruby
rvm install $RUBY_VERSION
Example run
$ curl -s https://cache.ruby-lang.org/pub/ruby/ | sed -nr '1h;1!H;$!d;x;s/.*ruby-([0-9.]+).tar.gz.*/1/p'
2.5.1
$ curl -s https://cache.ruby-lang.org/pub/ruby/ | grep -oP '(?<=ruby-)d.d.d(?=.tar.gz)' | tail -1
2.5.1
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Assuming the last stable version is always the last file with a filename like ruby-2.5.1.tar.gz
on https://cache.ruby-lang.org/pub/ruby/, you can extract the version number with:
curl -s https://cache.ruby-lang.org/pub/ruby/ | sed -nr '1h;1!H;$!d;x;s/.*ruby-([0-9.]+).tar.gz.*/1/p'
This approach uses curl
to retrieve the file list and GNU
sed
to cut out the version number as explained in this SO answer. You could also use
grep
with lookarounds instead, it even may be slightly faster:
curl -s https://cache.ruby-lang.org/pub/ruby/ | grep -oP '(?<=ruby-)d.d.d(?=.tar.gz)' | tail -1
Just add a line setting the RUBY_VERSION
variable to your script:
#Get version number of latest stable Ruby version
RUBY_VERSION=$(curl -s https://cache.ruby-lang.org/pub/ruby/ | sed -nr '1h;1!H;$!d;x;s/.*ruby-([0-9.]+).tar.gz.*/1/p')
#Install Ruby
rvm install $RUBY_VERSION
Example run
$ curl -s https://cache.ruby-lang.org/pub/ruby/ | sed -nr '1h;1!H;$!d;x;s/.*ruby-([0-9.]+).tar.gz.*/1/p'
2.5.1
$ curl -s https://cache.ruby-lang.org/pub/ruby/ | grep -oP '(?<=ruby-)d.d.d(?=.tar.gz)' | tail -1
2.5.1
Assuming the last stable version is always the last file with a filename like ruby-2.5.1.tar.gz
on https://cache.ruby-lang.org/pub/ruby/, you can extract the version number with:
curl -s https://cache.ruby-lang.org/pub/ruby/ | sed -nr '1h;1!H;$!d;x;s/.*ruby-([0-9.]+).tar.gz.*/1/p'
This approach uses curl
to retrieve the file list and GNU
sed
to cut out the version number as explained in this SO answer. You could also use
grep
with lookarounds instead, it even may be slightly faster:
curl -s https://cache.ruby-lang.org/pub/ruby/ | grep -oP '(?<=ruby-)d.d.d(?=.tar.gz)' | tail -1
Just add a line setting the RUBY_VERSION
variable to your script:
#Get version number of latest stable Ruby version
RUBY_VERSION=$(curl -s https://cache.ruby-lang.org/pub/ruby/ | sed -nr '1h;1!H;$!d;x;s/.*ruby-([0-9.]+).tar.gz.*/1/p')
#Install Ruby
rvm install $RUBY_VERSION
Example run
$ curl -s https://cache.ruby-lang.org/pub/ruby/ | sed -nr '1h;1!H;$!d;x;s/.*ruby-([0-9.]+).tar.gz.*/1/p'
2.5.1
$ curl -s https://cache.ruby-lang.org/pub/ruby/ | grep -oP '(?<=ruby-)d.d.d(?=.tar.gz)' | tail -1
2.5.1
edited Jun 8 at 12:41
answered Jun 8 at 12:23
![](https://i.stack.imgur.com/9L8vd.png?s=32&g=1)
![](https://i.stack.imgur.com/9L8vd.png?s=32&g=1)
dessert
19.4k55494
19.4k55494
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1044283%2fhow-to-install-last-stable-version-of-ruby-with-rvm-without-root-privileges%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password