使用sonic搭建个人博客

官网

https://github.com/go-sonic/sonic

安装

安装环境
Ubuntu 20.04.6 LTS (GNU/Linux 5.15.0-1053-azure x86_64)

mkdir blog
cd blog
wget https://github.com/go-sonic/sonic/releases/download/v1.1.3/sonic-linux-amd64.zip
unzip sonic-linux-amd64.zip

配置

vi conf/config.yaml

主要配置项
server下host和port
sonic下work_dir和log_dir
注意要配置成绝对路径,不然启动容易失败
数据库可以使用默认的sqlite3

cd systemd
vi sonic.service

主要配置项
ExecStart
注意要使用绝对路径

启动

复制服务配置
sudo cp sonic.service /etc/systemd/system/

启动服务
sudo systemctl start sonic

查看状态
sudo systemctl status sonic
journalctl -f

配置自启动
sudo systemctl enable sonic

测试运行

使用/admin进行初始化安装配置