How to install different Ruby versions on Plesk server?
Plesk provides its own set of Ruby interpreters which are installed to /opt/plesk/ruby/ directory.
Note: It is possible to check what versions of Ruby are currently installed by running the following command via SSH:
# ls -al /opt/plesk/ruby/
The output of ruby -v command or which ruby command indicates system version of ruby, that is installed in /usr/local/rvm/rubies/ folder path.
To install and make default ruby 2.5.1 on the system execute the command
# rvm install "ruby-2.5.1" and then # rvm --default use 2.5.1
Refer to the following forum thread for additional information.
To build a custom version of Ruby with a ruby-build tool apply the steps below. In this example Ruby version 2.4.0-dev is being installed:
Install Ruby Plesk extension
Connect to the Plesk server via SSH
Install ruby-build tool:
# mkdir -p "$(rbenv root)"/plugins
# git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ru
Install additional packages:
On Debian/Ubuntu operating systems run:
# apt install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g zlib1g-dev
On RedHat/CentOS/CloudLinux operating systems run:
# yum install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g zlib1g-dev
Run the following commands to build Ruby:
# /root/.rbenv/plugins/ru/bin/ruby-build 2.4.0-dev /opt/plesk/ruby/2.4.0-dev/
# /opt/plesk/ruby/2.4.0-dev/bin/gem install bundler
# plesk sbin rubymng register 2.4.0-dev /opt/plesk/ruby/2.4.0-dev
Log in to Plesk GUI
Go to Extensions > Ruby and click on Refresh