Installing Jekyll on Ubuntu | Generated by AI

Home 2025.10

Setting Up and Running Jekyll on Ubuntu

Based on your error (“Command ‘bundle’ not found”) and the commands you’re trying to run, it looks like you need to install Ruby, Bundler, and Jekyll properly first. Ubuntu doesn’t come with these by default, but it’s straightforward using the official Jekyll guide. I’ll walk you through the full setup step by step, then how to run your specific commands.

Step 1: Install System Dependencies

Open your terminal and run this to install Ruby and build tools (this includes Ruby 3.x via ruby-full):

sudo apt update
sudo apt install ruby-full build-essential zlib1g-dev

To install gems without root privileges (prevents permission errors later):

echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc
echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

Step 3: Install Jekyll and Bundler

Now install the tools:

gem install jekyll bundler

Step 4: Create and Run Your Blog

Now you can run the commands from your snippet. I’ll explain each:

  1. Create a new Jekyll site:
    jekyll new myblog
    
    • This generates a basic site in a myblog folder.
  2. Enter the directory:
    cd myblog
    
  3. Install dependencies (this is where your original bundle install failed—now it should work):
    bundle install
    
    • Pulls in gems like Jekyll plugins.
  4. Serve the site (starts a local server at http://127.0.0.1:4000):
    bundle exec jekyll serve
    
    • Open your browser to that URL to see your site.
  5. Serve with incremental rebuilds (faster for development, only rebuilds changed files):
    bundle exec jekyll serve --incremental
    
  6. Serve including drafts (shows unpublished posts):
    bundle exec jekyll serve --draft
    
  7. If you get a “webrick” error (common on Ruby 3+, as it’s not bundled by default):
    bundle add webrick
    
    • Then restart the serve command: bundle exec jekyll serve.
    • Alternatively, add gem "webrick" to your Gemfile and run bundle install.
  8. Quick serve without Bundler (if you skip bundle exec):
    jekyll serve
    
    • But use bundle exec for consistency in projects.

Troubleshooting

Once served, edit files in _posts/ or _config.yml and save—Jekyll auto-rebuilds. For production, build with jekyll build and deploy to GitHub Pages or Netlify.

Jekyll Ubuntu Installation Guide


Back

x-ai/grok-4-fast

Donate