Installing NextCloud on Your Raspberry Pi (2 ways)

1. Install NextCloud with Docker

The easiest way to install NextCloud on your Raspberry Pi is to use Docker. Docker is a container platform that allows you to quickly and easily deploy applications on your Raspberry Pi. To install NextCloud with Docker, you will need to install Docker on your Raspberry Pi first.

Once Docker is installed, you can use the following command to pull the NextCloud image from the Docker Hub:

docker pull nextcloud

Once the image is downloaded, you can run the following command to start the NextCloud container:

docker run -d -p 8080:80 nextcloud

This will start the NextCloud container and make it accessible on port 8080. You can then access the NextCloud web interface by visiting http://localhost:8080 in your web browser.

2. Install NextCloud with Raspbian

If you don’t want to use Docker, you can also install NextCloud on your Raspberry Pi using Raspbian. To do this, you will need to install the Apache web server and the PHP scripting language.

First, you will need to install Apache by running the following command:

sudo apt-get install apache2

Next, you will need to install PHP by running the following command:

sudo apt-get install php

Once Apache and PHP are installed, you can download the NextCloud installation package from the NextCloud website. Once the package is downloaded, you can extract it and move it to the Apache web root directory.

Finally, you can access the NextCloud web interface by visiting http://localhost in your web browser.

If you want to keep your data safe, and not hosted by someone else, NextCloud is a great app to try. In this post, I’ll show you what NextCloud is and how to install it on your Raspberry Pi.

There are two methods to install NextCloud on a Raspberry Pi. The first method is by installing NextCloudPi, a custom image with everything ready to use. The second method is by installing the NextCloud files on an existing Raspberry Pi OS.

After a short introduction to the NextCloud features, I’ll give you the step-by-step installation guide for both versions. This way you can follow the one that fits your needs best. Finally, I’ll give you a few tips to start with NextCloud.

If you’re looking to quickly progress on Raspberry Pi, you can check out my e-book here. It’s a 30-day challenge where you learn one new thing every day until you become a Raspberry Pi expert. The first third of the book teaches you the basics, but the following chapters include projects you can try on your own.

NextCloud introduction

What is NextCloud?

Nextcloud is a file hosting service that can be self-hosted on a Raspberry Pi. It can be used for file storage obviously, but also has many other features (collaboration, communication, etc.). You can even install plugins on it, so it’s almost unlimited.

You probably know Dropbox or Google Drive. Basically, NextCloud’s goal is to offer the same thing, but allows you to keep control of the data on your server. And it’s free!

You may also know OwnCloud, it’s the same thing (it’s even the same developer).
You can install NextCloud on many platforms, including Linux and therefore the Raspberry Pi.

NextCloud features

NextCloud offers many features as soon as you install it:

  • Main features:
    • Files hosting
    • Pictures manager
    • Contacts
    • Calendar
    • Notes
    • Tasks manager
    • News feed reader
  • Desktop and mobile clients for automatic synchronization.
  • Some integration is possible (calendar, mail, LDAP, etc.).
  • Users and rights management.
  • HTTPS and server-side encryption.

It’s already a good tool, but that’s not all. You can download and install extensions (or “Apps”) to add new features from the community.

For example, I use the “Passwords” extension to store my passwords safely on my network.

To check the apps available before installing NextCloud, you can check the NextCloud Apps store here.

NextCloud technology

On the official website, you can also find appliances for specific needs: Virtual Machine, Docker image or Snap package.

Like many of the open-source apps out there, NextCloud code is available on GitHub.
They use web languages like PHP and JavaScript, so it’s easy to install on any device.

For Raspberry Pi, we’ll use the source code and the NextCloudPi image, a custom Raspberry Pi OS image to simplify the NextCloud installation. Docker can also be another solution if you want to try (docker pull NextCloud), I didn’t test it.

