This is the repository for my blog. There is also a comment repository for my blog.
-
Install Ruby and other prerequisites:
# Ubuntu sudo apt install ruby-full build-essential zlib1g-dev
# ArchLinux sudo pacman -S --needed ruby base-devel
-
Configure RubyGems packages(called gems) to be installed in a folder under your home directory:
echo '# Install Ruby Gems to ~/.gems' >> ~/.bashrc echo 'export GEM_HOME="$HOME/.gems"' >> ~/.bashrc echo 'export PATH="$HOME/.gems/bin:$PATH"' >> ~/.bashrc source ~/.bashrc
or manually write the following lines in your .bashrc(or .zshrc, etc) file and execute
source ~/.bashrc
:# Install Ruby Gems to ~/.gems export GEM_HOME="$HOME/.gems" export PATH="$HOME/.gems/bin:$PATH"
-
更改 RubyGems 为国内镜像源:
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/ # 更改 bundle 的源代码镜像(安装完 bundler 后再执行) bundle config mirror.https://rubygems.org https://gems.ruby-china.com
确保只有 gems.ruby-china.com
$ gem sources -l https://gems.ruby-china.com
-
Install Jekyll and Bundler(they are gems):
gem install jekyll bundler
If you use Ruby 3.0(maybe you use ArchLinux), you may see the following WARNING:
WARNING: You don't have /home/jax/.local/share/gem/ruby/3.0.0/bin in your PATH, gem executables will not run.
Then just add it to your PATH:
# ~/.bashrc export PATH="$HOME/.local/share/gem/ruby/3.0.0/bin:$PATH"
-
Add webrick if you use Ruby 3.0 or later:
gem add webrick
-
Create an empty directory or use an existing one:
mkdir -p ~/blog cd ~/blog
-
Initialize a new Jekyll site in an empty directory:
jekyll new .
or use an existing directory:
jekyll new . --force
-
Test your site:
bundle exec jekyll serve
here is a frequently used variant:
bundle exec jekyll serve --drafts --incremental
-
Look around your site directory:
$ ls -l 404.html Gemfile Gemfile.lock README.md _config.yml _posts _site about.markdown index.markdown
-
Check out this first: https://jekyllrb.com/docs/step-by-step/08-blogging/
-
Create new posts in /_posts under your site directory.
-
Create a new empty repository on GitHub:
-
Initialize the local repository and push it to Github:
git init git add . git commit -m "first commit" git branch -M main git remote add origin <your_repo_url> git push -u origin main
-
Activate Github Pages
Special thanks for Unsplash and its uploaders <3