Ruby on Rails for RHEL 5

Here is the quick and dirty Ruby on Rails setup for Redhat Enterprise Linux v5 with MySQL.

Using yum install ruby and mysql. The command below does not list all the required packages, but due to dependencies, the additional packages will be installed (or should be - this is all from memory).

[bm@app3 ~]$ sudo su -
[root@app3 ~]# yum install ruby ruby-devel ruby-libs ruby-irb \
> ruby-rdoc subversion-ruby mysql-server mysql-devel
[....]

Complete the basic configuration of MySQL.
[root@app3 ~]# /sbin/chkconfig mysqld on
[root@app3 ~]# service mysqld start
[root@app3 ~]# mysql_secure_installation

Download and install RubyGems. As of the date this post was written, the latest version is 1.1.1.
[root@app3 ~]# wget http://rubyforge.org/frs/download.php/35284/rubygems-1.1.1.zip
[root@app3 ~]# unzip rubygems-1.1.1.zip
[root@app3 ~]# cd rubygems-1.1.1
[root@app3 rubygems-1.1.1]# ruby setup.rb
[root@app3 ~]# cd ..
[root@app3 ~]# rm -rf rubygems-1.1.1

Now install Rails, Mongrel, the Ruby MySQL interface, Capistrano
[root@app3 ~]# gem install rails –include-dependencies –no-rdoc –no-ri
[root@app3 ~]# gem install mongrel –include-dependencies –no-rdoc –no-ri
[root@app3 ~]# gem install mysql — –with-mysql-config=/usr/bin/mysql_config
[root@app3 ~]# gem install capistrano –include-dependencies –no-rdoc –no-ri

Phusion’s passenger gem provides a “mod_rails” module for Apache. The installation is very straight forward.
[root@app3 ~]# gem install passenger
[root@app3 ~]# passenger-install-apache2-module

Just follow the on-screen instructions to finish the installation.

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

rubygems-1.1.1 requires ruby version 1.8.6 or later… which is not the version in the RHEL5 repos….

oops, ignore that. the rhel5 ruby is 1.8.5 and the rubygems is looking for 1.8.3+

thanks! seems to be working, now if only i could understand where the apache configuration file that passenger wants me to ideit is and what a virtualhost is etc… :-P

Slick, very slick. Thanks for that. The only stumbling block was the — for gem install mysql, didn’t realize it was required, thought it was a typo.

Handy! One question though… I can’t find a compatible version of subversion-ruby for RHEL5? The version that yum tries to install errors out with this error:

$ sudo yum -tv install subversion-ruby
Loading “rhnplugin” plugin
rhel-i386-server-5 100% |=========================| 1.4 kB 00:00
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
–> Running transaction check
—> Package subversion-ruby.i386 0:1.4.2-2.el5 set to be updated
–> Processing Dependency: subversion = 1.4.2-2.el5 for package: subversion-ruby
–> Finished Dependency Resolution
Error: Missing Dependency: subversion = 1.4.2-2.el5 is needed by package subversion-ruby

Any help greatly appreciated!!!

Thanks,
Nate

Hi.. instead of MySQL, how to install sqlite3 with rails? Can I use rubygems1.2 on this? thanks.

Failed on gem install mysql. Help!

# gem install mysql - -with-mysql-config=/usr/bin/mysql_config
Bulk updating Gem source index for: http://gems.rubyforge.org/
Building native extensions. This could take a while…
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb install mysql - -with-mysql-config=/usr/bin/mysql_config
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lm… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lz… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lsocket… no
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lnsl… yes
checking for mysql_query() in -lmysqlclient… no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Alex,

Regarding your mysql gem question, please confirm you have the mysql-dev package installed. You can run the following command:

# yum install mysql-server mysql-devel

My instructions were based on a fresh install of RHEL server v 5.0, so if you installed MySQL or any of the other packages from source you may need to do things differently.

Cheers,

Brad

Leave a comment

(required)

(required)