Applicable to:
- Plesk for Linux
Question
How to install different Ruby versions on 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 2.4.0-dev
is being installed:
- Install Ruby Plesk extension
- Connect to the Plesk server via SSH
- Install the 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
- On Debian/Ubuntu operating systems run:
-
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 -
Go to Extensions > Ruby and click on Refresh
Comments
3 comments
This automatically installs bundler with the most recent version.
If this causes an issue with the "Bundle Install" function in plesk, go check the "BUNDLED WITH" line in the Gemfile.lock file at the root of the Ruby application. It will contain the version of the bundler that was used when the application was created.
run
`/opt/plesk/ruby/2.4.0-dev/bin/gem uninstall bundler`
and
`/opt/plesk/ruby/2.4.0-dev/bin/gem install bundler -v <VERSION SPECIFIED IN Gemfile.lock>`
then try to click "Bundle Install" again.
@Marco T
Thank you for sharing this information! I am sure that other Pleskians will find it helpful :)
Qué decir. ¡Magnífico! rápido, directo y funcional.
Please sign in to leave a comment.