Please bear in mind that the python interpreter bitness will decide which executable bitness you'll have, eg if you want windows x64 executables, you'll need to download python x64.
For the rest of this manual, we'll assume the you use:
- On Windows:
-`C:\python310-64\python.exe` as python interpreter
-`C:\npbackup` as folder containing the NPBackup sources you downloaded and extracted / cloned from git
- On Linux:
-`python3` as python interpreter
-`/opt/npbackup` as folder containing the NPBackup sources you downloaded and extracted / cloned from git
You may also use a python virtual environement (venv) to have a python "sub interpreter", but this is out of scope here too.
Once you've got yourself a working Python environment, you should download and extract the NPBackup sources (or clone the git). NPBackup has multiple python dependencies, which are stated in a file named `requirements.txt`.
You can install them all toghether by running `python -m pip install -r path/to/requirements.txt` (please note that `path/to/requirements.txt` would give something like `C:\path\to\requirements` on Windows)
Examples:
- On Windows: `C:\python310-64\python.exe -m pip install -r c:\npbackup\npbackup\requirements.txt`
- On Linux: `python3 -m pip install -r /opt/npbackup/npbackup/requirements.txt`
You will also need to install the [Nuitka Python compiler](https://www.nuitka.net). Pre-built executables are built with the commercial version of Nuitka, which has multiple advantages over the open source version, but the latter will suffice for a working build.
Example:
- On Windows: `C:\python310-64\python.exe -m pip install nuitka`
NPBackup relies on the excellent [restic](https://restic.net) backup program.
In order for NPBackup to work, you'll need to download restic binaries from [the restic repo](https://github.com/restic/restic/releases/) into `npbackup/RESTIC_SOURCE_FILES` and uncompress them. On Windows, you'll probably want something that can uncompress bzip2 files, like 7zip or [7zip-zstd](https://github.com/mcmilk/7-Zip-zstd). On Linux, your standard `bzip2 -d` command will do. Please keep all restic binaries at the root of the source folder, without any subfolders.
You can still use NPBackup in CLI mode without tcl/tk.
Keep in mind that linux built executables will only work on machines with equivalent or newer glibc version. You should always try to build NPBackup on the oldest working machine so your builds will work everywhere (I build on RHEL 7).
Note that we also changed the default backup admin password, which is used to see unencrypted configurations in the GUI.
## Actual compilation
Easiest way to compile NPBackup is to run the `bin/compile.py` script, which can build public (the executables on github) or private (your executables).
On Windows, run the following commands after adjusting the paths:
On Linux, you might want to build for arm / aarch64, this can be achieved using a chrooted arm environment, than following the instructions all over again once chrooted.
Debian has `debootstrap` which allows to install a full Debian OS for another arch/platform.
Install an arm emulator and the necessary debian OS with `apt-get install qemu-user-static binfmt-support debootstrap`