Rails 1.2.3 works with Ruby 1.8.6. You may need to update/download Ruby before continuing with your endeavors.
| CentOS | See RailsOnCentOS Portal |
| Debian | See RailsOnDebian. |
| Ubuntu | See RailsOnUbuntu |
| Ubuntu | Also see TurnKeyRails – an Ubuntu-based installable Live CD appliance created by TurnKey Linux |
| Gentoo | emerge rails or see the Gentoo Wiki entry |
| Fedora Core | See RailsOnFedora. If you do not install Ruby from source, be sure to install irb, the ruby interactive shell, as well ( yum install irb ). Otherwise, Breakpoint will not work properly. FC package for irb now called ruby-irb, so “yum install ruby-irb.i386” |
| Fedora Core 3 | You can also use RailsOnSpike . It is an integrated LAMP stack + Ruby on Rails crafted by SpikeSource. |
| Fedora Core 6 | See RailsOnFedora6. |
| Redhat 9 | See Ruby and Rails on Red Hat Linux 9 (and maybe Fast CGI and Apache2 for Red Hat Linux 9). |
| FreeBSD | See RailsOnFreeBSD. |
| OpenBSD | See RailsOnOpenBSD. |
| OSX | See HowtoInstallOnMacOSX. |
| Solaris | See Cool Stack. Download the CSKruby package. |
| Windows | See RailsOnWindows |
| Rails Live CD appliance | See HowToInstallWithRailsLiveCD |
After installing Ruby, be sure to check your version by executing ‘ruby -v’. In particular, a lot of Mac OS X users get bitten by this, as Ruby 1.6, which is bundled by Apple, shadows the 1.8 installation. See SettingYourPath.
(NB: Ubuntu/Debian: openssl may give ‘not found’ error. Then do:
cd ruby_src_dir/ext/openssl
ruby extconf.rb
make
make install
http://www.semergence.com/2007/03/15/installing-openssl-support-for-ruby-on-ubuntu/
To get Ruby on Rails using Ruby Gems, see GemRails.
gem update
gem install rails --include-dependencies
(Be patient, this might take awhile. The —include-dependencies answers “yes” to any queries of whether to download other dependent projects, like rDoc.)
When you’re ready, Rails will make all the directories you need to get started and set some permissions for you to boot. All you’ve got to do, now that Rails is installed, is point the rails command at wherever you wish to create your application (this should not be a place your Web server can access directly):
rails /usr/myapp
ln -s /usr/myapp/public /var/www/myapp
The public directories in the next step are located in your new application directory.
Rails is pre-configured to reference Ruby using /usr/bin/env ruby, which should work for most installations.
If for some reason /usr/bin/env ruby doesn’t work for you, or gives you the wrong ruby interpretter, then:
public/dispatch.cgi, public/dispatch.rb, public/dispatch.fcgi, script/breakpointer, script/console, script/generate, and script/server, change this line:#!/usr/bin/env ruby
There are some command-line scripts to modify the necessary files, see ShebangChangeScripts.
Note: if you are okay with running rails under WEBrick for now, skip to section 7
Apache needs to be configured for running CGI files in order for Rails to run. So make sure you have AddHandler cgi-script .cgi somewhere in your Apache config file.
In the Apache configuration given, replace the /path/application with the full path to the rails directory unpacked with the tar.gz, and be sure to append the public or log directory on where noted below. I also had to turn on CGI and set some access requirements as shown below. The AllowOverride line is important – internally, Rails uses some redirection that takes place in a .htaccess file located in the public folder. (Suse 9.1’s Apache is locked down fairly tight.)
Rails also requires the mod_rewrite module.
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule env_module modules/mod_env.so
<VirtualHost *:80>
SetEnv RAILS_ENV development
ServerName rails
DocumentRoot /path/application/public/
ErrorLog /path/application/log/apache.log
<Directory /path/application/public/>
Options ExecCGI FollowSymLinks
AddHandler cgi-script .cgi
AllowOverride all
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Also, make sure that apache has write permissions to the /path/application/tmp directory.
Rails will report errors from Apache in log/apache.log and errors from the Ruby code in log/development.log. If you’re having a problem, do have a look at what these logs are saying.
On Unix and Mac OS X you may run tail -f log/development.log in a separate terminal to monitor your application’s execution.
After you get a basic idea of what’s going on using the tutorials above we recommend having a look at the OpenSourceProjects section. Especially if you are the type who learns best from other people’s source.
Are you having problems getting the basics running? Come ask the Railers on IRC in room #rubyonrails (IRC|How to get on IRC).
[ru] ?ачинаем о?ваивать Rails? (by Peter)[fr] CommencerAvecRails