Recommended hardware for a NextCloud Server

  • A Raspberry Pi 4: I tried with older models, but it’s often too slow to browse the web application and synchronize files (at least with my files). Maybe a Raspberry Pi 3B+ can be enough if you don’t have too many small files, but in my experience, it was just too slow.
  • A big SD card: I would recommend at least 120 GB. You don’t want to restart from scratch because you didn’t estimate the total size of the project in the beginning. Another option is to plug in a USB drive and use it for the main storage. It maybe even be cheaper (check the price here).
  • A good backup solution: I will talk about this later, but you need a safety plan. Storing everything on a Raspberry Pi without backup is not a good idea. I’m using the NAS linked above, but if you have a smaller budget, you can use another USB drive for this. Even an old SATA drive in an external case like this one would be fine.

Quick tip: to store your files, I recommend keeping them on a USB drive rather than an SD card. Personally, I like a giant USB key because it’s very convenient for the Raspberry Pi (look at this one on Amazon), but any cheap external hard drive will be better than an SD card (I’m using this one for my backups).

NextCloud installation

The easiest way: Install NextCloudPi

What is NextCloudPi?

NextCloudPi is a custom image of Raspberry Pi OS Lite, with NextCloud and all the dependencies preinstalled on it. So it’s easy to get started with NextCloudPi.

You can check the NextCloudPi website here for more information. It’s the perfect method if you want to try NextCloud or use a Raspberry Pi mainly for this.

You can always install other things after, as it’s a classic Raspberry Pi OS Lite distribution.

Download NextCloudPi

The first thing to do is to download the latest version of NextCloudPi for the installation:

  • Download the Raspberry Pi version of NextCloudPi from the GitHub server.
  • Click on the Raspberry Pi version and download the image file on your computer
  • Optional: Extract the image from the archive.
    It depends on your operating system, but probably something like right-click > Extract here.
    On Windows, you’ll need WinRAR or 7zip to extract it.
    If you use Etcher or Imager, you don’t need to do this, but some tools can’t flash Zip files directly.

Flash NextCloudPi on the SD card

Now that you’ve downloaded the image, we can flash it on a new SD card:

  • If needed, download and install Etcher.
    Etcher is a free tool to easily flash an SD card with any Linux image.
  • Start Etcher, a window like this one shows up:
    etcher menu
  • Click on the first button and browse to the image location.
  • Insert your SD card in your computer and select it in the second item (automatically done by Etcher generally).
  • Then click on “Flash!” to start the SD card creation.
  • After a few minutes, your SD card is ready to use.

I tend to use Etcher when I download the image manually (it’s slightly faster), but you can also do the same thing with Raspberry Pi Imager (pick “Use custom” in the OS list) or any other tool.

First boot with NextCloudPi

Insert the SD card into the Raspberry Pi and start it.
After a few seconds, you’ll get a wizard to guide you with the user creation:

  • Pick a keyboard layout corresponding to your hardware.
  • Select the user you want to rename (keep the default value: “pi”).
  • Enter the new username and password

You can now log in with the user you just created.

Then you have to configure the network:

  • Ethernet: Works directly if you have a DHCP server.
  • Wi-Fi: You need to use raspi-config to configure it:
    sudo raspi-config
    Then go into Network options > Wi-Fi and follow the setup wizard.

Finally, I recommend starting the SSH service and using it to finish the installation:

  • Start the SSH service:
    sudo service ssh start
  • Find the Raspberry Pi IP address.
    One option is to use the command:
    ifconfig

    And I explain other ways to find the Raspberry Pi IP address in this article if needed.
  • Connect via SSH:
    On Windows, you’ll need to install software like Putty.
    On Linux/macOS it’s available directly: ssh pi@IP.
    The login and password are the same as the user we just created.

If you are new to this, I have a complete guide on how to use SSH with a Raspberry Pi. It will answer all your questions and give you a few useful tips. Make sure to check it before going further.

Update the system

From there, I recommend updating the system. It’s not mandatory if you are doing a quick test of NextCloudPi, but as it’s a custom image, it can be a little outdated.

