CentOS8搭建Anki同步服务器
感觉新学期背诵压力会很大,就想起以前看到过的Anki,最近正在琢磨使用方法。发现Ankiweb的速度不够理想,打算自己搞个同步服务器,在这个过程中遇到了很多坑,总共花了将近三小时,已经身心俱疲了,意识到docker真是个好东西。
升级Python3.10
ankisyncd需要Python3.8及以上版本,这里索性升级到Python3.10。
1 | # 淘宝源Python安装包 |
安装
1 | # 下载源码 |
弹出ModuleNotFoundError: No module named '_sqlite3'
解决错误
在网上搜索后执行yum install sqlite3-devel -y
,系统镜像又出问题,发现是CentOS8官方源下线了,国内的镜像更换了地址,依照阿里源官方文档进行替换。
1 | # 更换阿里源 |
然后发现没有用(
只能按照网上大多数推荐的办法,安装sqlite3后重新安装Python。
1 | wget https://sqlite.org/2022/sqlite-autoconf-3370200.tar.gz |
在Python-3.10.2/setup.py
中发现sqlite_inc_paths已经包含了'/usr/local/sqlite/include'和'/usr/local/sqlite/include/sqlite3'
就不需要再添加了,直接重新安装Python即可。
1 | ./configure --enable-loadable-sqlite-extensions --prefix=/usr/local/bin/python3 |
继续安装并使用
1 | cd anki-sync-server-2.3.0/src/ |
参照下方配置nginx。
1 | server { |
然后输入python -m ankisyncd
若打开网页显示Anki Sync Server
,则运行成功。
进程守护
vim /usr/lib/systemd/system/ankisyncd.service
1 | [Unit] |
1 | # 更新配置 |
参考链接:
https://blog.plotcup.com/2022/02/03/anki-sync-server-deploy/
https://github.com/ankicommunity/anki-sync-server
https://blog.csdn.net/TechRoadMan/article/details/107847493
https://www.jianshu.com/p/dd4532457b9f
https://junyixu.github.io/2021/02/19/Build-Anki-Sync-Server/