Operations 6 min read

How to Install and Run HFS as a Daemon on Ubuntu 22.04

This guide walks you through installing the lightweight HFS HTTP file server on Ubuntu 22.04, configuring it for both interactive and systemd daemon modes, and exposing a shared directory over the network with step‑by‑step commands and screenshots.

Liangxu Linux
Liangxu Linux
Liangxu Linux
How to Install and Run HFS as a Daemon on Ubuntu 22.04

Running HFS in interactive (non‑daemon) mode

Step 1: Create a directory that will serve as the HTTP root for shared files. mkdir -vp /home/budgie/mirrorsHTTP Step 2: Extract the hfs-linux.zip archive to a custom location, for example /usr/bin/hfsFolder. The folder must contain the hfs binary.

Step 3: Create a symbolic link so the hfs executable is reachable from /usr/bin. ln -s /usr/bin/hfsFolder/hfs /usr/bin/ Step 4: Start HFS in the current terminal and keep the session open. After the banner appears, type help to see available commands, then set the listening port (default web UI runs on 8090). config port 8011 Step 5: Open a web browser on the same machine and navigate to the admin interface:

http://localhost:8090/~/admin/

In the admin page, add the shared folder path /home/budgie/mirrorsHTTP. This registers the directory for HTTP access.

Step 6: The active configuration is stored in $HOME/.hfs/config.yaml. Review it to verify the shared path and port.

Step 7: From any other machine on the same LAN, open a browser and point to the server’s address (replace the IP with the actual host IP):

http://192.168.136.136:8090/

Running HFS as a systemd daemon

The preparation steps (1‑4) are identical to the interactive mode.

Step 5: Access the same admin page (http://localhost:8090/~/admin/) and add the shared directory /home/budgie/mirrorsHTTP.

Step 6: Verify the configuration file at $HOME/.hfs/config.yaml to ensure the path and port are correct.

Step 7: Install a recent Node.js runtime (required by the HFS npm package). Extract the binary archive into the same hfsFolder directory.

tar -xf /home/budgie/Downloads/node-v20.9.0-linux-x64.tar.xz -C /usr/bin/hfsFolder/

Step 8: Create symbolic links for node and npm so they are available system‑wide.

ln -s /usr/bin/hfsFolder/node-v20.9.0-linux-x64/bin/node /usr/bin/
ln -s /usr/bin/hfsFolder/node-v20.9.0-linux-x64/bin/npm /usr/bin/

Step 9: Verify the installations: node --version If the commands are not found in the PATH, add the directory to /etc/profile or another global profile file.

Step 10: Test that the HFS npm package can be executed without errors using npx:

/usr/bin/hfsFolder/node-v20.9.0-linux-x64/bin/npx -y hfs@latest

Step 11: Create a systemd service unit file /etc/systemd/system/hfs.service with the following content (replace paths if necessary):

[Unit]
Description=HFS lightweight HTTP file server
After=network.target

[Service]
Type=simple
ExecStart=/usr/bin/hfsFolder/hfs -p 8011
Restart=on-failure

[Install]
WantedBy=multi-user.target

Step 12: Reload systemd, enable the service to start at boot, and start it immediately.

systemctl daemon-reload && systemctl enable hfs && systemctl start hfs && systemctl status hfs

Step 13: Verify the daemon is serving the shared folder by opening a browser on any LAN client and navigating to:

http://192.168.136.136:8090/

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

HTTPdaemonUbuntufile sharingHFS
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.