How to Install Web Filebrowser on Ubuntu Server

Filebrowser is a web-based file manager that offers an intuitive interface for managing files on your server. This guide will walk you through the installation process on an Ubuntu Server.

Prerequisites

Before we begin, ensure you have the following:

  • An Ubuntu Server with root access
  • A web browser

Step 1: Update Ubuntu

Start by updating your Ubuntu Server using the command:

sudo apt-get update && sudo apt-get upgrade

This updates all packages and dependencies.

Step 2: Install Go

Since Filebrowser is built on Golang, install Go with:

sudo apt-get install golang

Step 3: Download Filebrowser

Get the latest Filebrowser version with:

wget https://github.com/filebrowser/filebrowser/releases/download/v2.23.0/linux-amd64-filebrowser.tar.gz

Note: Adjust the filename to the current version.

Step 4: Extract Filebrowser

Extract the binary using:

tar -xvf linux-amd64-filebrowser.tar.gz

This will unpack the “filebrowser” binary and its web interface files.

Step 5: Create a User for Filebrowser

Enhance security by creating a dedicated user:

sudo useradd -r -s /bin/false filebrowser

Step 6: Move Filebrowser to /usr/local/bin

Move the Filebrowser binary with:

sudo mv filebrowser /usr/local/bin

Step 7: Set Permissions

Ensure protection from unauthorized access by changing ownership:

sudo chown -R filebrowser:filebrowser /usr/local/bin/filebrowser /usr/local/bin/public

Step 8: Create a Systemd Service

Create a systemd service file for Filebrowser:

sudo nano /etc/systemd/system/filebrowser.service

Add the following content:

[Unit]
Description=Filebrowser Service
After=network.target

[Service]
Restart=on-failure
User=filebrowser
Group=filebrowser
ExecStart=/usr/local/bin/filebrowser --port 8080 --root /var/www/filebrowser

[Install]
WantedBy=multi-user.target

Then save and exit.

Step 9: Enable the Service

Enable and start the service using:

sudo systemctl daemon-reload
sudo systemctl enable filebrowser.service
sudo systemctl start filebrowser.service

Filebrowser is now running on your server!
Step 10: Adding Nginx With SSL

  • install nginx and openssl apt install nginx openssl
  • create certificates
openssl genrsa -out cert.key 2048
openssl req -new -key cert.key -out cert.csr
openssl x509 -req -days 3650 -in cert.csr -signkey cert.key -out cert.crt
  • remove old nginx config
rm /etc/nginx/sites-avilable/default
  • create new config
nano /etc/nginx/sites-avilable/default

// config

server {
    listen 443 ssl;
    server_name _;

    ssl_certificate /root/cert.crt;
    ssl_certificate_key /root/cert.key;

    ssl_protocols TLSv1.2 TLSv1.3;


    location / {
        proxy_pass http://localhost:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Connection 'upgrade';
        proxy_http_version 1.1;
        proxy_cache_bypass $http_upgrade;
        client_max_body_size 15G;
    }
}

# Redirect HTTP to HTTPS
server {
    listen 80;
    server_name your_domain_or_ip;
    return 301 https://$host$request_uri;
}
  • restart nginx
sudo service nginx restart

Step 11: Access Filebrowser

Open your browser and visit “https:///”, replacing “” with your server’s IP address. Ensure port 443 is open if using a firewall.

Conclusion

Following this guide, you should now have Filebrowser operating smoothly on your Ubuntu Server, ready to manage your files with ease.

** :+1:optionally you can create filebroser config and use in service file**

  • create config file
nano /etc/filebrowser.json

add following

{
  "port": 8080,
  "baseURL": "",
  "address": "0.0.0.0",
  "log": "stdout",
  "database": "/etc/filebrowser.db",
  "root": "/root/files"
}
  • update service file
nano /etc/systemd/system/filebrowser.service

add following

[Unit]
Description=File Browser
After=network.target

[Service]
ExecStart=/usr/local/bin/filebrowser -c /etc/filebrowser.json

[Install]
WantedBy=multi-user.target
  • restart service
systemctl enable filebrowser.service
systemctl start filebrowser.service