I was looking for a way to work with Jekyll in my Windows 10 box in order to preview my blog before committing to GitHub. I found that setting up Jekyll on Windows is a little tricky so I was looking for a way to run it using Vagrant. Searching on Google I found the jsturtevant/jekyll-vagrant project by James Sturtevant that fits perfectly my need. The project has a related post: Running Jekyll in Windows where James describes his solution.
Here are the steps you need to start working with Jekyll and Vagrant as depicted by James in his post.
Setup
- Install Vagrant and Virtual Box. If you need help you can read this post: Getting Started with Vagrant on Windows.
Clone the jekyll-vagrant repository
git clone https://github.com/jsturtevant/jekyll-vagrant.git
- Open command prompt to location of the
vagrantfile
in the new cloned repository and runvagrant up
- Jekyll and all it’s dependencies are installed!
Existing Jekyll Projects
- Copy the projects folder to the folder that contains the
vagrantfile
. - Login to the VM using
vagrant ssh
New Jekyll Projects
- Open a command prompt to location of the
vagrantfile
and runvagrant ssh
- Once in the VM prompt
cd /vagrant
- Create a new site with
jekyll new <sitename>
Start the Site
- In the VM prompt
cd /vagrant/<YourProjectFolder>
- Start the Jekyll server
jekyll serve --force_polling --host 0.0.0.0
(force polling is required with vagrant because of share) - On your host machine you can open any browser and navigate to
localhost:4000
- Work on you project on your host machine and see updates as they happen on
localhost:4000
James has also made experiments with Docker that he describes in this post: Running Jekyll in Windows Using Docker.