How to install Ruby on Rails on CentOS Linux
Hi everyone! Let’s install ruby on rails on CentOS 6.5? You can execute all these commands as root on your terminal or just put sudo after each command. I chose to use
'sudo -s' and log as root.
yum install ruby
Total download size: 2.3 M Installed size: 7.8 M Is this ok [y/N]: y
Then we need to install some dependancies:
yum install gcc g++ make automake autoconf curl-devel openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel sqlite-devel
Total download size: 9.5 M Installed size: 35 M Is this ok [y/N]: ...
yum install ruby-rdoc ruby-devel
Total download size: 997 k Installed size: 3.4 M Is this ok [y/N]:
The second step is to install Ruby Gems
yum install rubygems
Total download size: 206 k Installed size: 711 k Is this ok [y/N]:
Step Three — Install Rails:
gem update Updating installed gems Nothing to update
gem update --system RubyGems installed the following executables: /usr/bin/gem
gem install rails Fetching: thread_safe-0.3.3.gem (100%) Successfully installed thread_safe-0.3.3 Fetching: minitest-5.3.4.gem (100%) Successfully installed minitest-5.3.4 Fetching: tzinfo-1.1.0.gem (100%) Successfully installed tzinfo-1.1.0 Fetching: json-1.8.1.gem (100%) Building native extensions. This could take a while... Successfully installed json-1.8.1 Fetching: i18n-0.6.9.gem (100%) Successfully installed i18n-0.6.9 Fetching: activesupport-4.1.1.gem (100%) ERROR: Error installing rails: activesupport requires Ruby version >= 1.9.3.
Dam.. Our first error!
yum groupinstall -y development
curl -L get.rvm.io | bash -s stable
Now that we have our ruby version updated, let’s try again:
gem install rails
This process may take a while, be patient with it! Sometimes you can think the installation just fail, but its installing!
Lets make a hello world example:
mkdir /tmp/test;cd /tmp/test rails new blog cd blog rails server
And now, we got other error:
We solve it putting in my GemFile the follow lines:
gem 'execjs' gem 'therubyracer', :platforms =>:ruby
Let’s try again: rails server Its working! Just test in default port 3000. http://localhost:3000/