Wednesday, January 7, 2015

How to Install Octopress in Windows

Do you want to install Octopress on Windows? I tried it recently and found it to be a bit of a pain , but I documented it and decided to publish it. Funny thing, I write about a lot of Windows/.Net stuff on here, but I write all these articles on a Linux box. It’s certainly more convenient to do it that way, but if you really must run it in Windows, here’s your guide.

Why am I writing this?

I Googled this issue and found some instructions, but they aren’t complete. There are things missing even from the Octopress site so I decided to create a barebones Windows 7 virtual machine and install Octopress as if I weren’t a developer who already had all this stuff installed. I consider this to be a complete installation guide because it shows ALL the steps needed.

Getting Started

You should be fairly familiar with the command prompt, you’re going to need it. To find it, click on the Start button, and in the search box type “cmd” and the console will come up. You’ll also need to use Windows PowerShell as well, I’ll show you how to get to it when we need it.

Install Git

You will need Git to download some of the stuff you’ll need, so go here:
Install it with the default features.

Install Yari

Yari is a great tool for managing your Ruby environment and is reccommended for using Octopress in Windows. Run the following commands in your command prompt window:
cd %USERPROFILE%
git clone git://github.com/scottmuc/yari.git .yari
This will download Yari into your user profile. Now we need to set the path.
WARNING - Do not set the path in the manner that’s described in the Yari instructions. This will overwrite your path, which is undesirable.

How to safely set up your path

Click on Start Button and then right click on Computer and select properties:
"How to install Octopress in Windows"
Click “Advanced system settings”
"How to install Octopress in Windows"
Click “Environment Variables”
"How to install Octopress in Windows"
In this window select the “Path” section and click on edit.
"How to install Octopress in Windows"
This will bring up a dialog with your current path. This is what we’ll change:
"How to install Octopress in Windows"
Warning do not erase this information! We want to add the following to the end of this path:
;%USERPROFILE%\.yari\bin;C:\Python27
The semicolon is not a typo, this separates the path from the previous one. If there is already a semicolon at the end that’s fine.
Click OK 3 times or until all the windows close.
Close your command prompt window and reopen it.

Install thru Windows PowerShell

There is another alternative and it doesn’t hurt to run this as well.
To open a PowerShell, click the Start button and select
Start -> All Programs -> Accessories -> Windows PowerShell (folder) -> Windows PowerShell
Copy the following text and paste it in:
(new-object Net.Webclient).DownloadString("https://github.com/scottmuc/yari/raw/master/installer.ps1") | iex
Now go back to your command prompt window (black background) and type in
yari 1.9.2 
The first time you run this it will take a while. This installs and sets up your Ruby environment.
You may see something like this:
"How to install Octopress in Windows"
This is because you need to install Ruby as an admin. To do that you’ll need to run PowerShell as Administrator. When selecting the PowerShell icon
Start -> All Programs -> Accessories -> Windows PowerShell (folder) -> Windows PowerShell
You need to right click the icon and select properties:
"How to install Octopress in Windows"
Select “run as Administrator” then run the following command
cd %USERPROFILE%
and then paste the following:
(new-object Net.Webclient).DownloadString("https://github.com/scottmuc/yari/raw/master/installer.ps1") | iex
Now, run Yari again:
yari 1.9.2 
This will successfully install it.
Now type in
ruby -v
and you should see something like this:
"How to install Octopress in Windows"
Now you have Ruby set up and the battle’s almost over!

Install Octopress

Now we will follow the same instructions as on the Octopress site to install it:
Go to the folder you want to install Octopress in and type the following:
git clone git://github.com/imathis/octopress.git octopress
after this downloads, run the following:
Gem install bundler
bundle install
Now it’s setup, and you have to install the default theme:
rake install
And it’s ready to go! but there a few more steps.

Install Python

Go to Python.org and get the version most appropriate for your machine. Install Python with the defaults and have it install to C:\Python27
Note that even though the 64 bit release says AMD 64 you can still install it with a 64 bit Intel chip as well.

Try it out

Now that you have everything set up, try it out. You want to edit the _config.yml file to adjust settings for your site.
Create a new post:
rake new_post["Hello World! I did it!"]
and then edit the resulting file that’s created in the _posts folder. Save it.
rake generate
Check your public folder and you should see new files there! You’re up and running!

Summary

I hope this has helped you install Octopress in Windows. As I said there are a few tutorials on the net for doing this, but they are incomplete or inaccurate. I hope this post is thorough enough that you get a good understanding of the process and get it set up.
I usually generate this site in Linux, because it’s easier, faster and my Linux machine is connected to automated backups. But you can use this in Windows if you choose and it works pretty well. If you have any questions or comments, leave them below!

1 comment:

  1. I was searching for loan to sort out my bills& debts, then i saw comments about Blank ATM Credit Card that can be hacked to withdraw money from any ATM machines around you . I doubted thus but decided to give it a try by contacting {skylinktechnes@yahoo.com} they responded with their guidelines on how the card works. I was assured that the card can withdraw $5,000 instant per day & was credited with $50,000 so i requested for one & paid the delivery fee to obtain the card, i was shock to see the UPS agent in my resident with a parcel{card} i signed and went back inside and confirmed the card work's after the agent left. This is no doubts because i have the card & has made used of the card. This hackers are USA based hackers set out to help people with financial freedom!! Contact these email if you wants to get rich with this Via email skylinktechnes@yahoo.com whatsapp/t: +1(213)785-1553

    ReplyDelete