Prashanth Babu

Ramblings on Hadoop Ecosytem, Java, etc.

Octopress blogging setup on a new machine

This post gives a brief intro to setting up Octopress blog on a new Windows machine. This assumes you already have your blogs on your GitHub account and are changing the machine or setting up on a new machine.

Step 1: Install Ruby v1.9.3

Download and install Ruby v1.9.3 from here. ruby --version should give something on the lines of ruby 1.9.3p551 (2014-11-13) [i386-mingw32].

Step 2: Install RubyDevKit

Download and install Ruby Dev Kit from here

Change the directory to folder where you installed RubyDevKit and then run the following commands:

cd RubyDevKit
ruby dk.rb init
ruby dk.rb install

Step 3: Clone your repo and install dependencies

Clone your repository preferably using GitHub client for Windows. Please note you must point to source and not master of your GitHub repo.

Change directory to that folder [in this case, I am referring to my folder as an example; you must change to your appropriate folder] and run the following commands:

cd p7h.github.com
gem install bundler
bundle install

Step 3a: If you get SSL errors from running the above commands

If the above commands fail, manually add trust certificate to Rubygems and then retry to install the dependencies with the above commands.

Step 4: Setup the GitHub pages and generate and preview the blog

Run the following commands to complete the blog setup. With preview you can view your blog on your machine on port 4000:

cd p7h.github.com
rake setup_github_pages
rake generate
rake preview

Step 5: GitHub Personal Access Token

If you have enabled 2 FA on GitHub, you must get GitHub access token from applications page on GitHub. You need to give this access token for user name while performing git commit or rake deploy or rake gen_deploy in the next steps.

Step 6: Deploy the blog

Once you are done with all your changes, deploy your changes to your blog by running these commands:

cd p7h.github.com
rake generate
rake deploy

Or generate and deploy both together with a single command:

cd p7h.github.com
rake gen_deploy

Step 7: Commit your changes

cd p7h.github.com
git add -A
git commit -m 'commit message'
git push origin source

Step 8: Other useful commands

For creating a new page:

cd p7h.github.com
rake new_page["new page"]

For creating a new post:

cd p7h.github.com
rake new_post["new post"]