How to install Jekyll on Debian 11 / Debian 10 Linux?. Jekyll is one of the most popular static site generators with all features you’ll need in a Content Management System (CMS). Its key focus in performance and security, unlike other database-driven CMS systems. With Jekyll, you can transform your plain text files into static websites and blogs in seconds.
Jekyll Features
Jekyll is Simple: You don’t need to understand database administration, comment moderation, or pesky updates to install – just your content.
Fit for Static content: You can use Markdown, Liquid, HTML & CSS go in. Static sites come out ready for deployment on a web server of your choice.
Jekyll is Blog-aware: It handles Permalinks, categories, pages, posts, and custom layouts pretty well.
In this tutorial, we will install Jekyll on Debian 11 / Debian 10 Linux and create a sample website. We will also cover content generation, then publish and deploy to production.
Step 1 — Install Jekyll on Debian 11 / Debian 10
We will start by updating all system packages to the latest releases. Then proceed to install Jekyll.
sudo apt update && sudo apt -y upgrade -y [ -f /var/run/reboot-required ] && sudo reboot -f
Jekyll requires a working Ruby development environment which includes libraries. Use the following commands to install Jekyll and required build tools.
sudo apt -y install make build-essential
Install Ruby package and development tools:
sudo apt -y install ruby ruby-dev
We now need to instruct Ruby’s gem package manager to place gems in logged in user’s home directory. Add below line to ~/.bashrc or ~/.zshrc depending on your shell,
export GEM_HOME=$HOME/gems
export PATH=$HOME/gems/bin:$PATH
Now source your .bashrc|.zshrc file for the changes to take effect.
#Bash
source ~/.bashrc
#Zsh
source ~/.zshrc
Once this has been done, will use gem to install Jekyll and Bundler which is a tool used to manage Gem dependencies.
$ gem install bundler Fetching bundler-2.4.4.gem Successfully installed bundler-2.4.4 Parsing documentation for bundler-2.4.4 Installing ri documentation for bundler-2.4.4 Done installing documentation for bundler after 0 seconds 1 gem installed
Install Jekyll on Debian 11 / Debian 10
$ gem install jekyll
Confirm installation by checking the version:
$ jekyll --version
jekyll 4.3.1
Step 2 – Creating a new website with Jekyll
Now that all required things have been set, let’s proceed to add a site for Jekyll. For this, we will use the command jekyll new site.
This will initiate bundle installation of required dependencies with a default Jekyll theme. After a successful installation, you should see output like:
$ jekyll new blog.geeksforgeeks.org Running bundle install in /root/blog.geeksforgeeks.org... Bundler: Fetching gem metadata from https://rubygems.org/............ Bundler: Resolving dependencies... Bundler: Fetching rake 13.0.6 Bundler: Installing rake 13.0.6 Bundler: Using bundler 2.4.4 Bundler: Using public_suffix 5.0.1 Bundler: Using colorator 1.1.0 Bundler: Using eventmachine 1.2.7 Bundler: Using http_parser.rb 0.8.0 Bundler: Using ffi 1.15.5 Bundler: Using forwardable-extended 2.6.0 Bundler: Using google-protobuf 3.21.12 (x86_64-linux) Bundler: Using rb-fsevent 0.11.2 Bundler: Fetching rexml 3.2.5 Bundler: Using concurrent-ruby 1.1.10 Bundler: Using liquid 4.0.4 Bundler: Using mercenary 0.4.0 Bundler: Using rouge 4.0.1 Bundler: Using safe_yaml 1.0.5 Bundler: Using unicode-display_width 2.4.2 Bundler: Using webrick 1.7.0 Bundler: Using addressable 2.8.1 Bundler: Using em-websocket 0.5.3 Bundler: Using sass-embedded 1.57.1 Bundler: Using rb-inotify 0.10.1 Bundler: Using pathutil 0.16.2 Bundler: Using i18n 1.12.0 Bundler: Using jekyll-sass-converter 3.0.0 Bundler: Using listen 3.8.0 Bundler: Using terminal-table 3.0.2 Bundler: Using jekyll-watch 2.2.1 Bundler: Installing rexml 3.2.5 Bundler: Using kramdown 2.4.0 Bundler: Using kramdown-parser-gfm 1.1.0 Bundler: Using jekyll 4.3.1 Bundler: Fetching jekyll-feed 0.17.0 Bundler: Fetching jekyll-seo-tag 2.8.0 Bundler: Installing jekyll-feed 0.17.0 Bundler: Installing jekyll-seo-tag 2.8.0 Bundler: Fetching minima 2.5.1 Bundler: Installing minima 2.5.1 Bundler: Bundle complete! 7 Gemfile dependencies, 34 gems now installed. Bundler: Use `bundle info [gemname]` to see where a bundled gem is installed.Don't run Bundler as root. Installing your bundle as root will break this application for all non-root users on this machine. New jekyll site installed in /root/blog.geeksforgeeks.org.
A directory will be created with Jekyll source files used to create a static site:
$ sudo apt -y install tree
$ tree blog.geeksforgeeks.org/
blog.geeksforgeeks.org/
├── 404.html
├── about.markdown
├── _config.yml
├── Gemfile
├── Gemfile.lock
├── index.markdown
└── _posts
└── 2023-01-18-welcome-to-jekyll.markdown
1 directory, 7 files
Note that you have to cd to this directory before you can start using it.
cd blog.geeksforgeeks.org/
Jekyll’s built-in lightweight web server will serve content on port 4000. If you have firewall service enabled, allow access to this port:
sudo ufw allow 4000
Jekyll is designed to support live development by automatically detecting changes of files and automatically regenerating the static site whenever a change is saved.
Step 3: Start Jekyll Server on Debian
To start Jekyll built-in web service, navigate to site directory and start Jekyll web server using jekyll serve command followed by host IP address to bind to.
$ cd ~/blog.geeksforgeeks.org $ jekyll serve --host=0.0.0.0 Configuration file: /home/debian/blog.geeksforgeeks.org/_config.yml Source: /home/debian/blog.geeksforgeeks.org Destination: /home/debian/blog.geeksforgeeks.org/_site Incremental build: disabled. Enable with --incremental Generating… Jekyll Feed: Generating feed for posts done in 0.152 seconds. Auto-regeneration: enabled for '/home/debian/blog.geeksforgeeks.org' Server address: http://0.0.0.0:4000/ Server running… press ctrl-c to stop.
When jekyll serve command is executed, Jekyll will parse configuration and pushes content files into a directory called _site. It then serves the content in this _site directory:
$ ls -1 _site/
404.html
about
assets
feed.xml
index.html
jekyll
Jekyll will also watch for new changes on ~/blog.geeksforgeeks.org directory when a change to a post or page is saved, it will automatically rebuild the static site. Place all site posts under the _posts directory.
Visit server’s IP address and port 4000 to see default web page.
If you are using Web server like Nginx or Apache, you need to copy content inside _site/ to its Web document root. Read more on Jekyll Documentation.
More on CMS:
- Install Drupal on Debian
- Install Drupal on CentOS 8
- Install Hugo on Debian / Ubuntu
- Install Ghost CMS on Ubuntu / CentOS