I wrote a bash script which performs an automated installation of FileBrowser, which makes it possible to easily access files on a machine through a webbrowser. My script simplifies the process of installing filebrowser. But how to use it?
This works on Debian and Debian derivatives.
Step 1: Create a config file named "filebrowser.json". Here you will specify the IP-address, port and file directory.
{
"port": 8080,
"baseURL": "",
"address": "000.000.000.000",
"log": "stdout",
"database": "/etc/filebrowser.db",
"root": "/var/www"
}
Step 2: Now create a system service file named "filebrowser.service". This file is responsible for systemd starting the Filebrowser instance when the server it is running on is being turned on, or rebooted. The system service file looks like this:
[Unit]
Description=File Browser
After=network.target
[Service]
ExecStart=/usr/local/bin/filebrowser -c /etc/filebrowser.json
[Install]
WantedBy=multi-user.target
Step 3: Now create a shell script (example.sh) in the same directory as the other two files and paste the following contents:
#!/bin/bash
echo "This script will perform an automatic installation of FileBrowser!"
sleep 1
echo "Updating repositories..."
sleep 0.5
apt update && apt full-upgrade -y && apt install curl -y
sleep 1
echo "Updates done."
sleep 0.5
echo "Downloading and installing FileBrowser..."
sleep 0.5
curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash
sleep 0.5
echo "Copying config file to /etc/filebrowser.json ..."
sleep 0.5
cp filebrowser.json /etc/filebrowser.json
echo "Copying system service file to /etc/systemd/system/filebrowser.service ..."
sleep 0.5
cp filebrowser.service /etc/systemd/system/filebrowser.service
echo "Enabling and starting the filebrowser system service..."
sleep 0.5
systemctl enable filebrowser.service
systemctl start filebrowser.service
sleep 0.5
echo "DONE! Congratulations, you now have a running FileBrowser instance!"
sleep 0.5
echo "After updating any settings in /etc/filebrowser.json make sure to run "systemctl restart filebrowser.service""
echo "Default Login:"
echo "User: admin"
echo "Pass: admin"
echo "Please make sure to change the password on your first login!"
Step 4: Make sure you are logged in as root. Now execute the script with:
# bash example.sh
You can now access FileBrowser in your webbrowser with the IP-address and port. As stated in the script, these are the default login credentials:
User: admin
Pass: admin
Please make sure to change the password on your first login!