Setting up Jekyll on Windows
This is how I installed Jekyll on Windows 10 using two approaches:
Background:
- Jekyll requires Ruby to run
- GitHub Pages can host Jekyll sites
- This blog is hosted on GitHub Pages
The official instructions are found here: https://jekyllrb.com/docs/windows/
Chocolatey
This approach runs Jekyll directly on your Windows operating system.
Open a command prompt as Administrator.
Install Chocolatey:
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
Ruby
Install Ruby:
choco install ruby
Jekyll
Open a new command prompt, so that changes to the PATH
environment variable becomes effective.
Install Jekyll:
gem install bundler jekyll
Install Gems:
bundle install
Build and serve the site:
bundle exec jekyll serve
Docker
This approach runs Jekyll in a Linux container with Docker using the image: https://github.com/Starefossen/docker-github-pages
Download and install: Docker for Windows
Share your local drives (volumes) with Docker for Windows, so that they are available to your Linux containers: Shared drives
Open a command prompt.
Build and serve the site with docker run
:
docker run -t --rm -v %CD%:/usr/src/app -p 4000:4000 starefossen/github-pages
Or build and serve the site with docker-compose
:
docker-compose up
using this docker-compose.yml
file:
Troubleshooting
Get errors when switching between the Chocolatey and Docker approach? Try to delete the Gemfile.lock
file!
Get errors like driver failed programming external connectivity on endpoint
with Docker? Try to restart Docker for Windows!