简体   繁体   中英

How do I uninstall an old version of Ruby, and is it a wise thing to do?

When logged in as root and I type

ruby -v
centOS server reports 'ruby 1.9.3p392'. This is what I want.

But if I put

 rvmsudo ruby -v  
then I get 'ruby 1.8.7'. I do not want to use this older version, it is causing problems for my gitlab install.

I would like to remove it and make sure only v1.9 is used, how can I do this? Or should I leave it there but try and require certain users to use a different version?

Also, in case doing this messes anything up, is it possible to either;

a.see if anything on the server requires v1.8?

b.reverse the uninstall if it causes a problem?

Before uninstalling, take note of the patch level of 1.8.7 just in case. rvmsudo ruby -v should return something like ruby 1.8.7p234 . The p#{num} is your patch level.

You should be able to uninstall 1.8.7 with rvm uninstall 1.8.7 (or possibly rvmsudo uninstall 1.8.7 ). This version of Ruby shouldn't be used by anything on the system other than code you've written, so it should only affect your applications and scripts.

The best way to tell what else would be using 1.8.7 is to look for scripts and crontabs that are owned by the user that rvm is running under. I'm not sure there's a tool that can evaluate it for you.

The best way to roll back in case of an emergency is rvm install 1.8.7-p#{num_from_above} . Alternatively, if you're on a platform like AWS or have rsync backups enabled, you might consider taking a snapshot that you can roll back to if you get in over your head.

Hope that's helpful!

As you mentioned the ruby version output for root is ruby 1.9.3p392 in my understanding you will not have any problems.

Sure, you can have more than one version of ruby installed and find them under ~/.rvm/rubies . Also there you can find out the default version which is used. For more information you can have a look here: set default ruby where it explains how to set a default ruby and how to reset to the systems default.

Try setting default

$ rvm --default use 1.9.2

$ ruby -v

#ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]

to remove you can use:

sudo apt-get remove ruby 1.8.7 

Docs here & here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM