avatar

博客环境迁移到ubuntu

Git

$ sudo apt install git
  • 初始化Git:
git config --global user.name "***"
git config --global user.email "***@qq.com"
  • 创建SSH-Key:
ssh-keygen -t rsa -C "***@qq.com"
  • 查看创建结果:
cat ~/.ssh/id_rsa.pub
  • 验证SSH-key:
ssh -T git@github.com
  • 拉文件

仓库里添加SSH-key之后,可以拉拉文件了:

git clone git@github.com:***.github.io.git

Ruby

$ sudo apt-get install ruby-full

RubyGems

  • 下载 TGZ

进入包目录,执行:

$ sudo ruby setup.rb

[sudo] pc 的密码:
Bundler 1.17.3 installed
RubyGems 3.0.4 installed
Regenerating binstubs
`/usr/share/rubygems-integration/all/gems/rake-12.3.1/exe/rake` does not exist, maybe `gem pristine rake` will fix it?
Parsing documentation for rubygems-3.0.4
Installing ri documentation for rubygems-3.0.4
...
...
...
RubyGems installed the following executables:
/usr/bin/gem2.5
/usr/bin/bundle2.5

Ruby Interactive (ri) documentation was installed. ri is kind of like man
pages for Ruby libraries. You may access it like this:
ri Classname
ri Classname.class_method
ri Classname#instance_method
If you do not wish to install this documentation in the future, use the
--no-document flag, or set it as the default in your ~/.gemrc file. See
'gem help env' for details.

注意到有「rake」缺失警告,补一下它:

$ sudo gem pristine rake
Restoring gems to pristine condition...
Cached gem for rake-12.3.1 not found, attempting to fetch...
Fetching rake-12.3.1.gem
Restored rake-12.3.1

Jekyll

$ sudo gem install jekyll
...
...
...
$ sudo gem install jekyll-feed
[sudo] pc 的密码:
Fetching jekyll-feed-0.12.1.gem
Successfully installed jekyll-feed-0.12.1
Parsing documentation for jekyll-feed-0.12.1
Installing ri documentation for jekyll-feed-0.12.1
Done installing documentation for jekyll-feed after 0 seconds
1 gem installed

测试

jekyll server
Configuration file: /home/pc/文档/blog/98wb.github.io/_config.yml
Source: /home/pc/文档/blog/98wb.github.io
Destination: /home/pc/文档/blog/98wb.github.io/_site
Incremental build: disabled. Enable with --incremental
Generating...
Jekyll Feed: Generating feed for posts
done in 6.32 seconds.
Auto-regeneration: enabled for '/home/pc/文档/blog/98wb.github.io'
Server address: http://127.0.0.1:4000
Server running... press ctrl-c to stop.

上传

更新内容并上传:

  • 直接上传
git status && git add -A && git commit -a -m"第一次部署" && git push
  • 合并同步
git status && git pull && git add -A && git commit -a -m"更新" && git push
打赏
  • 微信
    微信
  • 支付寶
    支付寶

评论