Rails, Apache2 and SUSE
Getting Rails up and running on Apache2 on SUSE is takes a little work as at the moment Rails is not part of the the SUSE software updates network. This means you must build Rails (and Ruby if using SuSE < 9.3) and the FastCGI development kit from source.
1. First off it you need Ruby 1.8.2 (or greater) to run Rails. If you have a version less than this you will need to compile and install Ruby from source.
Install GCC, make, the C devel, zlib and zlib-devel packages using Yast.
Download the latest version of Ruby from http://www.ruby-lang.org/
Untar the source file to /usr/local/src, compile and install (as root or sudo):
tar -xzf ruby-1.8.3.tar.gz
cd ruby-1.8.3
./configure
make
make test
make install
ln -s /usr/local/bin/ruby /usr/bin/ruby
2. Install gems (a ruby package manager). Download gems from http://rubyforge.org/projects/rubygems/Untar the source code into /usr/local/src, compile and install (as root or sudo):
tar -xzf rubygems-0.8.11.tgz
cd rubygems-0.8.11
./configure
make
make install
ln -s /usr/local/bin/gem /usr/bin/gem
3. With ruby and gems installed install Rails:gem install rails --include-dependencies
4. With Rails installed create a test project and test the Rails WebBrick server.
5. Using Yast install the mod_fastcgi package for integrating Rails into Apache2.
6. From http://www.fastcgi.com/ download the FastCGI development package. Untar the source into /usr/local/src and compile:
tar -xzf fcgi-2.4.0.tar.gz
cd fcgi-2.4.0
./configure
make install
gem install fcgi -- --with-fcgi-dir=/usr/local/
8. Edit /etc/sysconfig/apache2 and in the modules section add fastcgi to the list of modules loaded by Apache when it starts.9. Create a new virtualhost in Apache for your Rails application. Use the following template as an example:
<VirtualHost *:80>
ServerName rails.test.domain
AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
DocumentRoot /srv/www/rails/RailsTestProject/public
<Directory /srv/www/rails/RailsTestProject/public>
RewriteEngine On
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
Options ExecCGI FollowSymLinks
AllowOverride all
Allow from all
Order allow,deny
</Directory>
</VirtualHost>
if you have the problem with
if you have the problem with the zlib, you have to
enable zlib to compile it with ruby:
http://lucaschan.com/weblog/2007/03/22/installing-ruby-on-rails-on-cento...
after that make sure the zlib.so is in: /usr/local/lib/ruby/site_ruby/1.8/
Good luck, terminal7
Thanks for this bit of info
Thanks for this, I haven't tried setting up Ruby on Rails on SUSE for a while (especially under 10.3) but I would hope it is getting easier.
Problem in Suse 9.2
I installed ruby (1.8.4) ok, but cannot seem to install gem properly.
i download and tar rubygems-0.8.11.tgz but there is no ./configure directory so i run /usr/local/bin/ruby setup.rb
at that point the installation seems to work fine but when i run gem i get the following error:
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require__': no suchfile to load -- zlib (LoadError) from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require' from /usr/local/lib/ruby/site_ruby/1.8/rubygems/package.rb:9 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require' from /usr/local/lib/ruby/site_ruby/1.8/rubygems/builder.rb:1 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require' from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:61:in `manage_gems' from /usr/local/bin/gem:4
HELp????
RE: Problem in Suse 9.2
Do you have the zlib and zlib-devel packages installed. From the error message it would suggest you are lacking one or both.