Pre-requisites:
- Install Kopia. In this example, I have installed KopiaUI to
C:\Program Files\KopiaUI
. - Download Shawl from https://github.com/mtkennerly/shawl.
- Place shawl.exe in a suitable directory. In this example, shawl was placed to
C:\Program Files\Shawl\shawl.exe
. - Create a directory to store Kopia data files. In this example, we are using
C:\ProgramData\kopia
First, we will set up Kopia and check that it's working as a regular application:
-
Create a
htpasswd
file, with a user calledkopia
and a secure password. Place the file inC:\ProgramData\kopia\htpasswd
. Creating a htpasswd file on Windows is not very straightforward. If you have access to a Linux system, you can generate it there and copy it to your Windows machine$ htpasswd -c ./htpasswd kopia
-
Start Kopia for the first time, with a
--tls-generate-cert
parameter:C:\>kopia server start --tls-cert-file C:\ProgramData\kopia\kopia.cert --tls-key-file C:\ProgramData\kopia\kopia.key --htpasswd-file C:\ProgramData\kopia\htpasswd --address https://0.0.0.0:51515 --tls-generate-cert
This will generate a TLS certificate in
C:\ProgramData\kopia
.If you have Windows Firewall enabled, it should now pop up with a window asking you to allow network access for Kopia. This is needed for Kopia web-based UI to be accessible from other machines; if you don't need that, you can ignore the Firewall pop-up and close it.
-
Open your web browser, navigate to
https://localhost:51515
. The TLS certificate will be self-signed, so your browser will warn you about it not being secure. This is expected, you can safely ignore the warning and add an exception.You should be able to log in with the
kopia
user and the password you stored in thehtpasswd
file, and then see the Kopia UI in your browser. -
Stop Kopia by pressing Ctrl+C.
Next we will configure Shawl to run Kopia as a Windows service.
-
Start a command line as Administrator. You need to have Administrator rights to install and maintain Windows services.
-
Add Kopia as a Windows service using Shawl:
C:\>"C:\Program Files\Shawl\shawl.exe" add --cwd C:\ProgramData\kopia --log-dir C:\ProgramData\kopia\logs --name Kopia -- "C:\Program Files\KopiaUI\resources\server\kopia.exe" server start --tls-cert-file kopia.cert --tls-key-file kopia.key --htpasswd-file htpasswd --address https://0.0.0.0:51515
(add
--enable-actions
to the command line if you wish to enable actions) -
Configure the service to start automatically during boot, and then start it immediately.
C:\>sc config Kopia start=auto C:\>sc start Kopia
-
Check if the service is running:
C:\>sc query Kopia SERVICE_NAME: Kopia TYPE : 10 WIN32_OWN_PROCESS STATE : 4 RUNNING (STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN) WIN32_EXIT_CODE : 0 (0x0) SERVICE_EXIT_CODE : 0 (0x0) CHECKPOINT : 0x0 WAIT_HINT : 0x0
-
Open your web browser, again navigate to
https://localhost:51515
. You should be able to log in to Kopia running as a Windows service. Now proceed to configure Kopia using the web UI as usual. -
(Optional) Reboot your computer and verify that Kopia starts automatically as a service.
(consider this text public domain)
@abjoseph I did not try adding users to the server. This is for a home setup so I am not taking security as seriously as I perhaps should. If you manage to get it working, please let me know and I will update the steps.
The user I added to htpasswd is "kopia", not "kopia@server-hostname" - I just checked to be sure. Honestly I am new to kopia and a bit lost in the user management still. Also I am only using the web UI to manage kopia, did not play with the command line yet, that may be the reason I did not find the issues you found.
The service is running as "SYSTEM" user, I did not try running it under it's own user. What I was originally trying to do is to get VSS working using Kopia actions, but that was not successful yet. But for that reason I am OK with running it as SYSTEM, that way it has access to VSS and the whole filesystem. And in a home setup I am not worried about giving minimum privileges to the service.
I fixed the "htpassword" mistake in the text, thank you for pointing it out.