With the new versions of Anki, `anki` now provides an integrated sync-server feature, allowing for up-to-date scheduler versions as long as anki on the server is also updated regularly.
Other implementations such as [Anki Sync Server](https://github.com/dsnopek/anki-sync-server) might be less resource intensive but need to be updated separately to allow for newer scheduler versions.
This requires quite a bit of memory, but a lot if it is shared. If you run anything else using python (very likely), running this sync server in addition should maybe require an additional 100-200M.
We're assuming here that you are running the latest Anki on your server, however you manage to do that (some distros are quite conservative with their anki versions). On Arch, I currently maintain the `anki` and `anki-qt5` packages in the AUR so they should be up-to-date.
## Reverse Proxy using nginx
Anki creates a sync server locally on 0.0.0.0:8080. We want to put this behind a reverse proxy for convenience.
You can create additional users using the `SYNC_USER<i>` environment variables. This stores the passwords in plain text on the machine so is less than optimal.
TODO: can we somehow store these env vars securely?
You should now be able to start your sync server via `systemctl start anki_sync_server.service`.
If everything looks good in the journal, you can `sytemctl renable anki_sync_server`.
## Connecting from your Client
### Desktop
1. Go to: `Tools -> Preferences -> Syncing`
2. Logout
3. set "Self-hosted-sync-server" to `https://anki.<yourdomain.tld>`
5. Restart anki
6. Click on `Sync` and login using your `<name1>` and `<password1>` which you set in the service file.
## Ankidroid
1. Go to: `Settings -> Advanced -> Custom sync server`