To do this, use the following commands:
sudo apt update
sudo apt upgrade
sudo reboot

You’re now ready to move to the NextCloud configuration.

Are you a bit lost in the Linux command line? Check this article first for the most important commands to remember, and a free downloadable cheat sheet so you can have the commands at your fingertips.

Configure NextCloud

NextCloudPi web interface

NextCloudPi is available through a web interface that you can use to configure it.
I’ll show you how to enable it, but you can absolutely use the text configuration tool directly if you want.

  • Run the NextCloudPi configuration tool:
    sudo ncp-config
  • Click on “CONFIG”:
  • Scroll down to “Enable WebUI” and press enter:
  • Confirm by writing “yes” in the confirmation window:
  • Exit the configuration tool.

Apache restarts and the web interface is now available at: https://<RASPBERRY_IP>:4443.

This is just the NextCloudPi configuration page, not the NextCloud page.
If it asks for a login and password, the default login is “ncp” and the password “ownyourbits”.

Activate NextCloud

  • Open the https://IP URL in your browser
  • You’ll probably get an HTTPS certificate error, ignore it for now.
    You can always install a Let’s Encrypt certificate later if you want.
  • You’ll be redirected to a page looking like this:
  • Both usernames are “ncp” but you need to note the two passwords for the following steps.
    The first one is the NextCloudPi password, to configure NextCloudPi.
    The second one is the NextCloud password, to access NextCloud.
  • Then click on “Activate”.
  • The NextCloud activation starts.
  • Finally, you get the success message, NextCloud is ready to use:

NextCloud first login

You are redirected to the ncp config page. You can follow the configuration wizard if you want, but it’s not mandatory.

You can access NextCloud directly at https://<RASPBERRY_IP>.

NextCloud login form

Enter the login (ncp) and the second password you noted in the previous steps.
Then click Log in.

The main NextCloud page shows up in your browser:

NextCloud default home page

Congrats! NextCloud is ready to use.
I’ll come back to the NextCloud usage in the last part of this guide.

Update NextCloudPi

One last thing you can do before starting to use NextCloud is to update NextCloudPi.
On the login screen, we had a warning saying that NextCloudPi is outdated.
Now that NextCloud is configured, you can do this update (I was unable to do it before that).

The update is easy, just run:
sudo ncp-update
You can also do it from the web interface if you prefer (the one with the port 4443).

If you’re happy with this installation method you can skip the following part and read the last one about NextCloud usage.

Alternative: Install NextCloud on Raspberry Pi OS

Why install it on Raspberry Pi OS?

This second method is perfect if you want to add NextCloud to your current Raspberry Pi installation, without losing anything you already have

raspberry pi os introduction

This way, you can also keep control of everything (for example Apache and PHP versions, Raspberry Pi OS version, NextCloud version).

Also, if you already have Raspberry Pi OS and Apache/PHP, you can quickly test NextCloud by extracting files in your /var/www folder, and removing it immediately if NextCloud is not for you.

Install Raspberry Pi OS

If you don’t have Raspberry Pi OS installed yet, you need to start here.
Follow this Raspberry Pi OS installation guide if you need help in doing this.

But basically, you need to:

  • Download Raspberry Pi OS (Lite is fine).
  • Flash the SD card with Etcher or Raspberry Pi Imager.
  • Insert the SD card into the Raspberry Pi and start it.
  • Do the network configuration.
  • Update the system.
  • Enable SSH.
    It’s not mandatory, but I find it easier to copy/paste the commands from my computer, instead of using the Raspberry Pi directly.

Then you’re ready to move to the next step.

NextCloud prerequisites

Before installing NextCloud, there are a few prerequisites to have on your system.
NextCloud needs a web server with Apache, MySQL (MariaDB) and PHP.
And it also needs a few PHP modules.

