Installing ruby 1.8.7 (and guessnet) on Hardy

There were some vulnerabilities in Ruby which are supposedly fixed in ruby 1.8.7. Because of that and because it's always nice to have the latest, I installed ruby from Ubuntu Intrepid on Hardy Herron.

And while I was doing that I also decided to install guessnet from Intrepid. So I don't have to compile guessnet anymore.

It involves two steps:

  1. Updating you apt sources
  2. Making sure only ruby and guessnet are going to be installed from the new sources. Not all the packages!

1. Updating your sources

Create /etc/apt/sources.list.d/intrepid.list and copy the following code into it:

CODE:
  1. deb http://nl.archive.ubuntu.com/ubuntu/ intrepid main restricted multiverse
  2. deb-src http://nl.archive.ubuntu.com/ubuntu/ intrepid main restricted
  3.  
  4. ## Major bug fix updates produced after the final release of the
  5. ## distribution.
  6. deb http://nl.archive.ubuntu.com/ubuntu/ intrepid-updates main restricted multiverse
  7. deb-src http://nl.archive.ubuntu.com/ubuntu/ intrepid-updates main restricted
  8.  
  9. ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
  10. ## team, and may not be under a free licence. Please satisfy yourself as to
  11. ## your rights to use the software. Also, please note that software in
  12. ## universe WILL NOT receive any review or updates from the Ubuntu security
  13. ## team.
  14. deb http://nl.archive.ubuntu.com/ubuntu/ intrepid universe
  15. deb-src http://nl.archive.ubuntu.com/ubuntu/ intrepid universe
  16. deb http://nl.archive.ubuntu.com/ubuntu/ intrepid-updates universe
  17. deb-src http://nl.archive.ubuntu.com/ubuntu/ intrepid-updates universe
  18.  
  19. ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
  20. ## team, and may not be under a free licence. Please satisfy yourself as to
  21. ## your rights to use the software. Also, please note that software in
  22. ## multiverse WILL NOT receive any review or updates from the Ubuntu
  23. ## security team.
  24.  
  25. ## Uncomment the following two lines to add software from the 'backports'
  26. ## repository.
  27. ## N.B. software from this repository may not have been tested as
  28. ## extensively as that contained in the main release, although it includes
  29. ## newer versions of some applications which may provide useful features.
  30. ## Also, please note that software in backports WILL NOT receive any review
  31. ## or updates from the Ubuntu security team.
  32. deb http://nl.archive.ubuntu.com/ubuntu/ intrepid-backports main restricted universe multiverse
  33. # deb-src http://nl.archive.ubuntu.com/ubuntu/ intrepid-backports main restricted universe multiverse
  34.  
  35. ## Uncomment the following two lines to add software from Canonical's
  36. ## 'partner' repository. This software is not part of Ubuntu, but is
  37. ## offered by Canonical and the respective vendors as a service to Ubuntu
  38. ## users.
  39. deb http://archive.canonical.com/ubuntu intrepid partner
  40. # deb-src http://archive.canonical.com/ubuntu intrepid partner
  41. deb http://security.ubuntu.com/ubuntu intrepid-security main restricted multiverse
  42. deb-src http://security.ubuntu.com/ubuntu intrepid-security main restricted
  43. deb http://security.ubuntu.com/ubuntu intrepid-security universe
  44. deb-src http://security.ubuntu.com/ubuntu intrepid-security universe

2. Apt preferences

If /etc/apt/preferences does not exist, touch it!

Then copy this code into it:

CODE:
  1. Package: *
  2. Pin: release v=8.10
  3. Pin-Priority: -1
  4. Package: ruby
  5. Pin: release v=8.10
  6. Pin-Priority: 500
  7.  
  8. Package: ruby1.8
  9. Pin: release v=8.10
  10. Pin-Priority: 500
  11.  
  12. Package: libruby
  13. Pin: release v=8.10
  14. Pin-Priority: 500
  15.  
  16. Package: libruby1.8
  17. Pin: release v=8.10
  18. Pin-Priority: 500
  19.  
  20. Package: rdoc
  21. Pin: release v=8.10
  22. Pin-Priority: 500
  23.  
  24. Package: rdoc1.8
  25. Pin: release v=8.10
  26. Pin-Priority: 500
  27.  
  28. Package: ri
  29. Pin: release v=8.10
  30. Pin-Priority: 500
  31.  
  32. Package: ri1.8
  33. Pin: release v=8.10
  34. Pin-Priority: 500
  35.  
  36. Package: irb
  37. Pin: release v=8.10
  38. Pin-Priority: 500
  39.  
  40. Package: irb1.8
  41. Pin: release v=8.10
  42. Pin-Priority: 500
  43.  
  44. Package: libopenssl-ruby
  45. Pin: release v=8.10
  46. Pin-Priority: 500
  47.  
  48. Package: libreadline-ruby
  49. Pin: release v=8.10
  50. Pin-Priority: 500
  51.  
  52. Package: libreadline-ruby1.8
  53. Pin: release v=8.10
  54. Pin-Priority: 500
  55.  
  56. Package: ruby-dev
  57. Pin: release v=8.10
  58. Pin-Priority: 500
  59.  
  60. Package: ruby1.8-dev
  61. Pin: release v=8.10
  62. Pin-Priority: 500
  63. Package: guessnet
  64. Pin: release v=8.10
  65. Pin-Priority: 501

