Get your very own private cloud server in just a few minutes!

Learn how to install and set up the open source project Mainsail on a Raspberry Pi for your very own private cloud server. …


Updated August 9, 2023

Need help with your Raspberry Pi?
Contact Me!

Do you love silly Raspberry Pi Projects?
Check out my this YouTube Channel!


Learn how to install and set up the open source project Mainsail on a Raspberry Pi for your very own private cloud server.

Introduction

Mainsail is an open-source project that provides a simple way to create your very own private cloud server using a Raspberry Pi and Docker. With Mainsail, you can host your own personal cloud storage, run your own services, and access them from anywhere. In this guide, we’ll walk through the steps required to install Mainsail on your Raspberry Pi.

Requirements

Before starting, make sure you have the following:

  • A Raspberry Pi (any model will do) with a fresh installation of Raspbian
  • An internet connection for the Pi
  • An external hard drive or USB stick formatted as ext4 (minimum size 8GB recommended)
  • A monitor, keyboard, and mouse (or SSH access if you prefer to work remotely)
  • Basic knowledge of Docker and Linux command line

Step 1: Install Docker on the Raspberry Pi

Docker is a containerization platform that makes it easy to deploy and manage applications. Mainsail uses Docker to simplify deployment and management of the application stack. Follow these steps to install Docker on your Raspberry Pi:

  1. Update the package list and install dependencies:
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install -y curl python3-pip libffi-dev libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev libwebp-dev libopenjp2-7-dev liblcms2-dev libopenexr-dev
  1. Install Docker:
curl -sSL https://get.docker.com | sh
  1. Add your user to the docker group to avoid using sudo for every command:
sudo usermod -aG docker pi
  1. Reboot your Pi for changes to take effect:
sudo reboot
  1. Verify Docker installation by running:
docker --version

If the command returns the version of Docker you just installed, you’re all set!

Step 2: Prepare the external storage

Mainsail requires an external storage device to persist data across restarts and upgrades. Follow these steps to prepare your external hard drive or USB stick:

  1. Connect the external storage device to your Raspberry Pi via USB.
  2. Find the name of the device by running:
sudo fdisk -l

Look for a device like /dev/sda1 (it might be different depending on your setup). 3. Create an ext4 file system on the external storage device:

sudo mkfs.ext4 /dev/sda1
  1. Mount the device to /mnt/data:
sudo mkdir -p /mnt/data
sudo mount /dev/sda1 /mnt/data
  1. Add the following line to /etc/fstab to automatically mount the device on boot:
/dev/sda1 /mnt/data ext4 defaults 0 2
  1. Set permissions for the pi user:
sudo chown pi:pi /mnt/data
  1. Reboot your Pi to ensure everything is working correctly:
sudo reboot

Step 3: Install Mainsail

Now that Docker and external storage are set up, we can install Mainsail:

  1. Clone the Mainsail repository:
git clone https://github.com/mainsail-project/mainsail.git && cd mainsail
  1. Copy docker-compose.yml to /mnt/data:
cp docker-compose.yml /mnt/data
  1. Change directory to /mnt/data and run the following command to start Mainsail:
cd /mnt/data && docker-compose up -d

This will download the required Docker images and start all the necessary services for Mainsail. It may take a few minutes to complete. 4. Once the installation is finished, open your web browser and navigate to http://<your_pi_ip>:8080. You should see the Mainsail login page. The default username is admin and password is password. 5. Change the admin password for security reasons by clicking on the “Settings” menu in the top right corner, then selecting “Users”.

Conclusion

Congratulations! You have now successfully installed Mainsail on your Raspberry Pi. You can use it to store your files and run various services securely from anywhere. To learn more about Mainsail and its features, visit the official website.