Open main menu

Installing Ruby on CentOS

  • Last tested on CentOS 7.6.1810 (2019-07-23)
// install required packages
$ sudo yum install gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel sqlite-devel

// install RVM
$ curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
$ curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -
$ curl -L get.rvm.io | bash -s stable

// load RVM environment
$ source /home/skan/.rvm/scripts/rvm
$ rvm reload

// verify dependencies
$ rvm requirements run

// check the list of Ruby versions available for installation
$ rvm list known

// install a specific version
$ rvm install 2.6

// check currently installed versions
$ rvm use 2.6 --default

// check which version is the default
$ ruby --version