That's all! "Aptitude update" & "aptitude install ruby guessnet" and you are good to go.

I tried using the "Package" keyword with wildcards, but that's a no-go :(

16 comments ↓

#1 thorny_sun on 07.02.08 at 08:02

tried it, but it doesn’t work.
aptitude update doesn’t seem to be picking up intrepid repos, and
aptitude install ruby gives these errors:
sudo aptitude install ruby
Reading package lists… Done
E: Invalid record in the preferences file, no Package header
E: Invalid record in the preferences file, no Package header

any ideas?

#2 LeonB on 07.02.08 at 09:26

Sorry, made a mistake…

The file has to be: /etc/apt/sources.list.d/intrepid.list instead of:
/etc/apt/sources.list.d/intrepid

So rename intrepid to intrepid.list and all will be fine. I’ve updated the blogpost too.

#3 kares on 07.14.08 at 17:28

I think the error was caused by the content of the /etc/apt/preferences file, I had to remove the following lines :

5. /*All ruby*/
66. /*End ruby*/

I don’t now why synaptic did not ignore the comments.

Most importantly is there a typo at line 21 ?!

21. rdoc1.8 ri1.8

#4 LeonB on 07.14.08 at 23:37

Thanks Kares! Updated the post: removed the typos and removed the comment.

#5 tobyo on 08.06.08 at 06:04

When using the preference file, apt told me 1.8.6 was already the newest version for some reason. I was able to install 1.8.7 by removing preference and explicitly running:

sudo apt-get install ruby ruby1.8 libruby libruby1.8 rdoc rdoc1.8 ri ri1.8 irb irb1.8 libopenssl-ruby libreadline-ruby libreadline-ruby1.8 ruby-dev ruby1.8-dev

Then I moved the intrepid source so apt doesn’t want to upgrade 500 packages all the time.

#6 Rock on 08.16.08 at 18:15

cool! 3x!

#7 benkong2 on 09.04.08 at 03:25

Do I need to uninstall ruby 1.8.6

#8 LeonB on 09.04.08 at 09:13

No, ruby 1.8.6 will be automatically uninstalled. Both belong to the ruby1.8 package. So there can only be one.

#9 marsvin on 01.06.09 at 16:01

This is very helpful but I’m sure it would save people tons of time if you took out the line numbering from your code boxes. Copying and pasting takes forever this way ;)

#10 spencer on 02.19.09 at 20:31

Ya, not to bite the hand that feeds, I really appreciate this, but those line numbers are KILLING me.

#11 Giridhar on 04.20.09 at 07:52

Thanks, it worked exactly what you have specified. If possible remove the line numbers.

#12 The Irish Penguin on 04.29.09 at 21:41

This guide is great, thanks!

I had to use sudo apt-get update and sudo apt-get install ruby guessnet instead of the aptitude commands. Not sure why as I usually use aptitude.

Nice one. Ciao!

#13 lardawge on 07.23.09 at 16:50

Looks like it only installs p72. Vulnerabilities are fixed in p174. Sorry for the downer. Instructions to install from source?

#14 TOBY on 07.28.09 at 04:30

Hi, Thank you for your nice tips.

I have one problem.
sudo aptitude safe-upgrade
then, it goes and does 306 all packages upgrade to intrepid…
Can I no-upgrade it to intrepid without only ruby?

#15 sandeep on 11.05.09 at 12:50

thanks for the great writeup leon! and thank you, tobyo, for the tip!

#16 Pulkit on 12.10.09 at 15:08

for the line numbers just use vim and do a
:%s/\d\d\.//g and :%s/\d\.//g

:%s/\d{1,2}\.//g wasn’t working, apparently vim doesn’t recognize this construct. anyway the one mentioned above will work.

Leave a Comment