using Raspberry Pi as a cloud server: Nextcloud installation instructions

Why Choose Raspberry Pi as a Cloud Server? Raspberry Pi is an affordable, compact, and efficient option for creating your own cloud server using platforms like Nextcloud. Nextcloud allows you to access, share, and back

Written by: David Choi

Published on: January 7, 2026

Why Choose Raspberry Pi as a Cloud Server?

Raspberry Pi is an affordable, compact, and efficient option for creating your own cloud server using platforms like Nextcloud. Nextcloud allows you to access, share, and back up data securely over the internet while retaining full control over your files. With a Raspberry Pi setup, you not only reduce costs but also learn about server management and cloud functionalities.

What You Need

  • Raspberry Pi (Model 3B+ or higher recommended for better performance)
  • microSD Card (at least 16GB, Class 10 recommended)
  • Power Supply (5V, 2.5A for Raspberry Pi 3)
  • External USB Hard Drive (for additional storage)
  • Ethernet Cable (for stable internet connection)
  • Raspberry Pi OS (Raspberry Pi OS Lite or any Debian-based distro)
  • Access to a Terminal (SSH or direct access)
  • Internet Connection

Preparing Your Raspberry Pi

  1. Download Raspberry Pi Imager
    Start by downloading the Raspberry Pi Imager from the official site and install it on your computer.

  2. Flash the Raspberry Pi OS
    Insert the microSD card into your computer. Open the Raspberry Pi Imager, select ‘Raspberry Pi OS Lite,’ choose your microSD card, and flash the image.

  3. Initial Boot
    After flashing, insert the microSD card into your Raspberry Pi, and connect the power supply. Boot the Raspberry Pi.

  4. Remote Access Configuration
    Enable SSH for headless setup. Before taking out the microSD card, create an empty file named ssh in the boot partition. This file will enable SSH during the next boot.

  5. Find Your Raspberry Pi’s IP Address
    You can use an IP scanning tool or check your router’s connected devices list to find your Raspberry Pi IP address.

Basic Setup via Terminal

  1. Log in via SSH
    Open a terminal on your computer and connect to your Raspberry Pi using:

    ssh pi@<Your_Pi_IP_Address>

    The default password is raspberry.

  2. Update Your System
    Once logged in, update your packages:

    sudo apt update && sudo apt upgrade -y
  3. Install Essential Packages
    Before installing Nextcloud, several packages need to be installed:

    sudo apt install apache2 mariadb-server libapache2-mod-php7.3
    sudo apt install php7.3 php7.3-mbstring php7.3-xml php7.3-curl php7.3-zip php7.3-gd php7.3-intl
    sudo apt install php7.3-mysql

Setting Up MariaDB

  1. Login to MariaDB
    Enter the MariaDB console:

    sudo mysql -u root -p

    You will be prompted for the root password; hit enter as there is none by default.

  2. Secure MariaDB Installation
    Run the security script for MariaDB:

    mysql_secure_installation

    Follow the prompts to set a root password and secure the installation.

  3. Create Nextcloud Database and User
    Inside the MariaDB shell, execute the following:

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

Nextcloud Installation

  1. Download Nextcloud
    Navigate to the /var/www/html directory and download the latest version of Nextcloud:

    cd /var/www/html
    wget https://download.nextcloud.com/server/releases/nextcloud-x.x.x.zip

    Replace x.x.x with the latest version number.

  2. Unzip the Package
    Install unzip if not previously installed, then unzip the Nextcloud files:

    sudo apt install unzip
    unzip nextcloud-x.x.x.zip

    Move the unzipped folder and set permissions:

    sudo chown -R www-data:www-data nextcloud
    sudo chmod -R 755 nextcloud
  3. Configure Apache
    Create a new configuration file for Nextcloud:

    sudo nano /etc/apache2/sites-available/nextcloud.conf

    Add the following configuration:

    <VirtualHost *:80>
        DocumentRoot /var/www/html/nextcloud
        ServerName your_domain.com
    
        <Directory /var/www/html/nextcloud>
            Options +FollowSymlinks
            AllowOverride All
            Require all granted
        </Directory>
    
        ErrorLog ${APACHE_LOG_DIR}/nextcloud_error.log
        CustomLog ${APACHE_LOG_DIR}/nextcloud_access.log combined
    </VirtualHost>

    Save and exit the editor by pressing CTRL + X, Y, and ENTER.

  4. Enable the Configuration
    Run the following commands to enable the necessary modules and the new site configuration:

    sudo a2enmod rewrite
    sudo a2ensite nextcloud
    sudo systemctl restart apache2

Completing Nextcloud Setup

  1. Open Your Browser
    Navigate to http://your_domain.com (or your Pi’s IP address).

  2. Nextcloud Setup Wizard
    Fill in your desired admin username, password, and database details:

    • Database user: nc_user
    • Database name: nextcloud
    • Database password: your_password
    • Database host: localhost
  3. Finalize Installation
    Once all fields are correctly filled in, click on “Finish Setup.” Nextcloud is now installed and running.

Data Access with Nextcloud

  • Web Interface: Simply access via your web browser for full cloud functionality.
  • Desktop Client: Nextcloud offers clients for Windows, macOS, and Linux, allowing you to sync files directly from your desktop.
  • Mobile Application: There are Nextcloud apps available for both iOS and Android.

Advanced Configuration

  • SSL Certificate: To secure your cloud, consider using Certbot to obtain an SSL certificate. This enables HTTPS, protecting your data during transmission.

Install Certbot

sudo apt install certbot python3-certbot-apache

Obtain a Certificate

sudo certbot --apache

Automate Renewal

sudo certbot renew --dry-run

Monitoring and Backup

  • Data Backup: Regularly back up both the Nextcloud directory and the MariaDB database to avoid data loss. You can use tools like rsync for directory backups and mysqldump for databases.
mysqldump -u nc_user -p nextcloud > nextcloud_backup.sql
  • Server Monitoring: Keep an eye on your Raspberry Pi’s performance using tools like htop or Glances.

By following these instructions, you’ll successfully set up a Raspberry Pi as a cloud server with Nextcloud, providing you with a powerful and secure platform for file management and storage.

Leave a Comment

Previous

powerful free and open source alternatives to ms powerpoint presentations

Next

open source video editing software that simplifies content creation