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:
$ 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:
$ 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:
$ gem install jekyll bundler
Check your installation:
$ 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:
$ sudo apt install git
Create a new directory and clone the chirpy-starter:
$ 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.
$ sudo install apache2
$ sudo systemctl enable apache2
$ sudo systemctl start apache2
In the root directory of your blog, run the following commands:
$ 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 using apache2:
$ ./deploy.sh
Customization and others
Official tutorial: