creating a family-friendly Nextcloud setup on Raspberry Pi

Setting Up Nextcloud on Raspberry Pi for Family Use Prerequisites Before diving into the setup process, ensure you have the following items: Raspberry Pi (preferably Raspberry Pi 4 for better performance) MicroSD Card (16GB or

Written by: David Choi

Published on: January 7, 2026

Setting Up Nextcloud on Raspberry Pi for Family Use

Prerequisites

Before diving into the setup process, ensure you have the following items:

  • Raspberry Pi (preferably Raspberry Pi 4 for better performance)
  • MicroSD Card (16GB or larger recommended, class 10 for speed)
  • Power Supply (official Raspberry Pi power supply recommended)
  • Internet Connection
  • External USB Storage (optional for additional storage)
  • HDMI Cable and Monitor (for initial setup; can be done headless later)
  • Keyboard and Mouse (for initial setup)

Install Raspberry Pi OS

  1. Download Raspberry Pi Imager: Go to the official Raspberry Pi website and download the Raspberry Pi Imager suitable for your operating system.
  2. Install Raspberry Pi OS: Select the Raspberry Pi OS Lite version for a lightweight server. Install it on your MicroSD card.
  3. Boot up Raspberry Pi: Insert the MicroSD card into your Raspberry Pi and connect it to power. Connect the HDMI cable to your monitor and add the keyboard and mouse.
  4. Initial Configuration: On first boot, follow on-screen instructions to set up your language, time zone, and Wi-Fi. Enable SSH for remote access.

Update and Upgrade Your System

Before installing any software, make sure your system is up to date. Use the following commands in the terminal:

sudo apt update
sudo apt upgrade

Install Required Dependencies

Nextcloud requires some software packages to function properly. Install the necessary packages by running:

sudo apt install apache2 libapache2-mod-php7.4 bzip2 php7.4 php7.4-mysql php7.4-gd php7.4-xml php7.4-zip php7.4-mbstring php7.4-curl php7.4-intl php7.4-bcmath sqlite3 -y

Adjust the PHP version depending on the latest available; ensure compatibility with Nextcloud.

Download Nextcloud

  1. Navigate to the web directory:

    cd /var/www/html
  2. Download Nextcloud:

    wget https://download.nextcloud.com/server/releases/nextcloud-XX.0.X.zip

    Replace XX.0.X with the latest version number.

  3. Unzip Nextcloud and Set Permissions:

    unzip nextcloud-XX.0.X.zip
    sudo chown -R www-data:www-data nextcloud
    sudo chmod -R 755 nextcloud

Configure Apache

  1. Create a new Apache configuration file for Nextcloud:

    sudo nano /etc/apache2/sites-available/nextcloud.conf
  2. Add the following configuration to the file:

    <VirtualHost *:80>
        DocumentRoot /var/www/html/nextcloud
        ServerName your_domain_or_ip
    
        <Directory /var/www/html/nextcloud/>
            Options +FollowSymlinks
            AllowOverride All
            Require all granted
            <IfModule mod_dav.c>
                Dav off
            </IfModule>
        </Directory>
    
        ErrorLog ${APACHE_LOG_DIR}/nextcloud_error.log
        CustomLog ${APACHE_LOG_DIR}/nextcloud_access.log combined
    </VirtualHost>
  3. Enable the new configuration and required modules:

    sudo a2ensite nextcloud
    sudo a2enmod rewrite
    sudo service apache2 restart

Configure the Database

You can use either MySQL or SQLite. MySQL is recommended for larger installations.

  1. Install MySQL:

    sudo apt install mysql-server -y
  2. Secure the installation (follow the prompts):

    sudo mysql_secure_installation
  3. Create a Nextcloud database and user:

    sudo mysql -u root -p

    In the MySQL prompt, execute:

    CREATE DATABASE nextcloud;
    CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'yourpassword';
    GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';
    FLUSH PRIVILEGES;
    EXIT;

Configure Nextcloud

  1. Access Nextcloud setup: Open your web browser and go to http://your_domain_or_ip/nextcloud.
  2. Create an admin account: Follow the installation wizard to create an admin user, then enter the database details you’ve set up.
  3. Set the data folder: If you have external storage, set up the data directory accordingly. Ensure the www-data user has the correct permissions to read and write.

Enable HTTPS

To secure your Nextcloud installation, it’s crucial to enable HTTPS.

  1. Install Certbot:

    sudo apt install certbot python3-certbot-apache -y
  2. Obtain an SSL Certificate:

    sudo certbot --apache

    Follow prompts to set your email and agree to terms.

Enhance Security

  1. Configure Fail2Ban: To prevent brute-force attacks, install Fail2Ban.

    sudo apt install fail2ban -y

    Create a new configuration file for Nextcloud:

    sudo nano /etc/fail2ban/jail.local

    Add:

    [nextcloud]
    enabled = true
    port    = http,https
    filter  = nextcloud
    logpath = /var/www/html/nextcloud/data/nextcloud.log
    maxretry = 5
    bantime = 3600
  2. Configure Firewall: Use UFW to protect your server.

    sudo ufw allow OpenSSH
    sudo ufw allow 'Apache Full'
    sudo ufw enable

Connect Family Devices

  1. Set Up Nextcloud Clients: Download the Nextcloud desktop and mobile apps for easy access. Install them on family devices for automatic file synchronization.
  2. User Management: Utilize the Nextcloud web interface to create individual user accounts for family members. Configure permissions and access for shared folders and files.

Optional: Additional Features

  1. Nextcloud Apps: Explore additional functionalities by installing Nextcloud apps from the app store within the Nextcloud interface. Options include calendar, contacts, and collaborative tools.
  2. Backup Solutions: Establish a backup routine. Use rsync or third-party tools for regular backups of your Nextcloud directory and database.

Maintenance Tips

  1. Keep Nextcloud Updated: Regularly update both the Nextcloud application and the Raspberry Pi OS for security and performance improvements.
  2. Monitor Storage Usage: Keep an eye on the storage used. Upgrade your external USB storage if necessary to accommodate growing family files.

By following these steps, you can effectively create a family-friendly Nextcloud setup on your Raspberry Pi, enabling a secure, private cloud experience for document sharing, family photos, and more.

Leave a Comment

Previous

why open source video editors are ideal for YouTube beginners

Next

optimizing Raspberry Pi for Nextcloud performance.