Typo is a Ruby on Rails application and in this article you can find how to install Typo v. 4.1.1 easily in a few steps on FreeBSD 6/7.
The only requirement is to have already installed in your machine Ruby, Ruby on rails and some other required gems by Typo (mongrel, mysql, mysql, rcov, rspec, xmpp4r, flexmock, hoe, ruby-debug and ruby-debug-base). Follows my local gem complete list with package name & version :
- *** LOCAL GEMS ***
- actionmailer (1.3.6)
- actionpack (1.13.6)
- actionwebservice (1.2.6)
- activerecord (1.15.6)
- activeresource (2.1.0)
- activesupport (1.4.4)
- cgi_multipart_eof_fix (2.5.0)
- cmdparse (2.0.2)
- columnize (0.1)
- daemons (1.0.10)
- ezcrypto (0.7)
- fastercsv (1.2.3)
- fastthread (1.0.1)
- flexmock (0.8.2)
- gem_plugin (0.2.3)
- highline (1.4.0)
- hoe (1.5.3)
- linecache (0.43)
- mime-types (1.15)
- mini_magick (1.2.3)
- mongrel (1.1.5)
- mongrel_cluster (1.0.5)
- mysql (2.7)
- rails (1.2.6)
- rake (0.8.1)
- rcov (0.8.1.2.0)
- rspec (1.1.4)
- ruby-debug (0.10.1)
- ruby-debug-base (0.10.1)
- rubyforge (1.0.0)
- rubygems-update (1.1.1)
- sources (0.0.2)
- xmpp4r (0.3.2)
As you can see I use rails v. 1.2.6 and this is main reason that I use the 4.1.1 version of Typo (the last Typo version is 5.0.3 and is fully documented on the official site of Typo), but you’ll need RoR 2.x version.
Let’s start building our Typo-4.1.1 blog:
Download typo-4.1.1.tgz (use fetch or wget or via ftp)
$ fetch http://rubyforge.org/frs/download.php/20466/typo-4.1.1.tgz
Extract it in your rails work directory
$ cd my-rails-work-dir $ tar -zxvf typo-4.1.1.tgz
If you take a look no at your rails work directory you’ll see that typo-4.1.1 rails app directory is created. Before proceeding I suggest you to rename your blog in order to add later more blogs in the same rails work dir.
$ mv typo-4.1.1 MyWonderfulBlog
That’s it. Now i’m ready to configure in a few step my new blog. All work will be done inside MyWonderfulBlog directory.
Go in ~/MyWonderfulBlog/config/ and copy database.yml.example as database.yml
$ cp database.yml.example database.yml
Let’s check database.yml with our favorite editor. In production environment you’ll only need to leave the production section. I’ll change the database names – I’ll use more than one blogs in the same system – so I don’t want my databases to have the same name. I’ll use a safe mysql username & password as the following:
production: adapter: mysql encoding: utf8 database: wonderfulblog_prod username: safesql password: mysqlko9 socket: /tmp/mysql.sock
Now It’s time to create my database
$ mysqladmin -u root -p create wonderfulblog_prod
…and it’s done.
Grant privileges at the db user: safesql for the production database wonderfulblog_prod
$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is xxx Server version: 5.0.51a FreeBSD port: mysql-server-5.0.51a Type 'help;' or 'h' for help. Type 'c' to clear the buffer. mysql> grant all privileges on wonderfulblog_prod.* to 'safesql'@'localhost' identified by 'mysqlko9'; Query OK, 0 rows affected (0.09 sec) mysql> flush privileges; Query OK, 0 rows affected (0.05 sec) mysql> q Bye
Populate your database with the typo app data. The right way to act is with the magic “rake db:migrate” command, but with the version 4.1.1 this doesn’t work. Use instead:
$ rake migrate RAILS_ENV='production'
Rake will extract all necessary items in your database.
That’s all! Now Typo is ready to run! I use Mongrel to fire up my rails apps, because Mongrel it’s easy to setup, run & control. Once Mongrel is set up with a single command I get in production my application (the typo in this case, but similarly works with any app). You have only to select a port (default 3000, I use 8921 in this example), use the flag -d (daemonized – runs in background) and specify the production environment (if you don’t use the flag -e, Typo select development environment by default).
$ mongrel_rails start -d -p 8921 -e production
Open your browser and point to http://localhost:8921/admin. It’s important to put a username & password in order to safe your blog.
After that you can access the administration interface ( http://localhost:8921/admin ), and view the results at http://localhost:8921.