How to install Ruby on Rails in CentOS 7
- Login as root
- Install the requisite libraries by using the following command
yum -y install gcc gcc-c++ make automake autoconf curl-devel openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel sqlite-devel
- Download the latest version of ruby to your host. E.g.
wget https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.0.tar.gz
- Extract and install ruby
tar -zxvf ruby-2.4.0.tar.gz cd ruby-2.4.0 ./configure make && make install
- Install rails
gem install rails
- Install a javascript runtime, e.g. therubyracer
gem install therubyracer
- Create a directory for your ruby on rails site and change directory to that path.
rails new blog cd blog
- Open Gemfile and add this below the first line
gem 'therubyracer'
- Start rails
rails server
- Open a browser and go to localhost:3000 to verify that your site is working.