I'm installing ruby latest version (2.2.1) using RVM on CentOS. & set it as default version. following this link :-
http://tecadmin.net/install-ruby-1-9-3-or-multiple-ruby-verson-on-centos-6-3-using-rvm/
Here my assumption is that i have latest ruby version & set as by default.
Ruby 1.8 ships by default with CentOS.
Now when i'm running puppet server to install some default module it is still pointing Ruby 1.8. using following link : https://forge.puppetlabs.com/puppetlabs/aws#installing-the-aws-module
All i wanted to achieve is installing latest ruby or may be Ruby 1.9.3 version and configuring puppet with the same ruby version.
You are using root and it will use the PATH for the root not the regular user under RVM. Unless of course you installed RVM with the root user which is not recommended.
Related
I have been trying to install React Native into my Mac. In the installation docs, it requires Ruby version of 2.7.6 have been to be installed.
I have installed a new Ruby version using rbenv manager and it was successful. But now I cannot switch my machine to new Ruby version. Any help will be highly appreciated.
Thanks!
You have to set the version for the directory where your react project is. You can do this with:
rbenv local 2.7.6
This creates a file called .ruby-version in the directory, which tells rbenv what version of Ruby to use.
This is all visible in the README of rbenv.
You can have a look at this solution
Use the below command to change your ruby version:
rbenv global 3.1.2 # set the default Ruby version for this machine
# or:
rbenv local 3.1.2 # set the Ruby version for this directory
You can find this from rbenv Official Github Repo
I am currently using ruby version 2.7.0 and I want to upgrade to version 3.1.0 in ubuntu 20:04. I have installed ruby 3.1.0 by following Install ruby 3 using rbenv. This is my output of command rbenv versions, seems the installation is completed.
peisen#peisen:~$ rbenv versions
* system (set by /home/peisen/.rbenv/version)
3.1.0
However, when i check my ruby version using ruby -v
peisen#peisen:~$ ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]
It shows the version is still 2.7.0. I am still a beginner in ubuntu and not sure how to modify this. I followed this post but this did not work for me. Any ideas?
The output
peisen#peisen:~$ rbenv versions
* system (set by /home/peisen/.rbenv/version)
3.1.0
means that you have two versions installed, system Ruby and 3.1.0. The asterisk indicates that system Ruby is still the currently selected version.
To switch to Ruby 3.1.0 globally run:
$ rbenv global 3.1.0
See the docs about rbenv global and other options to set your desired Ruby version.
I am trying to upgrade Ruby because I need to setup a Jekyll template, and I need to latest version to do it. Since I have a Mac running Sierra, I already have Ruby preinstalled as well as the Homebrew installation. When I install it using brew install ruby, it works, but when I check the version, it is still at 2.0.0 instead of 2.3.1 where it should be. Homebrew says I have 2.3.1, but the CLI says I have 2.0.0. I tried to use brew link --override ruby to make it work, but it said everything was working and it got me nowhere.
Use rbenv and plugin ruby-build. It will keep several versions of ruby on the one machine.
After install go to directory with your code, run rbenv install 2.3.1 and create file .ruby-version containing 2.3.1. All scripts running from this directory will use ruby 2.3.1.
Or you will able to set ruby version for all running scripts - rbenv global 2.3.1
Am trying to install Ruby and RubyGems on a RedHat 5.5 machine. I'd got them by running the following two commands:
sudo yum install ruby
sudo yum install rubygems
Got both installed. However when i try to run gem, i got the following error:
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require': undefined methodend_with?' for "no such file to load --
Win32API":String (NoMethodError)
from /usr/lib/ruby/site_ruby/1.8/rubygems/config_file.rb:55
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in
gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:inrequire'
from /usr/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:8
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in
gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:inrequire'
from /usr/bin/gem:9
Doesn't matter what kind of command i run, it throws that. (I tried gem -v, gem update)
The version of Ruby seems to be 1.8 but i have problem determining the RubyGems version. I'd vi into rubygems.rb and at the top it stats the version as 1.5.
Try to fix by running the downgrade command as proposed here, but it throws the same error as well.
Any help on fixing this issue? Just want to get this running so that i can run a RoR apps..
RedHat 5 ships with Ruby 1.8.5 and an equally old rubygems. Both, the rubygems and the ruby version is WAY too old to be supported by anything outside the base packages of the OS anymore. Even in the OS packages, they probably won't change anything on their own due to the age of their whole system.
If you really want/have to use Ruby on Red Hat 5, you probably need to get another source for it that the RPMs provided by the OS, e.g. rbenv / ruby-build or ruby-install or even rvm. You should use a newer Ruby version, i.e. a 2.1 or 2.2 version. All Ruby versions < 2.0 are unsupported by the language developers by now.
Alternatively, you should try to use a newer version of RedHat, i.e. RedHat 7 which doesn't need to support to 8 year old software...
Suspicious here is that yum installed ruby 1.8 which is pretty outdated version, it seems you have two versions of ruby on your system now and gem tries to use the old one.
Check the version of the package installed recently and try to force rubygems to use the new version(by removing the old ruby or linking to the path returned by which ruby)
I am using Ruby on Rails 3.2.2 and RVM (Ruby Version Manager). By using RVM I installed 2 Ruby versions: first 1.9.3 and then 1.9.2. After I run the rvm use --default 1.9.2 command line I closed and reopened the Terminal window. Finally I run the following command lines in the Terminal window:
$ which ruby
/<MY_USER_PATH>/.rvm/rubies/ruby-1.9.2-p318/bin/ruby
$ ruby -v
ruby 1.9.2p318 (2012-02-14 revision 34678) [x86_64-darwin10.8.0]
However, if I add the <%= "Ruby version #{RUBY_VERSION}" %> code in a view file of my Ruby on Rails project I get Ruby version 1.9.3.
Why my Ruby on Rails project is still running with the Ruby version 1.9.3? How can I make that to run in Ruby 1.9.2?
Passenger doesn't care about RVM, you need to compile Passenger with the Ruby version you want to use, and follow its instructions to setup Apache's configuration accordingly.
If you want to switch Ruby versions, you need to reinstall Passenger's Apache module via passenger-install-apache-module and follow the instructions.
You will likely see that the PassengerRuby directive in your Apache config is pointing to a specific ruby.
If you need different Ruby versions with Passenger, Phusion's blog post on this may be helpful. RVM's docs on Passenger integration are worth reading as well.
I would guess that Apache (Passenger?) is using your globally installed version of Ruby, which looks like ruby 1.9.2. Do a sudo su and then try which ruby and see if you're still pointing to the RVM version of ruby. That version of Ruby is the one that Apache is using, you'd have to setup ruby globally to allow Apache (Passenger) to use it.