Use the following commands to install everything:
sudo apt install apache2 mariadb-server libapache2-mod-php
sudo apt install php-gd php-json php-mysql php-curl php-mbstring php-intl php-imagick php-xml php-zip

Wait a few minutes for the installation to finish, and restart Apache to load the new PHP modules:
sudo service apache2 restart
You’re now ready to install NextCloud.

Warning: Be careful when choosing the NextCloud version to install. It can be a mismatch between the NextCloud requirements and the services versions available on Raspberry Pi OS.

For example, if the latest version of NextCloud requires PHP 8, and Raspberry Pi OS only have PHP 7.4 available in the repository, it won’t work.
You may need to either pick an older NextCloud version or install a more recent version of PHP manually (the first option is easier).

NextCloud installation

Download NextCloud

You now need to download and extract the NextCloud archive:

  • Go to the Apache web folder:
    cd /var/www/html
  • Get the NextCloud link here.
    There are many downloads available.
    Look for the server section, and then the community subsection:

    You can then copy the link of the archive button:

    Remember to check the PHP requirements to make sure your current installation is compatible with the version you take.
  • You can also test this command directly, if they don’t change the link it should be fine:
    sudo wget https://download.nextcloud.com/server/releases/latest.zip
  • Extract the file with unzip:
    sudo unzip latest.zip
    I’m showing you the zip file as it’s easier to extract, but you can also get the .tar.bz2 archive from the NextCloud website.
  • As we use root to extract files, we need to change the folder permissions to allow Apache to access it:
    sudo chmod 750 nextcloud -R
    sudo chown www-data:www-data nextcloud -R

NextCloud is almost ready to use, but we first need to create a MySQL database to store its data.

MySQL configuration

After the MariaDB server installation, it creates a root user you can use only from the command line.
For NextCloud, I recommend creating a new user and a dedicated database:

  • Connect to MySQL with root:
    sudo mysql
  • Create the new user:
    CREATE USER 'nextcloud' IDENTIFIED BY 'password';
    Replace “password” with a strong password.
  • Create the new database:
    CREATE DATABASE nextcloud;
  • Give all permissions to the new user on this database:
    GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@localhost IDENTIFIED BY 'password';
    Same thing here, just replace “password” with the previous password.
  • Save and exit:
    FLUSH PRIVILEGES;
    quit

The database is ready for the end of the NextCloud installation.

More details on how to set up a MySQL server in this other article.

NextCloud configuration

You can now access the NextCloud configuration page and finish the setup:

  • Open the following URL in your browser: https://IP/nextcloud
    Replace the “IP” with the Raspberry Pi IP address.
  • A form like this shows up (first part):

    If you get any error at this point, that’s probably because some PHP modules are missing, install them with APT to fix the errors before going further.
  • Choose a username and password for NextCloud.
    Warning: make sure to use a long password (10 characters or more). I tried with a simple one, it doesn’t stop the installation, but I couldn’t log in with it after that. I had to reset the account with another password…
  • The second part asks you where you want to store the NextCloud files.
    You can keep the default value if you only have one main partition, or change it to use an external USB drive, for example.
  • Then, the third part is your database configuration.
    Enter the credentials we just created in MySQL:
    – User: nextcloud
    – Password: “password” (the password you used in the MySQL commands)
    – Database: nextcloud
    – Host: localhost
  • Then click “Install” and wait a few minutes.

There is a redirect at the end of the installation. It didn’t work during my tests.
If you get an error, just type the URL again:
http://IP/nextcloud
And you’ll get the login form:

Sign in with the admin account, and you’ll get access to the full interface.
It looks like the one with NextCloudPi, but there are fewer apps enabled by default.

In the main menu, you only get these icons:

All the other apps can be enabled from the NextCloud app store (Calendar, Contacts, …).

NextCloud usage

In this part, I’ll give you a little more details about the NextCloud interface.
So you can start quickly to use it, and discover everything in a few minutes.

Web interface

The main interface is intuitive, and you’ll probably find what you are looking for without more explanations.

