This tutorial will guide you through the process of installing Filebrowser, a web-based file manager, on NetBSD.
Filebrowser is written in Go, so we need to install it before we can proceed with the installation.
To install Go on NetBSD, run the following command:
sudo pkgin update
sudo pkgin install go
Download the latest release of Filebrowser from the official website:
curl -fsSL https://api.github.com/repos/filebrowser/filebrowser/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep 'netbsd' | xargs curl -OL
Extract the downloaded archive using the following command:
sudo tar -C /usr/local/bin/ -xvf filebrowser-netbsd-amd64.tar.gz
(Note: this assumes you're running on an AMD64 architecture. If you're running on a different architecture, replace "amd64" with your architecture.)
Make the binary executable using the following command:
sudo chmod +x /usr/local/bin/filebrowser
Create a system user that Filebrowser can use:
sudo useradd -r -s /sbin/nologin filebrowser
Create a directory for storing Filebrowser's configuration files:
sudo mkdir /usr/local/etc/filebrowser
Copy the default configuration file to the newly created directory:
sudo cp /usr/local/bin/filebrowser/conf/filebrowser.json /usr/local/etc/filebrowser
Edit the configuration file using your preferred text editor:
sudo nano /usr/local/etc/filebrowser/filebrowser.json
Change the following options to appropriate values:
{
"port": 80,
"root": "/path/to/files",
"baseURL": "",
"database": "/usr/local/etc/filebrowser/filebrowser.db",
"log": "stdout",
"authentication": {
"method": "proxy",
"header": "X-Forwarded-User",
"whitelist": [],
"hash": ""
}
}
(Note: you'll want to replace /path/to/files
with the path to the directory you want Filebrowser to manage.)
Save and close the file.
Create a systemd service file for Filebrowser:
sudo nano /etc/systemd/system/filebrowser.service
Copy the following into the file:
[Unit]
Description=Filebrowser Service
After=network.target
[Service]
User=filebrowser
Group=filebrowser
WorkingDirectory=/usr/local/etc/filebrowser
ExecStart=/usr/local/bin/filebrowser -c /usr/local/etc/filebrowser/filebrowser.json
[Install]
WantedBy=multi-user.target
Save and close the file.
Enable the service on boot:
sudo systemctl enable filebrowser
Start the service:
sudo systemctl start filebrowser
Open your web browser and navigate to your server's IP address. You should see Filebrowser running and displaying the contents of the directory you specified in the configuration file.
Congratulations! You have successfully installed and configured Filebrowser on NetBSD.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!