home..
如何设置一个自己的github.io页面
wanmyj / August 2023 (8 Words, 1 Minutes)
config
如何设置一个自己的github.io页面
假设你有一台干净的Ubuntu环境
安装Jelly编译环境
sudo apt-get install ruby-full build-essential zlib1g-dev
sudo snap install ruby --class
确认安装成功
ruby -v && gem -v && gcc -v && g++ -v && make -v
写死环境变量
echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc
echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
管理source
gem source -r https://rubygems.org/
# https://rubygems.org/ removed from sources
gem source -a http://mirrors.tuna.tsinghua.edu.cn/rubygems
# http://mirrors.tuna.tsinghua.edu.cn/rubygems added to sources
修改 Gemfile 里面的第一行,将source ‘https://rubygems.org’ 改为 source ‘http://ruby.taobao.org’ 或者用清华源,因为可能遇到SSL的问题 http://mirrors.tuna.tsinghua.edu.cn/rubygems
运行gem install jekyll bundler
如果遇到问题,添加到Gemfile gem 'webrick'
/home/sh/gems/gems/jekyll-3.9.3/lib/jekyll/commands/serve/servlet.rb:3:in `require': cannot load such file -- webrick (LoadError)
from /home/sh/gems/gems/jekyll-3.9.3/lib/jekyll/commands/serve/servlet.rb:3:in `<top (required)>'
from /home/sh/gems/gems/jekyll-3.9.3/lib/jekyll/commands/serve.rb:184:in `require_relative'
from /home/sh/gems/gems/jekyll-3.9.3/lib/jekyll/commands/serve.rb:184:in `setup'
from /home/sh/gems/gems/jekyll-3.9.3/lib/jekyll/commands/serve.rb:102:in `process'
from /home/sh/gems/gems/jekyll-3.9.3/lib/jekyll/commands/serve.rb:93:in `block in start'
from /home/sh/gems/gems/jekyll-3.9.3/lib/jekyll/commands/serve.rb:93:in `each'
from /home/sh/gems/gems/jekyll-3.9.3/lib/jekyll/commands/serve.rb:93:in `start'
from /home/sh/gems/gems/jekyll-3.9.3/lib/jekyll/commands/serve.rb:75:in `block (2 levels) in init_with_program'
from /home/sh/gems/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
from /home/sh/gems/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
from /home/sh/gems/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
from /home/sh/gems/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
from /home/sh/gems/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
from /home/sh/gems/gems/jekyll-3.9.3/exe/jekyll:15:in `<top (required)>'
from /home/sh/gems/bin/jekyll:25:in `load'
from /home/sh/gems/bin/jekyll:25:in `<main>'
以上都没问题后, bundle exec jekyll serve
启动服务
The source code for this article can be found here. If you find any errors or have any comments, please click on the link to raise an issue in the corresponding GitHub repo.