As I already said, NextCloud uses apps to provide features, like on your phone.
In the top bar, you’ll find the main menu, to switch to another App.
Each app has a custom design, with or without a left menu to access more subsections.

In the following sections, I will introduce the three main submenus of the administration panel.
To access it, click on the icon at the extreme right in the top bar (your avatar, probably the first letter of the username for now).

In the menu, you’ll get mainly 3 options:

  • Settings: to configure everything on NextCloud, from your personal profile to the server configuration.
  • Apps: to see which apps are already installed, remove some or install new features.
  • Users: NextCloud can manage multiple users to have personal storage for all the family members or employees.

I’ll introduce each of these three parts now.

Settings

In the “Settings” submenu, you can configure many things, with two categories:

  • Personal configuration: profile, security (two-factor authentication for example), themes, etc.
  • Administration: with an administrator account, you can also configure things for all users like an email server for notifications, encryption, appearance (company logo for example), etc.

For each subcategory, you get an intuitive interface with often a short explanation about the page, so I don’t think you’ll need more from me.

If you have any questions about the configuration, you can check the NextCloud administrator manual, or ask your question in the community.

Apps

The second menu is more interesting, with the apps catalog.
In the “Your apps” section, you can check in a few clicks which apps you are using and which ones are installed but disabled.

You can also manage the apps updates from there, in a few clicks:

Then, the next entries in the left menu are here to find and install new apps, with one submenu by category: Customization, Files, Games, Integration, etc.

For each app, you can check directly if it’s an official app, and install it easily by clicking on “Download and enable”. Generally, the new app will appear directly in the top bar of NextCloud.

Users

Finally, you can also manage users and groups on NextCloud.
In the “Users” menu, you can create as many users and groups as you need, and flag them as administrators or not.

Groups are useful in some apps.
For example, you can create a group “IT” and share a folder with anyone in the group from the “Files” app.

It’s also possible to import users from an LDAP or other sources like Linux users.
You’ll need to install the corresponding app to use these features.

Desktop apps

The web interface is not the only way to use NextCloud.

From the official website, you can download NextCloud for desktop.
It’s available for Windows, macOS and Linux.

The goal of this desktop app is to synchronize your files between your computer and the NextCloud server (like with Dropbox for example).

