2013-07-18 09:22:21 +08:00
|
|
|
Anki Sync Server
|
|
|
|
|
================
|
|
|
|
|
|
|
|
|
|
A personal Anki sync server (so you can sync against your own server rather than AnkiWeb).
|
|
|
|
|
|
|
|
|
|
Installing
|
|
|
|
|
----------
|
2013-04-03 21:31:44 +08:00
|
|
|
|
|
|
|
|
Instructions for installing and running AnkiServer:
|
|
|
|
|
|
|
|
|
|
1. First, you need to install "virtualenv". If your system has easy_install, this is
|
|
|
|
|
just a matter of:
|
|
|
|
|
|
|
|
|
|
$ easy_install virtualenv
|
|
|
|
|
|
|
|
|
|
If your system doesn't have easy_install, I recommend getting it!
|
|
|
|
|
|
|
|
|
|
2. Next, you need to create a Python environment for running AnkiServer and install some of
|
|
|
|
|
the dependencies we need there:
|
|
|
|
|
|
|
|
|
|
$ virtualenv AnkiServer.env
|
2013-08-02 12:00:03 +08:00
|
|
|
|
2013-08-14 19:26:30 +08:00
|
|
|
$ AnkiServer.env/bin/easy_install webob simplejson
|
2013-04-03 21:31:44 +08:00
|
|
|
|
|
|
|
|
3. Download and install libanki. You can find the latest release of Anki here:
|
|
|
|
|
|
2013-08-02 02:06:51 +08:00
|
|
|
http://code.google.com/p/anki/downloads/list
|
2013-04-03 21:31:44 +08:00
|
|
|
|
|
|
|
|
Look for a *.tgz file with a Summary of "Anki Source". At the time of this writing
|
2013-07-13 05:08:16 +08:00
|
|
|
that is anki-2.0.11.tgz.
|
2013-04-03 21:31:44 +08:00
|
|
|
|
2013-07-13 05:08:16 +08:00
|
|
|
Download this file and extract.
|
2013-08-02 02:06:51 +08:00
|
|
|
|
2013-07-13 05:08:16 +08:00
|
|
|
Then either:
|
2013-04-03 21:31:44 +08:00
|
|
|
|
2013-07-13 05:08:16 +08:00
|
|
|
a. Run the 'make install', or
|
|
|
|
|
|
|
|
|
|
b. Copy the entire directory to /usr/share/anki
|
2013-04-03 21:31:44 +08:00
|
|
|
|
2013-08-14 19:26:30 +08:00
|
|
|
4. Copy the example.ini to production.ini and edit for your needs.
|
2013-07-13 05:08:16 +08:00
|
|
|
|
2013-08-14 19:26:30 +08:00
|
|
|
5. Create authentication database:
|
2013-08-02 02:06:51 +08:00
|
|
|
|
2013-08-02 12:00:03 +08:00
|
|
|
$ sqlite3 auth.db 'CREATE TABLE auth (user VARCHAR PRIMARY KEY, hash VARCHAR)'
|
2013-08-02 02:06:51 +08:00
|
|
|
|
2013-08-14 19:26:30 +08:00
|
|
|
6. Create user:
|
2013-08-02 02:06:51 +08:00
|
|
|
|
|
|
|
|
Enter username and password when prompted.
|
|
|
|
|
|
|
|
|
|
$ read -p "Username: " USER && read -sp "Password: " PASS
|
|
|
|
|
|
|
|
|
|
$ SALT=$(openssl rand -hex 8)
|
|
|
|
|
|
2013-08-02 12:00:03 +08:00
|
|
|
$ HASH=$(echo -n "$USER$PASS$SALT" | sha256sum | sed 's/[ ]*-$//')$SALT
|
2013-08-02 02:06:51 +08:00
|
|
|
|
2013-08-14 19:26:30 +08:00
|
|
|
$ sqlite3 auth.db "INSERT INTO auth VALUES ('$USER', '$HASH')"
|
2013-08-02 02:06:51 +08:00
|
|
|
|
2013-08-02 12:00:03 +08:00
|
|
|
$ mkdir -p "collections/$USER"
|
2013-08-02 02:06:51 +08:00
|
|
|
|
|
|
|
|
$ unset USER PASS SALT HASH
|
|
|
|
|
|
2013-08-14 19:26:30 +08:00
|
|
|
7. Then we can run AnkiServer like so:
|
2013-04-03 21:31:44 +08:00
|
|
|
|
2013-10-14 05:10:52 +08:00
|
|
|
$ AnkiServer.env/bin/python src/sync_app.py
|
2013-04-03 21:31:44 +08:00
|
|
|
|