Build Your Own Raspberry Pi Cloud Server with Nextcloud

Posted by admin on

Cloud storage is an essential part of modern life. The downside is that your data is stored on remote servers by a faceless corporation which you have to trust with the privacy and security of your precious documents and photos.

There is another option, however: hosting your files on your very own cloud server running on a computer in your home or office. One of the most popular services for achieving this is .

We’ll show you how to install Nextcloud on a Raspberry Pi, attach external storage, and choose a suitable case.

Nextcloud vs ownCloud for Raspberry Pi: Which is Best?

Another option for your home-based Raspberry Pi cloud server is ownCloud. In fact, Nextcloud is an independent spin-off of ownCloud created by some of the latter’s core contributors.

While the core features are very similar for both, there are some key differences. Some of the more advanced features in ownCloud are only available for premium subscribers, whereas all features are free in Nextcloud. Non-technical users may also find Nextcloud’s user interface a little easier to use.

1. Install Nextcloud

There are two main methods for installing Nextcloud on a Raspberry Pi. The first is to use the Nextcloud Ubuntu Appliance for Raspberry Pi. This requires you to open an Ubuntu SSO account and also to generate SSH keys to remotely access and start up your new Nextcloud server.

Alternatively, NextCloudPi is a special version of Nextcloud designed to run on a Raspberry Pi 3 or 4. That’s the method we're using here.

First, download the latest NextCloudPi OS image file from the OwnYourBits website. Open the folder marked RPi followed by a date (not the Berryboot version). Download the BZ2 file or use the torrent to download it (recommended).

Extract the file using an archiving tool (e.g. WinRAR or 7-Zip for Windows) on your computer; you’ll now have a folder containing an IMG file.

Use the Raspberry Pi Imager application to flash this (OS image) file to an inserted microSD card—an 8GB or larger capacity card is recommended. To use this:

  • Click Choose OS
  • Select Use custom and browse to the NextCloudPi IMG file
  • Click Choose Storage and select your microSD card (typically called something like "Generic Storage Device")
  • Click Write and wait for it to be written and verified

Related: How to Install an Operating System on Raspberry Pi

2. Boot Up Nextcloud on Raspberry Pi

Place the microSD card in your Raspberry Pi and turn on the power. After a few seconds showing the bootup sequence (lots of scrolling text), you’ll be prompted to log in. The default username is pi and the password is raspberry. For security reasons, it’s advisable to change your Raspberry Pi password afterwards.

3. Connect to Wi-Fi

Enter sudo raspi-config and select 2 Network Options, then N2 Wireless LAN. Choose your country, followed by your router’s SSID (name) and password. Select Finish to return to the command line.

To discover the Raspberry Pi’s IP address, enter:

ip addr

Note down the inet address under wlan0: this is the Raspberry Pi’s IP address. Some routers will reserve the same address for it each time it’s booted; if not, you’ll want to set up a static IP address for your Raspberry Pi.

At this point, you can also also enable SSH for remote access from another computer if you don't want to keep your Raspberry Pi connected to a monitor while continuing the setup. To do so, use the command:

sudo service ssh start

From the command line or terminal of another computer, you can then enter ssh pi@[your Pi’s IP address] to access the Raspberry Pi’s command line.

4. Enable Nextcloud Web Interface

Enter sudo ncp-config and select Yes if prompted to update. In the next menu, select CONFIG and use the down arrow to scroll to the bottom of the list.

Here, select nc-webui, then erase no and type yes. Press Enter and then any key. Select Back and Finish to exit the config tool.

5. Activate and Configure Nextcloud

In a web browser on another computer, enter the address https://[your Pi’s IP address]:4443

If you see a warning that your connection isn’t private or secure, choose to ignore it (by selecting Advanced in Chrome or Firefox) and proceed to the site.

You’ll be prompted to log in. The default username is ncp, and the password is ownyourbits.

The NextCloudPi activation screen shows two passwords, which you’ll need to copy and paste into a document for safe keeping. The first is the password for the NextCloudPi web panel which enables you to configure server settings. The second is for the Nextcloud web interface itself. You can changes these passwords later if you want.

With those passwords noted down, select Activate. After a few seconds, you’ll be prompted to log into the NextCloudPi web panel. However, let’s skip that for now and log into the Nextcloud web interface.

6. Access the Nextcloud Web Interface

Go to https://[your Pi’s IP address] (without the :4443 suffix) and log in with the username ncp and the second password you noted down.

After proceed through a welcome screen, you’ll see the main web dashboard. This is your own cloud server running on Raspberry Pi!

Click the N at the top right to access a drop-down menu with options for Settings (a whole bunch—personal and admin), Users (you can add and manage users), and Apps to install (such as the Collabora Online office suite and ARM64 server).

In the top toolbar are icons for sections such as Files, Photos, Contacts, Calendar, and Tasks. There’s also a NextCloudPi icon that takes you to the web panel. Click it and you’ll be prompted to log in with the username ncp and the first password you noted down. A wizard will appear, with options to configure USB storage and external access over the internet.

7. Add USB External Storage

Your microSD card will have limited capacity, so it’s best to add USB storage for your Nextcloud server. Connect your storage device to one of the Raspberry Pi’s USB ports.

Before going any further, you’ll need to create a directory for it in the command line on the Raspberry Pi (or via SSH). Enter the following command:

sudo mkdir /media/USBdrive

Go to the NextCloudPi web panel in your other computer’s web browser. In the wizard that appears (you can open it using a wand icon in the top toolbar), select USB Configuration. Answer Yes to the first question, then click Continue.

You’ll then be asked if you want to format the USB drive. If you‘re sure there are no important files on it you want to keep, select Format USB. Finally, click Move data to USB.

8. Add External Access Over the Internet

So far, you can only access your Nextcloud server from your own local network, which is a bit limiting. To access your Nextcloud server over the internet from any location requires the use of port forwarding and a dynamic DNS service.

9. Choose a Case For Your Nextcloud Server

Running your Nextcloud server on a bare Raspberry Pi board  isn’t a good idea as it will accumulate dust over time. There’s a wide variety of cases available for standard-size Raspberry Pi 3 and 4 models.

Rather than a cheap plastic case, we’d recommend something more solid such as the DeskPi Pro. This has enough room inside the case for a SATA storage drive and is supplied with an M.2 to SATA adapter. To prevent your Raspberry Pi overheating, it also features an ICE Tower cooling system and heatsink.

Another good option is the Argon ONE M.2 case, which enables you to use any size M.2 SATA drive. Alternatively, you could choose a robust case for Raspberry Pi alone and plug in a standard external USB storage drive.

Build Your Own Raspberry Pi Cloud Server: Success

Congratulations, you have now set up a cloud server on your Raspberry Pi using NextCloudPi. You can visit its dashboard using a web browser on another device. There’s even a Nextcloud app for iOS and Android that you can use.

Share this post

← Older Post Newer Post →