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)
Hi @matushorvath,
First of all, thanks for putting this quick tutorial together as it's been just thing I was interested in setting up. I was able to follow the instructions to a T and got the server up and running as a windows service...I had a question though, did try adding a user to the server and if so, were you successful?
I tried running the following command but got the below error:
Command:
kopia server user add localuser@server-hostname
Error
P.S - I had to change the "user" name in htpasswd from "kopia" to "kopia@server-hostname" since it wouldn't let me "connect" to the server otherwise, not sure if you ran into the same issue.
Also, you have a minor typo where you instruct creating "htpassword" file in
C:\ProgramData\kopia\htpassword
but then refer to the file ashtpasswd
in the subsequent command