Post

How to install jekyll

A walk through how to setup jekyll the easiest way possible

How to install jekyll

Deploy Jekyll Chirpy to Cloudflare Workers from Ubuntu 22 LXC

Complete guide to install Jekyll with Chirpy theme on a fresh Ubuntu 22 LXC container and deploy it to Cloudflare using Wrangler.


Prerequisites

  • Ubuntu 22.04 LXC container
  • Internet access
  • At least 1GB RAM (2GB recommended)
  • Cloudflare account

Step 1: Update System and Install Dependencies

1
2
sudo apt update && sudo apt upgrade -y
sudo apt install -y git curl gcc g++ make

Step 2: Install Ruby and Bundler

1
2
sudo apt install -y ruby-full
sudo gem install bundler

Verify installations:

1
2
ruby --version   # Should show ruby 3.0.x or later
bundler --version

Step 3: Install Node.js and npm

1
2
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs

Verify:

1
2
node --version   # Should show v20.x
npm --version

Step 4: Install Jekyll and Chirpy Theme

1
2
3
4
git clone https://github.com/cotes2020/jekyll-theme-chirpy.git ~/chirpy-site
cd ~/chirpy-site
bundle install
bundle exec jekyll serve --host 0.0.0.0

Access at http://<your-lxc-ip>:4000
Press Ctrl+C to stop when confirmed working.


Step 5: Configure Your Site

1
nano _config.yml

Key settings to change:

Setting Description
title Your site title
description Site description
url Your Cloudflare domain (e.g., https://example.com)
timezone Your timezone (e.g., Asia/Shanghai)

Save and exit (Ctrl+X, then Y, then Enter).


Step 6: Install Wrangler (Cloudflare CLI)

1
npm install -g wrangler

If you get EACCES permission errors, install locally:

1
2
cd ~/chirpy-site
npm install --save-dev wrangler

Step 7: Authenticate with Cloudflare

1
wrangler login --device-code

Follow the URL and enter the provided code.


Step 8: Create Wrangler Configuration

1
2
3
4
5
6
7
cat > ~/chirpy-site/wrangler.jsonc << 'EOF'
{
  "name": "your-site-name",
  "compatibility_date": "2025-06-05",
  "assets": { "directory": "./_site" }
}
EOF

Replace "your-site-name" with your preferred project name.


Step 9: Build and Deploy

1
2
3
cd ~/chirpy-site
bundle exec jekyll build
npx wrangler deploy

Your site will be deployed to https://<project-name>.pages.dev


Step 10: Create Deployment Script (Optional)

1
2
3
4
5
6
7
8
9
10
11
12
13
cat > ~/chirpy-site/deploy.sh << 'EOF'
#!/bin/bash
echo "🔨 Building Jekyll site..."
cd ~/chirpy-site
JEKYLL_GIT=false bundle exec jekyll build

echo "☁️ Deploying to Cloudflare..."
npx wrangler deploy

echo "✅ Deployed!"
EOF

chmod +x ~/chirpy-site/deploy.sh

Run with: ~/chirpy-site/deploy.sh


Step 11: Add Custom Domain (Optional)

  1. Go to Cloudflare DashboardWorkers & Pages → Select your project
  2. Click Custom domainsSet up a custom domain
  3. Enter your domain and follow DNS configuration instructions

Complete Workflow Summary

Action Command
Initial clone git clone https://github.com/cotes2020/jekyll-theme-chirpy.git ~/chirpy-site
Install gems cd ~/chirpy-site && bundle install
Configure site Edit _config.yml
Build site bundle exec jekyll build
Deploy to Cloudflare npx wrangler deploy
One-command deploy ./deploy.sh

Troubleshooting

Issue Fix
Permission errors with gem install gem install --user-install bundler
bundle install fails with native extension errors sudo apt install -y build-essential ruby-dev
Wrangler login fails in headless LXC npx wrangler login --device-code
Port 4000 already in use bundle exec jekyll serve --port 4001
Git warnings during Jekyll build Add export JEKYLL_GIT=false to your script
EACCES errors with npm global install Use local install: npm install --save-dev wrangler

Notes

  • You don’t need Nginx, Apache, or any other web server
  • You don’t need to manage SSL certificates (Cloudflare provides them)
  • Your site is served globally via Cloudflare’s CDN
  • Updates are instant: just rebuild and redeploy
  • The _site/ directory is generated and should not be edited directly
This post is licensed under CC BY 4.0 by the author.

© admin. Some rights reserved.