During the installation, enter the server address (something like http://IP/nextcloud, or http://IP for NextcloudPi).
Then log into your account and grant access to the app.

The last step is to configure how the app handles synchronization:

The first sync will start, and you’ll keep a NextCloud companion in the system tray to check the synchronization status.
As soon as you add a new file to your folder, NextCloud synchronizes files instantly.

Android and iOS apps

The same thing is available on your phone (Android and iOS).
It also provides a mobile-friendly interface to use NextCloud.
Here is the demo video provided by NextCloud for Android:

Remote access

As it’s supposed to be a cloud server, you’ll probably want to forward a port on your Internet router to access the NextCloud server.

It’s possible with your domain name or a service like NoIP if you have a dynamic IP address (detailed tutorial here).

In this case, I highly recommend installing an SSL certificate (Let’s Encrypt) and maybe using a two-factor authentication app to block brute-force attacks.

You’ll find the documentation about SSL and Apache configuration to do this in the Installation on Linux manual.

Note: This part can be a bit tricky. I have a video lesson available for the community members where I show you how to host a website at home (not Bitwarden, but it’s the same steps). You can join here and watch it directly if you are interested (with 10+ other lessons for Raspberry Pi and many other benefits).

Additional storage

The main interest in NextCloud is to have unlimited storage space, as you are the host.
But on Raspberry Pi, you’re limited by the SD card size.

Even if you can easily get more space than with free providers, it’s often not enough to compete with their premium offers.

If you want to store large files, it’s possible to add external storage to your Raspberry Pi, a USB disk (I love the mini USB keys like this one on Amazon to do this) for example or even remote storage (Dropbox, Google Drive, Amazon, another local server).

You’ll find all the documentation here to configure this on your server.

Backups

As for any storage idea on Raspberry Pi, remember that the Raspberry Pi SD card is not the safest storage method. If your SD card crash, you can lose everything on NextCloud. So remember to make regular backups to another storage (another Pi, a NAS, a USB disk, etc.).

Files are located in the NextCloud folder, the data subfolder.
For example, the admin user, is probably in /var/www/html/nextcloud/data/admin/files/

So, make a backup of /var/www/html/nextcloud/data and you’ll be fine.

You can also make an entire backup of the NextCloud folder and the database, to have a chance to reinstall it the same way as it is now. Check this tutorial for more information on how to back up a Raspberry Pi efficiently.

Video

If you are looking for exclusive tutorials, I post a new course each month, available for premium members only. Join the community to get access to all of them right now!

Conclusion

That’s it, I think we have seen a good overview of what NextCloud can do on your Raspberry Pi, and how to install it by two different methods.

I’m pretty impressed by the server’s performance. I have bad memories of NextCloud on a physical server, with slow access and a high load average. But for now, it seems to work absolutely fine on Raspberry Pi, with no load and no lag, great news!

I’ll probably try to keep it installed on one of my Raspberry Pi and see with more intense usage how it works.

Additional Resources

Not sure where to start?
Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.
Watch the Raspberry Pi Bootcamp course now.

Master your Raspberry Pi in 30 days
Don’t want the basic stuff only? If you are looking for the best tips to become an expert on Raspberry Pi, this book is for you. Learn useful Linux skills and practice multiple projects with step-by-step guides.
Download the e-book.

VIP Community
If you just want to hang out with me and other Raspberry Pi fans, you can also join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.
More details here.

Need help building something with Python?
Create, understand, and improve any Python script for your Raspberry Pi.
Learn the essentials step-by-step without losing time understanding useless concepts.
Get the e-book now.

You can also find all my recommendations for tools and hardware on this page.

Installing NextCloud on Your Raspberry Pi (2 Ways)

NextCloud is a great way to store and share files, photos, and other data securely. It’s also a great way to keep your data safe and secure on your Raspberry Pi. In this article, we’ll show you two ways to install NextCloud on your Raspberry Pi.

Method 1: Installing NextCloud with Docker

The first method we’ll show you is to install NextCloud with Docker. Docker is a container platform that allows you to easily install and run applications on your Raspberry Pi. To get started, you’ll need to install Docker on your Raspberry Pi. You can do this by running the following command:

sudo apt-get install docker-ce

Once Docker is installed, you can then pull the NextCloud image from the Docker Hub. To do this, run the following command:

docker pull nextcloud

Once the image is downloaded, you can then run the container with the following command:

docker run -d -p 8080:80 nextcloud

This will start the NextCloud container and make it available on port 8080. You can then access the NextCloud web interface by going to http://localhost:8080 in your web browser.

Method 2: Installing NextCloud with Raspbian

The second method we’ll show you is to install NextCloud with Raspbian. Raspbian is the official operating system for the Raspberry Pi. To get started, you’ll need to install Raspbian on your Raspberry Pi. You can do this by downloading the Raspbian image from the Raspberry Pi website and writing it to an SD card.

Once Raspbian is installed, you can then install NextCloud with the following command:

sudo apt-get install nextcloud-server

This will install the NextCloud server on your Raspberry Pi. You can then access the NextCloud web interface by going to http://localhost in your web browser.

Conclusion

In this article, we showed you two ways to install NextCloud on your Raspberry Pi. The first method was to install NextCloud with Docker, and the second method was to install NextCloud with Raspbian. Whichever method you choose, you’ll be able to access your NextCloud server from any web browser.

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

Contact
San Vito Al Tagliamento 33078
Pordenone Italy
Item added to cart.
0 items - 0.00
Open chat
Scan the code
Hello 👋
Can we help you?