How to install Ruby 2.1.4 on Ubuntu 14.04
First of all, install the prerequisite libraries:
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
Then install rbenv, which is used to install Ruby:
cd
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
rbenv install 2.3.1
rbenv global 2.3.1
ruby -v
Then (optional) tell Rubygems to not install local documentation:
echo "gem: --no-ri --no-rdoc" > ~/.gemrc
Credits: https://gorails.com/setup/ubuntu/14.10
Warning!!!
There are issues with Gnome-Shell
. See comment below.
How to install version specified Ruby using apt
The specific version of ruby you want to install has to be a package available in your Ubuntu distro's package repository. A quick way to check this is using apt list | grep ruby-full
or apt list | grep ruby
.
If you don't find the version you're looking for, you can add a repository and download it from there. Brightbox is a widely used repository maintaining several ruby version packages. Their installation docs should help you.
Note: I still recommend that you use a ruby version manager like rbenv
or rvm
.
How to install version specified Ruby in ubuntu
You can install rbenv
which is a Ruby Environment and then you can install the version of Ruby you want over it.
Refer to this answer
Installing Jekyll on Ubuntu 14.04
I did try installing a couple different versions. Would this cause a
problem?
No
Follow the given step would help.
1: gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
2: \curl -sSL https://get.rvm.io | bash
# install RVM (development version)
3: rvm get head
# Make Sure RVM up to date
4: rvm install ruby
# will install latest version of ruby
5: rvm list
# Listing install rubies will you get versions of ruby which is installed by RVM
6: rvm use < ruby-version >
# for instances ruby-1.9.3-p125
7: gem install jekyll
Edit Update As you edited answer in your senerio
trevor~$ rvm list
rvm rubies
ruby-2.0.0-p643 [ x86_64 ]
ruby-2.2.1 [ x86_64 ]
=* ruby-2.2.4 [ x86_64 ]
rvm use 2.2.1
gem install jekyll
Would work !!!
Error installing jekyll on ubuntu 14.04
You have a system ruby at 1.9.3
and 2.3.0
installed with some version manager.
When you call sudo ruby
or sudo gem install
that's using the system Ruby.
If you just use ruby
or gem install
that will use the version manager.
In short, just use gem install jekyll --no-rdoc --no-ri
without the sudo
.
Related Topics
How to Calculate How Many Years Passed Since a Given Date in Ruby
How to Test 'Rand()' with Rspec
How to Get Past "Http://Gems.Rubyforge.Org/ Does Not Appear to Be a Repository" Error Message
Ruby Gets/Puts Only for Strings
Rvm Does Not Install Ruby 1.9.2 on Snow Leopard: 'Error Running 'Make '
Dry Way to Assign Hash Values to an Object
Converting from Xml Name-Values into Simple Hash
Net::Ssh Sudo Command Hangs After Entering Password
Override Ruby Constant in Subclass So Inherited Methods Use New Constant Instead of the Old
Ruby Backslash to Continue String on a New Line
Rails 3 Install Error: "Invalid Value for @Cert_Chain"
How to Create a Hash in Ruby That Compares Strings, Ignoring Case