Installing Jekyll on Ubuntu 8.10
Published on Monday, 02 March 2009.
Jekyll is a simple, blog aware, static site generator. Probably because I don't know Ruby, it took me a considerable amount of time to set up, so I thought this could be useful for a person in a similar situation.
Assuming you don't even have Ruby:
$ sudo apt-get install ruby ruby1.8-dev rdoc1.8
Install Python pygments for highlighting your source code:
$ sudo apt-get install python-pygments
For some reason, gem didn't install any of the dependencies for mojombo-jekyll, so I did it manually, but later found out that I needed to add the github repository:
$ sudo gem sources -a http://gems.github.com
// now install Jekyll with dependencies auto-installed
$ sudo gem install mojombo-jekyll -s http://gems.github.com/
I was migrating from Wordpress, so I had to do the following to convert my posts to Jekyll:
$ sudo gem install sequel
$ sudo apt-get install libmysqlclient15-dev
$ sudo gem install mysql
$ export DB=my_wordpress_db
$ export USER=dbuser
$ export PASS=dbpass
$ ruby -r '/usr/lib/ruby/gems/1.8/gems/mojombo-jekyll-0.4.1/lib/jekyll/converters/wordpress' -e 'Jekyll::WordPress.process( \
"#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")'
After all that package management, when I ran Jekyll for the first time, I got several error messages from Maruku. I went for the best option and installed the alternative: RDiscount.
$ sudo gem install rdiscount
Finally, I was able to view the generated site. After this oddisey I needed a rest, so I shutted down the computer and went to sleep.
Next, you will want the "Related posts" feature. I advice you to install the following (and save some headaches):
// You could also add these packages to the initial apt-get install
$ sudo apt-get install gsl-bin libgsl0-dev
Then, you need to install the Ruby GSL package from http://rb-gsl.rubyforge.org/. Extract the rb-gsl-xxx.tar.gz file and:
$ cd rb-gsl-xxx/
$ ruby setup.rb config
$ ruby setup.rb setup
$ sudo ruby setup.rb install
However, apparently the classifier gem has a bug, a quick google search produced: Patch for `build_reduced_matrix': uninitialized constant Classifier::LSI::Matrix (NameError) but I opted for a slighly different code:
if $GSL
u * GSL::Matrix.diag( s ) * v.trans
else
u * Matrix.diag( s ) * v.trans
end
Now, when you run Jekyll with the --lsi switch, it is like 100x faster. (I might be exagerating.)
If you want a go at styling the pygmentized code, you can get a base style by executing:
$ pygmentize -f html -S colorful -a .highlight > syntax.css
Finally, this is how I run Jekyll:
// For writing/developing
$ jekyll --pygments --rdiscount
// For previewing the site (but I prefer to setup an apache vhost)
$ jekyll --pygments --rdiscount --server
// Final site generation
$ jekyll --lsi --pygments --rdiscount