Home Set Up a Jekyll Development Site with Chirpy theme on Ubuntu 22.04
Post
Cancel

Set Up a Jekyll Development Site with Chirpy theme on Ubuntu 22.04

What is Jekyll

Here is the official statement.

Jekyll is a simple, blog-aware, static site generator perfect for personal, project, or organization sites. Think of it like a file-based CMS, without all the complexity. Jekyll takes your content, renders Markdown and Liquid templates, and spits out a complete, static website ready to be served by Apache, Nginx or another web server. Jekyll is the engine behind GitHub Pages, which you can use to host sites right from your GitHub repositories.

For more information, see Jekyll’s official site and its GitHub repo.

Install Jekyll

Install Ruby and other prerequisites:

1
2
$ sudo apt update
$ sudo apt install gcc build-essential ruby ruby-full zlib1g-dev

Ruby version must be 2.5.0 or higher, including all development headers (check your Ruby version using ruby -v)

Avoid installing RubyGems packages (called gems) as the root user. Instead, set up a gem installation directory for your user account. The following commands will add environment variables to your ~/.bashrc file to configure the gem installation path:

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

Then, install Jekyll and Bundler:

1
$ gem install jekyll bundler

Check your installation:

1
2
$ Jekyll -v
$ bundler -v

Install Chirpy theme

Here is the demo and GitHub repo of Chirpy theme.

To get the theme from GitHub, git is needed:

1
$ sudo apt install git

Create a new directory and clone the chirpy-starter:

1
2
3
4
5
6
7
$ mkdir blog
$ cd blog
$ git clone https://github.com/cotes2020/chirpy-starter.git
$ mv ./chirpy-starter/* .
$ rm -rf chirpy-starter
$ bundle
$ bundle add webrick

Deployment

Here I use apache2 (i.e. httpd) to deploy my site.

1
2
3
$ sudo apt install apache2
$ sudo systemctl enable apache2
$ sudo systemctl start apache2

In the root directory of your site run the following commands:

1
2
3
4
5
6
$ echo "#"\!"/bin/bash" > deploy.sh
$ echo "jekyll b" >> deploy.sh
$ echo "sudo rm -rf /var/www/html/*" >> deploy.sh
$ echo "sudo cp -r ./_site/* /var/www/html" >> deploy.sh
$ echo "echo \"Deploy success"\!"\"" >> deploy.sh
$ sudo chmod 775 deploy.sh

Now you can run this script to depoly your site and update your posts using apache2:

1
$ ./deploy.sh

Customization and others

Official tutorial:

Customize the Favicon

Writing a New Post

Text and Typography

Enable Google Page Views

This post is licensed under CC BY 4.0 by the author.
Trending Tags