Friday, October 18, 2013

Octopress Setup

As the first post of this blog, I’d like to start with how to setup the blog system - Jekyll, a blog aware static site generator, and Octopress, a framework based on it.

Steps

1. Install Git

sudo apt-get install git

2. Install Ruby

At the time of writing, Octopress requires Ruby 1.9.3+.
sudo apt-get install ruby

3. Get Octopress and its dependencies

git clone git://github.com/imathis/octopress.git octopress
cd octopress
gem install bundler
bundle install
On Ubuntu 13.10, the following error occurred at bundle install.
Using rake (0.9.2.2) 
Installing RedCloth (4.2.9) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
...
The following line fix it for me.
    sudo apt-get install ruby1.9.1-dev

4. Install default theme

The following command will install the default Octopress theme.
    rake install

5. Config you blog

The configuration is quite easy, edit octopress/_config.yml and change some values.
Basically for a Hello World blog, you could just change the following lines.
    url: http://yourdomain.name
    title: Your Blog's Title

6. Write a post

The following command will create a new markdown file in source/_post folder.
It’s file name will be like 2013-10-18-hello-world.markdown. Add some test content and
then you are almost ready to see your new blog.
    rake new_post["Hello World"]

7. Generate and preview

Run the following command and visit http://localhost:4000 and enjoy your new blog system.
    rake genreate
    rake preview

No comments:

Post a Comment