Articles in this section

How to install different Ruby versions on Plesk server?

kb: how-to Plesk for Linux ABT: Group B ruby

Applicable to:

  • Plesk for Linux

Question

How to install different Ruby versions on a Plesk server?

Answer

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 3.4.5 is being installed:

  1. Install Ruby Plesk extension
  2. Connect to the Plesk server via SSH
  3. Install the ruby-build tool:

    # mkdir -p "$(rbenv root)"/plugins
    # git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ru

  4. Install additional packages:
    • On Debian/Ubuntu operating systems run:

      # apt install autoconf bison build-essential libssl-dev libyaml-dev libreadline-dev zlib1g zlib1g-dev

    • On RedHat/CentOS/CloudLinux operating systems run:

      # yum groupinstall 'Development Tools'
      # yum install readline-devel libffi-devel libyaml-devel

  5. Run the following commands to build Ruby:
    List available Ruby versions:

    # /root/.rbenv/plugins/ru/bin/ruby-build --list
    3.2.8
    3.3.8
    3.4.5

    # /root/.rbenv/plugins/ru/bin/ruby-build 3.4.5 /opt/plesk/ruby/3.4.5/
    # /opt/plesk/ruby/3.4.5/bin/gem install bundler
    # plesk sbin rubymng register 3.4.5 /opt/plesk/ruby/3.4.5

  6. Log in to Plesk GUI

  7. Go to Extensions > Ruby and click on Refresh

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.