The Ruby version of the website running on AWS is 2.5.2, and this version of EOL (End Of Life) is 2020/12/25, and the date is approaching. Therefore, I decided to upgrade Ruby. (The following is an excerpt of the warning on AWS)
###### WARNING:
remote:
remote: Potential EOL Ruby Version
remote:
remote: You are using a Ruby version that has either reached its End of Life (EOL)
remote: or will reach its End of Life on December 25th of this year.
remote:
remote: We suggest you upgrade to Ruby 2.6.x or later
remote:
remote: Once a Ruby version becomes EOL, it will no longer receive
remote: security updates from Ruby core and may have serious vulnerabilities.
remote:
remote: Please upgrade your Ruby version.
remote:
remote: For a list of supported Ruby versions see:
remote: https://devcenter.heroku.com/articles/ruby-support#supported-runtimes
・ Upgrade of Ruby running on AWS Cloud9 ・ Upgrade from Ruby 2.5.2 to 2.7.1 ・ Rails 5.2.4.3 ・ I don't think it's relevant because it's a version upgrade on AWS, but I access and work on AWS on MacOS 10.15.7 (Catalina).
Find out which version of Ruby you can install
$ rbenv install --list
Specify the version of Ruby you want to install and execute the version upgrade
$ rbenv install 2.7.1
Check the installed Ruby version
$ rbenv versions
* 2.7.1 (set by /home/ec2-user/environment/eventorg/.ruby-version)
When you want to reflect the Ruby version in the entire environment
$ rbenv global 2.7.1
When you want to reflect only a specific project
$ rbenv local 2.7.1
Next, if you specify the Ruby version to 2.7.1 in the Gemfile and check the ruby version with the command,
$ ruby -v
Your Ruby version is 2.5.2, but your Gemfile specified 2.7.1
I get an error.
After running rvm install "ruby-2.7.1", running ruby -v,
$ ruby -v
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
Is output and the error disappears.
Install Gem on a new version of Ruby
$ gem install bundler
After the version of Ruby in the Gemfile is 2.7.1, execute the following
$ bundle install --path=vendor/bundle
When I install a new version of Ruby, I can't use the rails command
$ rails --version
rbenv: rails: command not found
Therefore, update the gem
$ gem update --system
Install bundler
$ gem install bundler
install rails
$ gem install rails
Check the Rails version
$ rails --version
Rails 5.2.4.3
Now you can use the rails command. I ran $ rails s and I was able to access the app, so the version upgrade is complete
The work will flow in the order of Ruby-> Gem-> Rails for version upgrade. When I was aware of these three lumps, I thought that the image of the version upgrade was easy to get excited. We hope for your reference.
Upgrade of ruby 【Ruby】Your Ruby version is 2.6.3, but your Gemfile specified 2.5.8 Ruby version change
that's all
Recommended Posts