Install Apache:

yum install httpd
yum install curl-devel httpd-devel

Install Ruby and Ruby and Rails:

gpg --keyserver hkp:// --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
\curl -sSL | bash -s stable --rails
source ~/.rvm/scripts/rvm
rvm requirements
rvm install ruby
rvm use ruby --default
rvm rubygems current
gem install rails

Install the Passenger:

gem install passenger 

Validate passenger install:

sudo /home/USER/.rvm/gems/ruby-2.2.1/gems/passenger-5.0.26/bin/passenger-config validate-install

You may need to run the following commands:

export ORIG_PATH="$PATH"
 rvmsudo -E /bin/bash
 export PATH="$ORIG_PATH"
 /home/USER/.rvm/gems/ruby-2.2.1/wrappers/ruby /home/USER/.rvm/gems/ruby-2.2.1/gems/passenger-5.0.26/bin/passenger-config validate-install --validate-apache2 --invoked-from-installer

You will get something like this, copy it into /etc/httpd/conf/httpd.conf:

LoadModule passenger_module /home/USER/.rvm/gems/ruby-2.2.1/gems/passenger-5.0.26/buildout/apache2/
 <IfModule mod_passenger.c>
 PassengerRoot /home/USER/.rvm/gems/ruby-2.2.1/gems/passenger-5.0.26
 PassengerDefaultRuby /home/USER/.rvm/gems/ruby-2.2.1/wrappers/ruby

Install SQLite (If you need it):

yum install sqlite-devel

Change to home directory, and create a rails app:

cd ~
rails new myapp -d postgresql
cd myapp
gem 'therubyracer'
bundle install

Edit /etc/httpd/conf/httpd.conf, add to the bottom (I used the port 3000 for a purpose, you can use the default 80):

<VirtualHost yourdomain:3000>
 DocumentRoot /home/USER/myapp/public
 UserDir enabled USER

Don’t forget to add at the top:

Listen [::]:3000

Then edit /etc/sysconfig/iptables, add these lines:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 3000 -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 3000 -j ACCEPT

sudo service iptables restart
sudo service httpd restart

Install PostgreSQL:

sudo rpm -Uvh
sudo yum update
sudo yum install postgresql94-server postgresql94-contrib
sudo yum install postgresql postgresql-contrib postgresql-client
sudo yum install postgresql-server-dev-9.4 (for server)
sudo yum install libpq-dev (for client)
sudo yum install postgresql-devel
sudo service postgresql-9.4 initdb
sudo service postgresql-9.4 start
sudo chkconfig postgresql-9.4 on


Create a database:

sudo -u postgres psql
\password postgres
postgres=# create user testdba with encrypted password 'PASSWORD';
postgres=# grant all privileges on database testdb to testdba;

edit config/database.yml

enter the database name, username and the password.

rake db:migrate