Install Typo

Install Typo

This documentation is up to date for Typo 5.0.3 and above. It covers Apache + modfcgid, Apache + mongrel, and Apache + modrails. First, we install typo.

Prerequisites

This tutorial assumes you already have Ruby >= 1.8.6 and Ruby Gems 1.0 and above installed on your machine. You may need administrative privileges to configure your web server. However, if someone already configured it for you, just skip those steps.

We’ll install Typo using the source file (.tgz or .zip) as no gem exists for 5.0.3 and above. First, download and unpack a fresh typo install.

For the stable version, get it here:

http://typosphere.org/pages/download

For the development version, get it using svn:

user@host$ svn co http://svn.typosphere.org/typo/trunk typo

Then, install the required gems you may need.

user@host$ sudo gem install rails mongrel mongrel-cluster mysql rcov rspec xmpp4r flexmock hoe ruby-debug ruby-debug-base

Edit your config/database.yml.example file and replace the adapter, username, password and production database name with yours.

In your typo/config directory :

user@host$ mv database.yml.example database.yml
user@host$ rake db:create:all # Or create the production and test databases by yourself.
user@host$ rake RAILS_ENV=production db:migrate
user@host$ rake spec

We run the tests in that last step to see if everything is alright. Is it? OK, let’s go further and configure your web and app server now. Choose from the following list.

Install Apache + FastCGI

First, you need to install Apache mod_fcgid. On Debian,

user@host$ sudo aptitude install libapache2-mod-fcgid libfcgi-dev
user@host$ sudo a2enmod fcgid

Replace your fcgid.conf with this one.

<IfModule mod_fcgid.c>
  AddHandler fcgid-script .fcgi
  SocketPath /var/lib/apache2/fcgid/sock
  IPCConnectTimeout 60
  IdleTimeout 120
  ProcessLifeTime 6000
  MaxProcessCount 128
  DefaultMaxClassProcessCount 120
  IPCConnectTimeout 120
  IPCCommTimeout 120
  DefaultInitEnv RAILS_ENV "production"
</IfModule>

Then, install the ruby fcgi driver from the gem.

user@host$ sudo gem install fcgi

Create a new Apache virtual host :

<VirtualHost your.server.ip.address:80>
  ServerAdmin admin@your.site.com
  DocumentRoot /path/to/your/typo/install/public
  ServerName your.site.com
  Options +ExecCGI +FollowSymLinks
  AddHandler fcgid-script .fcgi

  RewriteEngine On
  # If Typo is accessed via an Alias directive, then you MUST also set 
  # the RewriteBase in this htaccess file.
  #
  # Example:
  #   Alias /blog /path/to/typo/public
  #   RewriteBase /blog
  RewriteRule ^$ index.html [QSA]
  RewriteRule ^([^.]+)/!$ $1.html [QSA]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

  CustomLog /path/to/your/typo/install/log/access.log combined
  Errorlog /path/to/your/typo/install/log/error.log
</VirtualHost>

Then, delete your Typo install public/.htaccess, as you don’t need it anymore, and restart Apache.

user@host$ rm public/.htaccess
user@host$ sudo a2ensite site.com
user@host$ sudo apache2ctl restart

Also, make sure that your webserver can write to your public and tmp directories.

Install Apache + Mongrel

Install Apache + mod_rails

First, you need to install mod_rails on your host by compiling the source. This tutorial is dedicated to Debian users, but may be easily adapted to other distros.

user@host$ sudo aptitude install build-essential
user@host$ sudo gem install passenger
user@host$ sudo passenger-install-apache2-module

Now, add the following files to your apache2.conf.

user@host$ sudo echo "LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/ext/apache2/mod_passenger.so" >> /etc/apache2/apache2.conf
user@host$ sudo echo "RailsSpawnServer /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/bin/passenger-spawn-server" >> /etc/apache2/apache2.conf
user@host$ sudo echo RailsRuby /usr/bin/ruby1.8 >> /etc/apache2/apache2.conf
user@host$ sudo /etc/init.d/apache2 restart

Then, create a new Apache virtual host.

<VirtualHost your.server.ip.address:80>
  ServerAdmin admin@your.site.com
  DocumentRoot /path/to/your/typo/install/public
  ServerName your.site.com
  Options +FollowSymLinks

  RewriteEngine On
  # If Typo is accessed via an Alias directive, then you MUST also set 
  # the RewriteBase in this htaccess file.
  #
  # Example:
  #   Alias /blog /path/to/typo/public
  #   RewriteBase /blog
  RewriteRule ^$ index.html [QSA]
  RewriteRule ^([^.]+)/!$ $1.html [QSA]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

  CustomLog /path/to/your/typo/install/log/access.log combined
  Errorlog /path/to/your/typo/install/log/error.log
</VirtualHost>

Delete your Typo install public/.htaccess, as you don’t need it anymore, and restart your Apache.

user@host$ rm public/.htaccess
user@host$ sudo a2ensite site.com
user@host$ sudo apache2ctl restart

Check that your webserver can write to your public and tmp directories.

This entry was posted on Sun, 26 Aug 2007 01:36:00 GMT and Posted in . You can follow any any response to this entry through the Atom feed. You can leave a comment .


Comments

Leave a response

  1. Bill McGonigle 4 months later:
    If you get:
    no such file to load -- rcov/rcovtask
    when you try to:
    rake db:migrate RAILS_ENV=production
    then you need to:
    gem install rcov
    and then rake should work.
  2. bruce16888@yahoo.com.tw 5 months later:
    Can't find the plugin 'all'! ??
  3. yuri 5 months later:
    after solving the problem with "Can't find the plugin 'all'" : $:~/projects/typo-5.0.2$ ./script/console Loading development environment. /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:263:in `load_missing_constant':NameError: uninitialized constant ActionView::Helpers::SanitizeHelper >> Article NameError: uninitialized constant ActionView::Helpers::SanitizeHelper from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:263:in `load_missing_constant' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:452:in `const_missing' from /Users/leikind/projects/typo-5.0.2/app/models/content.rb:296 from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:203:in `load_without_new_constant_marking' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:203:in `load_file' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:342:in `new_constants_in' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:202:in `load_file' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:94:in `require_or_load' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:248:in `load_missing_constant' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:452:in `const_missing' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:464:in `const_missing' from /Users/leikind/projects/typo-5.0.2/app/models/article.rb:4 from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:203:in `load_without_new_constant_marking' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:203:in `load_file' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:342:in `new_constants_in' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:202:in `load_file' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:94:in `require_or_load' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:248:in `load_missing_constant' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:452:in `const_missing' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:464:in `const_missing' from (irb):1>> The grep doesn't find any SanitizeHelper. Guys, your app just doesn't work.
  4. Larry Vincent 5 months later:
    I tried to upgrade today and ran into the rcov and plugin'all' issues. Rcov is particularly problematic if you're trying to install on a shared host. Unable to resolve, reverted back to v4.
  5. Matthias Hennemeyer 6 months later:
    It seems that sqlite3 is a requirement for typo. (gem install typo will fail without)
  6. nestor 6 months later:
    Do you know how you can install typo under tomcat? maybe using netbeans?

Leave a comment