Building Your Own Local Cloud Storage with Raspberry Pi and USB Drive/ Hard drive

In this tutorial, we’ll walk you through the process of setting up a local cloud storage solution using a Raspberry Pi and a USB drive. With this setup, you can have your own personal cloud storage accessible from anywhere within your home network.

Prerequisites

Before getting started, ensure you have the following:

  • Raspberry Pi with Raspberry Pi OS installed
  • A USB drive formatted and ready for use
  • Basic knowledge of using the command line interface (CLI)

Step 1: Setting up the Raspberry Pi

  1. Ensure your Raspberry Pi is up to date by running the following commands:
   sudo apt update
   sudo apt upgrade
  1. Connect your USB drive to the Raspberry Pi.

Step 2: Installing Nextcloud

Nextcloud is an open-source, self-hosted cloud storage solution that we’ll use for this project. We’ll use Docker to install Nextcloud on the Raspberry Pi.

  1. Install Docker on your Raspberry Pi by following the official instructions for your operating system version.
  2. Create a directory to store Nextcloud data:
   sudo mkdir -p /media/usb/nextcloud/data
  1. Create a Docker Compose file (e.g., docker-compose.yml) with the following content:
   version: '3'

   services:
     db:
       image: arm32v7/postgres:alpine
       restart: always
       environment:
         POSTGRES_PASSWORD: example_nextcloud_db_password
         POSTGRES_DB: nextcloud
         POSTGRES_USER: nextcloud
       volumes:
         - db_data:/var/lib/postgresql/data

     app:
       image: arm32v7/nextcloud
       ports:
         - "8080:80"
       depends_on:
         - db
       volumes:
         - /media/usb/nextcloud/data:/var/www/html/data
       restart: always
       environment:
         POSTGRES_HOST: db
         POSTGRES_DB: nextcloud
         POSTGRES_USER: nextcloud
         POSTGRES_PASSWORD: example_nextcloud_db_password

   volumes:
     db_data:
  1. Run docker-compose up -d to start the Nextcloud container.

Step 3: Accessing Nextcloud

  1. Once the container is running, you can access Nextcloud by navigating to http://<Raspberry_Pi_IP>:8080 in your web browser.
  2. Follow the on-screen instructions to complete the setup of Nextcloud, including creating an admin account and configuring storage options.

Conclusion

Congratulations! You’ve successfully set up a local cloud storage solution using Raspberry Pi and a USB drive. With Nextcloud running on your Raspberry Pi, you now have your own personal cloud storage accessible within your home network.

Feel free to explore additional features and customization options offered by Nextcloud to tailor your cloud storage experience to your needs. Enjoy your new local cloud storage solution!

Leave a Reply

Your email address will not be published. Required fields are marked *