In this article, we will have explained the necessary steps to install and configure Ruby on CentOS 8. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.
Ruby Ruby is a dynamic, open source, object-oriented scripting language created with simplicity and productivity in mind. RVM (Ruby Version Manager) is a tool for installing and managing multiple Ruby versions on single operating systems.
Install Ruby on CentOS
Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.
Step 2. Install Ruby on CentOS 8.
- Installing Ruby from the CentOS repositories
Run the following command as root to install the ruby package:
Once installed, check version:
- Installing Ruby using Rbenv
curl-sLhttps://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-installer | bash -
Before starting using rbenv we need to add $HOME/.rbenv/bin to our PATH:
echo'eval "$(rbenv init -)"'>>~/.bashrc
The current latest stable version for Ruby is 2.7.1 at the time of writing this tutorial. Run below command to install Ruby:
To check if everything has been successful, just show the current version of ruby:
- Installing Ruby with RVM
Then, run the following commands to import the GPG keys and install RVM:
curl-sSLhttps://get.rvm.io | bash -s stable
To start using RVM you need to run following command:
Verify the installation:
Congratulation, you have learned how to install and configure Ruby on CentOS 8. If you have any question, please leave a comment below.