See Quickstart in README.md.
- make sure Rust and its toolchains are installed. In doubt use rustup as proposed in this link.
- clone our repo and enter into the folder
- Populate anki lib by running
scripts/clone_patch_anki
(use the corresponding bat script on windows, an env variable ANKI_REPO_URL can be set to change anki library repository url which defaults to github) - run build command
cargo build --release
- The resulting binary is available in
target/release/
We suppose that the sync server is installed in /usr/bin/ankisyncd
.
Install the configuration file in /etc/ankisyncd.toml
with root dir set to /var/lib/ankisyncd/
.
Create a new system user and group named anki
(using useradd
).
Create and change ownership of the root dir: mkdir -p /var/lib/ankisyncd/ && chmod -R o-a /var/lib/ankisyncd/ && chown -R anki:anki /var/lib/ankisyncd/
Then populate the secure service file in /etc/systemd/system/ankisyncd.service
[Unit]
Description=Anki sync server daemon
After=network-online.target
# If reverse proxy start after it
#After=network-online.target nginx.service
Wants=network-online.target
[Service]
Type=exec
ExecStart=/usr/bin/ankisyncd -c /etc/ankisyncd.toml
User=anki
Group=anki
SyslogIdentifier=ankisyncd
WorkingDirectory=/var/lib/ankisyncd/
PrivateTmp=true
PrivateDevices=true
CapabilityBoundingSet=
AmbientCapabilities=
ProtectSystem=strict
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectControlGroups=true
ProtectClock=true
ProtectHostname=true
ProtectHome=tmpfs
ProtectKernelLogs=true
ProtectProc=invisible
ProcSubset=pid
PrivateNetwork=false
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
IPAddressAllow=any
SystemCallArchitectures=native
SystemCallFilter=@system-service
SystemCallFilter=~@privileged @resources @obsolete
RestrictSUIDSGID=true
RemoveIPC=true
NoNewPrivileges=true
RestrictRealtime=true
RestrictNamespaces=true
LockPersonality=true
PrivateUsers=true
MemoryDenyWriteExecute=false
[Install]
WantedBy=multi-user.target
Reload services list systemctl daemon-reload
.
Enable and start sync server systemctl enable ankisyncd && systemctl start ankisyncd
.