Skip to content

Service installation

Massimo Melina edited this page Aug 22, 2024 · 2 revisions

HFS binary on Linux using a non‐privileged user

The process is quite straight-forward and it works on Ubuntu 24.04 LTS:

  1. Create a new non-privileged user for hfs and create a directory to use as hfs' cwd:
sudo adduser --system hfs
sudo mkdir /var/lib/hfs
  1. Move HFS deliverable files in system directories:
sudo mv hfs /usr/local/bin/
sudo mv plugins/ /var/lib/hfs/plugins
  1. Change the owner of /var/lib/hfs:
sudo chown hfs:nogroup /var/lib/hfs 
  1. Set capability to hfs executable to open low-numbered ports:
sudo setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/hfs
  1. Create systemd service unit as follows:
[Unit]
Description=HFS
After=network.target

[Service]
Type=simple
User=hfs
Restart=always
ExecStart=/usr/local/bin/hfs --cwd /var/lib/hfs

[Install]
WantedBy=multi-user.target
  1. run sudo systemctl daemon-reload && sudo systemctl enable hfs && sudo systemctl start hfs && sudo systemctl status hfs

On Linux with Node.js

  1. install node.js
  2. create a file /etc/systemd/system/hfs.service with this content
[Unit]
Description=HFS
After=network.target

[Service]
Type=simple
Restart=always
ExecStart=/usr/bin/npx -y hfs@latest

[Install]
WantedBy=multi-user.target
  1. run sudo systemctl daemon-reload && sudo systemctl enable hfs && sudo systemctl start hfs && sudo systemctl status hfs

NB: update will be attempted at each restart

On Windows with node.js

  1. install node.js
  2. run npm -g i hfs
  3. run npx qckwinsvc2 install name="HFS" description="HFS" path="%APPDATA%\npm\node_modules\hfs\src\index.js" args="--cwd %HOMEPATH%\.hfs" now

To update

  • run npx qckwinsvc2 uninstall name="HFS"
  • run npm -g update hfs
  • run npx qckwinsvc2 install name="HFS" description="HFS" path="%APPDATA%\npm\node_modules\hfs\src\index.js" args="--cwd %HOMEPATH%\.hfs" now
Clone this wiki locally