In this guide, we will learn how to install Ruby 1.8 and Rubygems 1.3.7 on Ubuntu 14.04. This guide was a result of my frustration trying to get Fedena running on Ubuntu 14.04.
After hours of research, I finally figured out how to do it right. Read on!
apt-get update && apt-get upgrade -y
apt-get install gawk g++ gcc make libc6-dev libreadline6-dev zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 autoconf libgdbm-dev libncurses5-dev automake libtool bison pkg-config libffi-dev unzip
To avoid a segmentation fault when setting up rubygems, we require an older compiler.
Failing to this will result in this error:
/usr/local/lib/ruby1.8/timeout.rb:60: [BUG] Segmentation fault
apt-get install gcc-4.4 g++-4.4
Download and compile ruby:
wget http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p374.tar.gz tar -xzvf ruby-1.8.7-p374.tar.gz cd ruby-1.8.7-p374 ./configure
Build a MakeFile using the specific compiler. An alternative here is to set the ‘CC’ and ‘CXX’ variables:
make CC=gcc-4.4 make install
We check that ruby 1.8 is installed. If you have the following output, then you’re good.
ruby -v ruby 1.8.7 (2013-06-27 patchlevel 374) [i686-linux]
Download and install rubygems:
wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz tar -xzvf rubygems-1.3.7.tgz cd rubygems-1.3.7 ruby setup.rb
We check that rubygems is installed. The expected output is 1.3.7
gem -v 1.3.7
If everything went as expected, you should now have Ruby 1.8 and Rubygems 1.3.7 installed on Ubuntu 14.04 Thrusty Tahr. You can now proceed to install gems.
gem install rails -v 2.3.5 --no-ri --no-rdoc
I’d like to give credit to Aaron Copley who helped with instructions to setup rubygems here.
Let’s hear from you in the comments!