2.4 KiB
ankisyncd
A personal Anki sync server (so you can sync against your own server rather than AnkiWeb). This version has been simplified to remove some dependencies.
Installing
Manual installation
-
First, you need to install "virtualenv". If your system has easy_install, this is just a matter of:
$ easy_install virtualenvIf your system doesn't have easy_install, I recommend getting it!
-
Next, you need to create a Python environment for running ankisyncd and install some of the dependencies we need there:
$ virtualenv ankisyncd.env $ ankisyncd.env/bin/easy_install webob simplejson -
Download and install libanki. You can find the latest release of Anki here:
http://code.google.com/p/anki/downloads/list
Look for a *.tgz file with a Summary of "Anki Source". At the time of this writing that is anki-2.0.11.tgz.
Download this file and extract.
Then either:
a. Run
make install, orb. Copy the entire directory to /usr/share/anki
-
Copy the example.ini to production.ini and edit for your needs.
-
Create authentication database:
$ sqlite3 auth.db 'CREATE TABLE auth (user VARCHAR PRIMARY KEY, hash VARCHAR)' -
Create user:
# Enter username and password when prompted. $ read -p "Username: " USER && read -sp "Password: " PASS $ SALT=$(openssl rand -hex 8) $ HASH=$(echo -n "$USER$PASS$SALT" | sha256sum | sed 's/[ ]*-$//')$SALT $ sqlite3 auth.db "INSERT INTO auth VALUES ('$USER', '$HASH')" $ mkdir -p "collections/$USER" $ unset USER PASS SALT HASH -
Then we can run ankisyncd like so:
$ ankisyncd.env/bin/python src/sync_app.py
Via PKGBUILD
There's PKGBUILD available for Arch Linux. To install, simply run:
$ wget https://codeload.github.com/jdoe0/ankisyncd-pkgbuild/zip/master
$ unzip master
$ cd ankisyncd-pkgbuild-master
$ makepkg -s
$ sudo pacman -U *.xz
Configuration file is at /etc/ankisyncd/ankisyncd.conf
To start the server run:
$ sudo systemctl start ankisyncd
Setting up Anki
To make Anki use ankisyncd as its sync server, create a file (name it something like ankisyncd.py) containing the code below and put it in ~/Anki/addons.
import anki.sync
anki.sync.SYNC_URL = 'http://127.0.0.1:27701/sync/'
Replace 127.0.0.1 with the IP address or the domain name of your server if ankisyncd is not running on the same machine as Anki.