How to Install Octopress on Windows?¶
| ruby | blog |
I’ve been using Octopress on Mac OS X (i.e. have no problem). But, recently I’ve decided to run my blog on Windows machine and felt pain. Ahh, Octopress uses bunch of native extensions which actually cause a lot of cross-platform issues. My first attempt was to try JRuby due to his better Windows support, but got this:
$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Installing rake (10.4.2)
Installing RedCloth (4.2.9)
Using blankslate (2.1.2.4)
Installing hitimes (1.2.2)
Installing timers (4.0.1)
Installing celluloid (0.16.0)
Installing chunky_png (1.3.3)
Installing fast-stemmer (1.0.2) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
.
D:/Tools/JRuby/jruby-1.7.0/bin/jruby.exe extconf.rb NotImplementedError: C extension support is not enabled. Pass -Xcext.enabled=true to JRuby or set JRUBY_OPTS or modify .jrubyrc to enable.
(root) at D:/Tools/JRuby/jruby-1.7.0/lib/ruby/shared/mkmf.rb:8 require at org/jruby/RubyKernel.java:1019
(root) at D:/Tools/JRuby/jruby-1.7.0/lib/ruby/shared/rubygems/custom_require.rb:1
(root) at extconf.rb:1
Gem files will remain installed in D:/Tools/JRuby/jruby-1.7.0/lib/ruby/gems/shared/gems/fast-stemmer-1.0.2 for inspection.
Results logged to D:/Tools/JRuby/jruby-1.7.0/lib/ruby/gems/shared/gems/fast-stemmer-1.0.2/ext/gem_make.out
An error occurred while installing fast-stemmer (1.0.2), and Bundler cannot continue.
Make sure that `gem install fast-stemmer -v '1.0.2'` succeeds before bundling.
There is JRuby version of fast-stemmer
gem called jruby-stemmer
. But, I’m not ready to maintain this. That’s why I’ve decided to use RubyInstaller.
Install Ruby on Windows and SSL issues¶
-
Download (
rubyinstaller-2.1.5-x64.exe
in my case) and install [RubyInstaller]. I installed ind:\Tools\Ruby\Ruby21-x64\
folder. -
Check
rubygems
via runninggem update
and you should get the next error:
$ gem update
Updating installed gems
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)
It’s well known rubygems
issues with ready to use solution SSL upgrades on rubygems.org and RubyInstaller versions:
- Step 1: Obtain the new trust certificate, download it AddTrustExternalCARoot-2048.pem in some temp folder
- Step 2: Locate RubyGems certificate directory in your installation (in my case it’s
D:/Tools/Ruby/Ruby21-x64/lib/ruby/2.1.0/
)
$ gem which rubygems
D:/Tools/Ruby/Ruby21-x64/lib/ruby/2.1.0/rubygems.rb
- Step 3: Copy new trust certificate into
D:\Tools\Ruby\Ruby21-x64\lib\ruby\2.1.0\rubygems\ssl_certs
$ copy AddTrustExternalCARoot-2048.pem D:\Tools\Ruby\Ruby21-x64\lib\ruby\2.1.0\rubygems\ssl_certs
- Step 4: Now You should be able to run gem update without any issues
Prepare environment for Octopress¶
Now it’s time to clone Octopress blog and run it. Unfortunately, there are some minor issues which still must be fixed.
Fix Octopress native extensions issues¶
We know that Octopress uses native extensions thats why we have to additionally install Development Kit
- Download and unpack it in adjacent to Ruby install folder (
d:\Tools\Ruby\DevKit_2.1_x64\
in my case) - Link [Development Kit] installation to previously installed Ruby - Go to [Development Kit] install folder
d:\Tools\Ruby\DevKit_2.1_x64\
- Runruby dk.rb init
which generateconfig.yml
. Openconfig.yml
and add- D:/Tools/Ruby/Ruby21-x64
to the end of this file. - Runruby dk.rb install
See my Development Kit config.yml
:
# This configuration file contains the absolute path locations of all
# installed Rubies to be enhanced to work with the DevKit. This config
# file is generated by the 'ruby dk.rb init' step and may be modified
# before running the 'ruby dk.rb install' step. To include any installed
# Rubies that were not automagically discovered, simply add a line below
# the triple hyphens with the absolute path to the Ruby root directory.
#
# Example:
#
# ---
# - C:/ruby19trunk
# - C:/ruby192dev
#
---
- D:/Tools/Ruby/Ruby21-x64
Install Python¶
The default syntax highlighting engine in Octopress/Jekyll is Pygments. It’s requires Python v.2.7.x. Simply download Python v.2.7.8 and add it on system PATH
.
Final steps¶
I assume that blog was previously cloned. Now, we should perform “traditional” Ruby project ceremony:
- Install
budler
viagem install bundler
- Setup all required gems
bundle install
- Run [Octopress] preview
rake preview