Run HFS HTTP File Server as a Daemon on Ubuntu 22.04 – Step‑by‑Step Guide
This guide walks through installing the lightweight HFS HTTP file server on Ubuntu 22.04, creating a shared directory, configuring the binary, setting up port and admin access, and optionally configuring it as a systemd daemon with Node.js support for full background operation.
Running HFS without daemon (Ubuntu 22.04)
Step 1: Create the HTTP root directory. mkdir -vp /home/budgie/mirrorsHTTP Step 2: Extract the hfs-linux.zip package to a custom directory, e.g., /usr/bin/hfsFolder.
Step 3: Create a symbolic link for the HFS binary in /usr/bin. ln -s /usr/bin/hfsFolder/hfs /usr/bin/ Step 4: Run hfs interactively, keep the session open, type help, then configure the listening port. config port 8011 Step 5: Open a browser to http://localhost:8090/~/admin/ and add the shared folder path /home/budgie/mirrorsHTTP.
Step 6: View the current configuration file at $HOME/.hfs/config.yaml.
Step 7: Access the shared folder from another machine via http://192.168.136.136:8090/.
Running HFS as a daemon (Ubuntu 22.04)
The initial steps (1‑5) are identical to the non‑daemon method: create the root directory, extract the package, link the binary, start hfs to set the port, and add the shared folder.
Additional steps for daemonization:
Step 8: Extract the Node.js binary package to /usr/bin/hfsFolder/ (required for the latest HFS version).
tar -xf /home/budgie/Downloads/node-v20.9.0-linux-x64.tar.xz -C /usr/bin/hfsFolder/Step 9: Create symbolic links for node and npm in /usr/bin.
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 10: Verify the installations. node --version Step 11: Use npx to run the latest HFS and check for errors. npx -y hfs@latest Step 12: Create a systemd service file /etc/systemd/system/hfs.service (content omitted for brevity) to run HFS as a background service.
Step 13: Reload systemd, enable and start the service, then check its status.
systemctl daemon-reload && systemctl enable hfs && systemctl start hfs && systemctl status hfsStep 14: Open a browser to http://192.168.136.136:8090/ to verify the shared folder is accessible.
This procedure provides a complete, repeatable method for deploying HFS as either an interactive tool or a persistent systemd service on Ubuntu 22.04.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
