sudo apt-add-repository ppa:brightbox/ruby-ng
Hit Enter
to confirm
sudo apt-get update
Then you can install your ruby version of choice (the ppa supports ruby2.0
ruby2.1
ruby2.2
ruby2.3
and legacy versions ruby1.8
ruby1.9.1
) Don't forget to include the respective -dev
package for your version. Otherwise the development of native extensions such as Nokogiri
or mysql2
will fail.
sudo apt-get install ruby2.3 ruby2.3-dev ruby-switch
sudo ruby-switch set ruby2.3
ruby -v
>> ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
Now you can install any desired gem systemwide for all users via sudo gem install gemname
.
Note:
sudo gem install rails
) but don't run bundle
as root. If it needs to install gems it will ask for the sudo password.