Installing RAILS on Ubuntu Breezy Badger
Get ruby:
The package below apparently installs an incompatible 1.8.3 version of the ruby interpreter.
Code:
sudo apt-get install ruby1.8
On Breezy, try using the source package below, or perhaps obtain a 1.8.2 deb package?
You can instead get a .tar.gz package, and compile it from source:
Code:
wget http://rubyforge.org/frs/download.php/2338/ruby-1.8.2.tar.gz
cd ruby-1.8.2
./configure
make
make test
sudo make install
Get ruby gems:
Go to:
RubyGEMS
And download the latest version, OR use the following wget command:
Code:
wget http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz
Then:
Code:
tar -xzf rubygems-0.8.11.tgz
cd rubygems-0.8.11
sudo ruby setup.rb
Install RAILS with Ruby Gems:
Code:
sudo gem install rails
For now, do ‘NOT’ gem install mysql (Use the defaults if you plan to use mysql). I haven’t yet discovered a work around to a segfault problem that occurs. A future HOWTO to install the native mysql drivers is needed.
Fixing Ubuntu Console readline problem
You need to do this to run script/console for RAILS, or else you get the following error:
/usr/local/lib/ruby/1.8/irb/completion.rb:10:in `require’: no such file to load—readline (LoadError)
Install curses and readline
Code:
apt-get install libncurses5-dev libreadline5-dev
Manually make and install readline
Code:
cd ext/readline
ruby extconf.rb
make
sudo make install
Setup with FastCGI/Apache:
Check out:
Rails WIKI
First, get libfcgi-dev (fcgi headers) and install the fcgi gem:
Code:
sudo apt-get install libfcgi-dev
sudo gem install fcgi
Configure apache httpd.conf
Code:
Alias /namefromroot/ /home/jason/public_html/railsap/public
<Directory /home/jason/public_html/railsap/public>
Options ExecCGI
AddHandler cgi-script .cgi
AddHandler fastcgi-script .fcgi .fcg .fpl
AllowOverride all
Order allow,deny
Allow from all
</Directory>
And make a softlink to your public directory:
Code:
ln -s railsap/public /home/jason/public_html/railsap
In the above configuration, I’m making a softlink to my rails project’s public directory, to my public_html directory. I then set an alias, namefromroot, to make it easier for people to access the root of my application.
Add fastcgi to modules.conf
Open modules.conf (/etc/apache/modules.conf on my system) with your favorite editor, and add the following line:
Code:
LoadModule fastcgi_module /usr/lib/apache/1.3/mod_fastcgi.so
If you use Alias in httpd.conf for your rails directory, be sure to fix it!
Edit public/.htaccess under your project, and add RewriteBase:
Code:
RewriteBase /namefromroot
This will make it so that it redirects to the apropriate base directory.
Also, change
Code:
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
to "RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
All Directories need a+r permissions, log directory needs write permissions “0666,” and all directories under tmp/ need write permissions to store session data, etc with.
Code:
chmod -R a+r app
cd app/log/
chmod a+w *
or
chmod 0666 *
If you get an Rails application failed to start properly” Error
Make sure there are no “puts” statements in your controllers!
If it isn’t working after this:
Clear out the session data from tmp/session, and make sure it’s writable. Also, clear the cookies in your browser, so it will try to make new session data.
Bookmarks