How to host and share large files online with PicoShare in Linux
This article will show you how to install Picoshare and share files online using Docker in Ubuntu Linux.
Install the prerequisites for PicoShare
Assumptions : This tutorial is performed on an Ubuntu 24.04 machine with at least 2GB of RAM and 50GB of disk space. You will need to have a domain name to be able to create an 'A' record for that domain. Finally, this article will use DigitalOcean Spaces for the S3-compatible object storage backend.
Note : Although the instructions here are for Ubuntu, they also apply to most Linux distributions.
The first step in installing PicoShare is to prepare both Docker and Nginx for the host system (for other Linux distributions, here's how to install Docker on a Linux system). To get started, get the signing key for your Docker project's repository:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg sudo chmod a+r /etc/apt/keyrings/docker.gpg
Create a new apt repository file using your favorite text editor:
sudo nano /etc/apt/sources.list.d/docker.list
Paste the following line of code into the new repository file:
deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu noble stable
Save the repository file, then update both the system's repository list and its current packages:
sudo apt update && sudo apt upgrade
Install Docker, Docker Compose and Nginx using apt in Ubuntu:
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-buildx-plugin nginx
Create cloud storage backups for PicoShare
Go to an S3-compatible cloud storage provider, then create a new storage bucket. This case is using DigitalOcean Spaces so click Create -> Spaces Object Storage on the dashboard screen.
Select the Datacenter location for S3-compatible storage, then check the Enable CDN checkbox .
Name the new Spaces Bucket, then click Create a Spaces Bucket to initialize the group.
Click Copy Icon on the Origin Endpoint text box and paste it into a separate text file.
Scroll through the left sidebar of the DigitalOcean dashboard, then click the API category .
Click the Spaces Keys tab , then select Generate New Key .
Provide a name for the new key, then click Create Access Key .
Copy both 'Access Key' and 'Secret Key' from the page and paste into the text file.
Install and run PicoShare
Create a new folder for PicoShare inside the user's home directory, then go inside that folder:
mkdir ~/picoshare && cd ~/picoshare
Use your favorite text editor to create a Compose file for PicoShare:
nano ./docker-compose.yml
Paste the following block of code into the new .yml file:
version: "3.2" services: picoshare: image: mtlynch/picoshare environment: - PORT=4001 - PS_SHARED_SECRET=RANDOM PASSWORD HERE - LITESTREAM_BUCKET="YOUR BUCKET NAME" - LITESTREAM_ENDPOINT="YOUR ORIGIN ENDPOINT HERE" - LITESTREAM_ACCESS_KEY_ID="YOUR BUCKET ACCESS ID HERE" - LITESTREAM_SECRET_ACCESS_KEY="YOUR BUCKET SECRET HERE" ports: - 4001:4001 command: -db /data/store.db volumes: - ./data:/data
Replace the value of the variable 'PS_SHARED_SECRET' with a random and sufficiently long password. This will be used as the password for PicoShare's web interface.
Note : You can generate your own random password by running: cat /dev/urandom | tr -dc 'A-Za-z0-9' | fold -w 32 | head -n 1 on a separate terminal session.
Change the value of the variable 'LITESTREAM_BUCKET' with the name of the Spaces Bucket.
Copy the region and domain part of the endpoint, then paste that as the value of the 'LITESTREAM_ENDPOINT' variable.
Replace the values of both 'LITESTREAM_ACCESS_KEY_ID' and 'LITESTREAM_SECRET_ACCESS_KEY_ID' variables with the Access Key and Secret Key of the DigitalOcean Spaces bucket.
Save the docker-compose.yml file, then run the following command to build and run the PicoShare instance:
sudo docker compose up -d
A side note : You can also use Docker and Docker Compose to quickly host a Minecraft server on Linux.
Secure PicoShare with SSL Reverse Proxy
At this point, you should have PicoShare running at port 4001 on your local machine. To access it securely on the Internet, you need to ensure that all connections to it are encrypted via SSL.
Start by creating a new 'A' record for the domain pointing to the IPv4 address of the PicoShare server. This case will create an 'A' record with the value 'picoshare'.
Install 'core' snap package on Ubuntu system:
sudo snap install core
Get the certbot snap package from the Electronic Frontier Foundation (EFF):
sudo snap install certbot --classic
Create a new Nginx site configuration file using your favorite text editor:
sudo nano /etc/nginx/sites-available/picoshare
Paste the following code block into the website configuration file:
server { server_name SUBDOMAIN.YOUR-ROOT.DOMAIN; location / { proxy_pass http://127.0.0.1:4001; proxy_http_version 1.1; proxy_redirect off; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; client_max_body_size 0m; } }
Save the site configuration file, then create a symbol link from the '/etc/nginx/sites-available/' directory to the '/etc/nginx/sites-enabled/' directory :
sudo ln -s /etc/nginx/sites-available/picoshare /etc/nginx/sites-enabled/
Carefully check the Nginx configuration file to see if there are any errors, then start the Nginx webserver daemon using systemctl:
nginx -t sudo systemctl enable --now nginx.service
Register the PicoShare server using EFF's certbot utility:
sudo certbot register --agree-tos -m YOUR-EMAIL@ADDRESS.HERE
Create a new SSL certificate pointing to the server domain:
sudo certbot --nginx -d SUBDOMAIN.YOUR-ROOT.DOMAIN
You should read it
- 7 best Linux distributions based on Red Hat
- Basic Linux commands everyone needs to know
- What's new in Linux Kernel 5.18?
- 6 reasons why the Linux operating system often fails
- 8 best Linux distros for pentest
- Why are Linux computers still important?
- 10 reasons to switch to Linux right in 2012
- What is Puppy Linux? Everything you need to know about Puppy Linux
May be interested
- Do I need to be a computer expert to use Linux?while linux is the platform of choice for professionals and tinkerers, you don't have to be a computer geek, hacker, or even an expert to use the source computing platform. open this top.
- 4 classic Linux tools that have better modern alternativesthere are a number of command-line utilities that unix and linux users have relied on for over 50 years. but each of these classic commands has a modern alternative, if you want to upgrade.
- How to take screenshots on Linuxtaking screenshots on linux is not as simple as on windows or macos. the reason is because on linux there are no additional screen capture utilities installed. this tipsmake article will introduce you to 4 ways to take screenshots on linux as you like.
- How to install and use Google Chrome on Ubuntugoogle chrome is a cross-platform browser and using google chrome on ubuntu is not unusual. the following instructions will help you install google chrome and use it on the ubuntu platform.
- Instructions for speeding up Fedora Linux application installersfedora is a quite powerful linux distribution, however the biggest limitation of this distribution is its slow application installer. so in the article below tipsmake will guide you how to speed up the fedora linux application installer, readers can refer to and follow.
- How to fix 'No Space Left on Device' error on Linuxsuppose your device's hard drive has a lot of free space left, but linux notifies you that your hard drive doesn't have enough free space anymore. on the screen you will receive the error message no space left on device. so why does this error occur? the article below tipsmake will guide you how to fix no space left on device error on linux.