Installing Ruby in Ubuntu 9.10 (and OpenSSL)
// March 20th, 2010 // Linux
In the package manager for Ubuntu (Synaptic) we already have a “ruby” package. It wasn’t until recently though that I realised the “rubygems” part just didn’t work. Now that I’m depending on libraries such as “mocha” this is a blocking factor. There seems to be an ongoing argument between the ruby community and Ubuntu developers as to how it should all be managed (via gem or synaptic, or both). As far as I was concerned, I just want it all working so didn’t step into the debate. Instead by going on various forums and blogs, I’ve composed an all-in-one script that will install ruby v1.9.1 in Ubuntu.
Here it is, just paste the whole lot into a terminal window, and run it:
sudo apt-get remove -y ruby ruby1.8 ruby1.9 ruby1.9.1 rubygems rubygems1.8 rubygems1.9 rubygems1.9.1 &&
sudo apt-get autoremove -y &&
sudo apt-get install -y build-essential zlib1g-dev libssl-dev libopenssl-ruby &&
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p376.tar.gz &&
tar zxvf ruby-1.9.1-p376.tar.gz &&
cd ruby-1.9.1-p376 &&
./configure &&
make &&
sudo make install & &cd ext/openssl &&
ruby extconf.rb &&
sudo make install &&wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz &&
tar zxvf rubygems-1.3.5.tgz &&
cd rubygems-1.3.5 &&
sudo ruby setup.rb;
You should be all setup. When installing gems, just make sure you use “sudo”, ie sudo gem install rspec
sudo gem install rspec mocha net-ssh
--with-openssl-dir=/usr/local/ssl
Many thanks (I think). All appeared to work ok. (Ruby Newbie)
Glad it helped. I’m relatively new to Ruby myself (6 months of use) and am mainly a C# developer. Was amazed that it didn’t “just work” in Ubuntu though.