Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Upgrade/Install ruby 2.1.2 #ubuntu #12.04 #14.04

Upgrade/Install ruby 2.1.2

ubuntu 12.04 14.04

Reference http://stackoverflow.com/a/18490935/2037928

Login as root

Install needed packages

apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp

Download appropriate ruby version https://www.ruby-lang.org/en/downloads/

wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz

Unpack

tar -xvzf ruby-2.1.2.tar.gz
cd ruby-2.1.2/

Compile from source

./configure --prefix=/usr/local
make
make install

Make sure deploy user has access to installing gems

chown -R deploy:staff /usr/local/bin
chown -R deploy:staff /usr/local/lib/ruby

Login as deploy user

Install bundler

gem install bundler

Locally

cap production deploy

Remove the old manifest.yml file

rm /u/apps/YOUR_APP_NAME/shared/assets/manifest.yml

I also had to make the unicorn binary into a binstub

@PhillipMwaniki

This comment has been minimized.

Show comment
Hide comment
@PhillipMwaniki

PhillipMwaniki Jan 14, 2016

Wow, great gist.

Wow, great gist.

@izzydoesit

This comment has been minimized.

Show comment
Hide comment
@izzydoesit

izzydoesit Jan 28, 2016

Thanks, this was really helpful. After going through up until checking if deploy user has access to install gems, everything compiled fine. However, I get an error when I check "chown -R deploy:staff /usr/local/bin" which has a message "chown: invalid user: 'deploy:staff' and when I check version "ruby -v" it is still the old 1.9.3p484. Do you know what might be the problem?

Thanks, this was really helpful. After going through up until checking if deploy user has access to install gems, everything compiled fine. However, I get an error when I check "chown -R deploy:staff /usr/local/bin" which has a message "chown: invalid user: 'deploy:staff' and when I check version "ruby -v" it is still the old 1.9.3p484. Do you know what might be the problem?

@swoogles

This comment has been minimized.

Show comment
Hide comment
@swoogles

swoogles Mar 12, 2016

Rarely does a web search return such an exact answer. Thanks for this. It helped me get command-t working in my recent Vim install.

Rarely does a web search return such an exact answer. Thanks for this. It helped me get command-t working in my recent Vim install.

@levifig

This comment has been minimized.

Show comment
Hide comment
@levifig

levifig Apr 13, 2016

@everysum1 deploy is not a default user. You have to create it first before you can chown it…

levifig commented Apr 13, 2016

@everysum1 deploy is not a default user. You have to create it first before you can chown it…

@sam452

This comment has been minimized.

Show comment
Hide comment
@sam452

sam452 May 17, 2016

Hmm. how does this become the system ruby? My contents of the /usr/local/lib only contains python and the site_ruby folder.

sam452 commented May 17, 2016

Hmm. how does this become the system ruby? My contents of the /usr/local/lib only contains python and the site_ruby folder.

@moeinrahimi

This comment has been minimized.

Show comment
Hide comment
@moeinrahimi

moeinrahimi May 20, 2016

awesome, nice script !

awesome, nice script !

@mehranshakeri

This comment has been minimized.

Show comment
Hide comment
@mehranshakeri

mehranshakeri May 24, 2016

Nice, very easy and helpful.
Just one question. I used these steps to upgrade my ruby on ubuntu 14.04. Everything went well instead of "cap production deploy".
I'm not familiar with CAP and it returns this error:

/usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- capistrano/cli (LoadError) from /usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
from /usr/bin/cap:3:in `

'

Does it create any problem somewhere or not?
Anyway my ruby is upgraded to version 2.1.2 and it seems it's working fine.(I just need it for SASS for compiling my project)

Nice, very easy and helpful.
Just one question. I used these steps to upgrade my ruby on ubuntu 14.04. Everything went well instead of "cap production deploy".
I'm not familiar with CAP and it returns this error:

/usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- capistrano/cli (LoadError) from /usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
from /usr/bin/cap:3:in `

'

Does it create any problem somewhere or not?
Anyway my ruby is upgraded to version 2.1.2 and it seems it's working fine.(I just need it for SASS for compiling my project)

@scmx

This comment has been minimized.

Show comment
Hide comment
@scmx

scmx Feb 3, 2017

Wow, I had no idea there were comments, forks and lots of stars here. Glad you all found it useful. I barely remember writing this and the instructions seems to have been very specific to my usecase.

Owner

scmx commented Feb 3, 2017

Wow, I had no idea there were comments, forks and lots of stars here. Glad you all found it useful. I barely remember writing this and the instructions seems to have been very specific to my usecase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment