====== Anki ====== ===== Setup Client-side ===== Download Anki from https://apps.ankiweb.net to your Downloads folder. See the next section for how to choose between -qt5 and -qt6. If zstd is not already installed on your system, you'll need to install it (e.g sudo apt install zstd). Open a terminal and run the following commands, replacing the filename as appropriate. ''tar xaf Downloads/anki-2XXX-linux-qt6.tar.zst \\ cd anki-2XXX-linux-qt6 \\ sudo ./install.sh'' \\ Then under Tools/Preferences/Sync put your servers name in the field at the very bottom. In the Anki main maneu click on Sync and enter your credentials. ---- ===== Setup Server-Side ===== ==== With Pip ==== Replace ~/syncserver with your desired location, eg. /var/www/anki-syncserver: ''python3 -m venv ~/syncserver \\ ~/syncserver/bin/pip install anki \\ SYNC_USER1=user:pass ~/syncserver/bin/python -m anki.syncserver'' \\ If you're not using systemd, make a script to export all the environment variables that the server will need and make sure to run it a boot! For generating the password hash, anki recommends [[https://git.sr.ht/~laalsaas/pbkdf2-password-hash|this.]] ''#!/bin/sh \\ export PASSWORDS_HASHED=1 \\ export SYNC_USER1='nikolaus:$pbkdf2-sha256$i=600000,l=32$34UcId4LZ7vYEjx8WVu9oA$ckIVhkKh+7LiPvcm+RhVWaRmmYt8xMVM/0y9DWp6Hew' \\ export SYNC_HOST=127.0.0.1 \\ export SYNC_PORT=4441 \\ export SYNC_BASE=/var/www/anki-syncserver/sync_base'' \\ After that, create an nginx reverse-proxy: '' /etc/nginx/sites-available/anki: \\ \\ server { \\ server_name anki.lautner.xyz; \\ listen 80; \\ listen [::]:80; \\ location / { \\ proxy_pass http://127.0.0.1:4441/; \\ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; \\ proxy_set_header Host $http_host; \\ proxy_pass_header Authorization; \\ } \\'' Then symlink it to sites-enabled and run ''certbot --nginx'', that will take care of the ssl stuff, hence why we have ''listen 80;'' in the file. Now, you can start the anki-syncserver by running the following command: \\ ''. /var/www/anki-syncserver/set-anki-variables.sh \\ /var/www/anki-syncserver/bin/python -m anki.syncserver'' Now, if you're running systemd, create the file ''/etc/systemd/system/anki.service'' and put the following in it: ''[Unit] \\ Description=Syncserver for Anki flashcards \\ After=default.target \\ [Service] \\ Environment="PASSWORDS_HASHED=1" \\ Environment="SYNC_HOST=127.0.0.1" \\ Environment="SYNC_PORT=4441" \\ Environment="SYNC_BASE=/var/www/anki/syncserver/sync_base" \\ Environment="SYNC_USER1='nikolaus:$pbkdf2-sha256$i=600000,l=32$34UcId4LZ7vYEjx8WVu9oA$ckIVhkKh+7LiPvcm+RhVWaRmmYt8xMVM/0y9DWp6H'" \\ ExecStart=/var/www/anki-syncserver/bin/python -m anki.syncserver \\ [Install] \\ WantedBy=default.target \\'' Enable --now it and you're set! Congrats!