Cloud storage is an important part of life in the 21st century. The downside is that your data is stored on remote servers by an anonymous company, which means you have to trust them with your private documents and photos.
You can also host your files on your own cloud server, which you can run on a computer in your home or office. Nextcloud is a popular service that can help you do this. We’ll show you how to install Nextcloud on a Raspberry Pi, connect external storage, and choose a good case.
Which is better for Raspberry Pi: Nextcloud or ownCloud?
OwnCloud, which can be installed on Raspberry Pi OS, is another option for your home-based Raspberry Pi cloud server. In fact, some of the core contributors to ownCloud made Nextcloud as a separate project.
Both have a lot in common, but there are also some important differences. Some of ownCloud’s more advanced features are only available to people who pay for a paid plan, but all of Nextcloud’s features are free. The user interface of Nextcloud may also be a little bit easier to use for people who aren’t very tech-savvy.
1. Set up Nextcloud.
There are two main ways to get Nextcloud running on a Raspberry Pi 4. (or other Pi model). The first option is to use the Nextcloud Ubuntu Appliance for Raspberry Pi. To do this, you need to create an Ubuntu SSO account and SSH keys so you can log into and start up your new Nextcloud server from afar.
NextCloudPi, on the other hand, is a version of Nextcloud that is made to run on a Raspberry Pi 3 or 4. This is the way we do things here.
First, go to the OwnYourBits website and get the latest NextCloudPi OS image file. Open the folder with the name Nextcloud RPi and a date (not the Berryboot version). Use the torrent or the BZ2 file to download it (recommended).
Using an archiving tool (like WinRAR or 7-Zip for Windows), extract the file. You should now have a folder with an IMG file in it.
As usual when installing an operating system on Raspberry Pi, we’ll use the Raspberry Pi Imager app to flash this (OS image) file to a microSD card. An 8GB or larger card is recommended. How to use:
- Click Select OS.
- Choose “Custom” and then look for the NextCloudPi IMG file.
- Click Choose Storage and pick your microSD card (typically called something like “Generic Storage Device”)
- Click “Write” and wait until it’s written and checked.
2. Start Nextcloud up on a Raspberry Pi
Insert the microSD card into the Raspberry Pi and turn it on. After a few seconds of scrolling text showing the bootup process, you’ll be asked to log in. Pi is the default username, and raspberry is the default password. It’s best to change your Raspberry Pi password afterward for safety reasons.
3. Join a Wi-Fi network.
Enter sudo raspi-config, then choose 2 Network Options, N2 Wireless LAN, your country, and the SSID (name) and password for your router. To get back to the command line, click Finish.
To find out the IP address of the Raspberry Pi, type:
Note the inet address under wlan0. This is the IP address of the Raspberry Pi. Some routers will give it the same IP address every time it starts up. If yours doesn’t, you’ll need to give your Raspberry Pi a static IP address.
At this point, you can also turn on SSH for remote access from another computer if you don’t want to keep your Raspberry Pi connected to a monitor while you continue setting it up. Use the following command:
sudo service ssh start
Then, you can type ssh pi@[your Pi’s IP address] from the command line or terminal of another computer to get to the Raspberry Pi’s command line.
4. Turn on the web interface for Nextcloud
Type sudo ncp-config and click “Yes” when asked if you want to update. Choose CONFIG from the next menu, and then use the down arrow to get to the end of the list.
Here, you need to choose nc-webui, delete no, and type yes. Press Enter and any key after that. To leave the configuration tool, choose Back and Finish.
5. Turn on and set up Nextcloud
On another computer, type https://[your Pi’s IP address]:4443 into a web browser.
If you get a message saying that your connection isn’t private or secure, choose to ignore it (in Chrome or Firefox, you can do this by clicking on “Advanced”) and go to the site anyway.
You will be asked to sign in. The default username is ncp, and the default password is ownyourbits.
On the NextCloudPi activation screen, there are two passwords that you need to copy and paste into a safe place. The first is the password for the NextCloudPi web panel, where server settings can be changed. The second is for the web interface of Nextcloud itself. If you want to, you can change these passwords later.
After writing down these passwords, click Activate. After a few seconds, the NextCloudPi web panel will ask you to log in. But let’s skip that for now and go to the web interface for Nextcloud.
6. The Nextcloud Web Interface can be accessed.
Go to https://[your Pi’s IP address] (without the:4443 extension) and log in with the username ncp and the second password you wrote down.
After you get past the welcome screen, you’ll see the main web dashboard. This is your Raspberry Pi 4 server in the cloud!
Click the N in the top right corner to open a drop-down menu with options for Settings (a lot of them, both personal and admin), Users (you can add and manage users), and Apps to install (such as the Collabora Online office suite and ARM64 server).
There are icons for Files, Photos, Contacts, Calendar, and Tasks in the top toolbar. There is also a NextCloudPi icon that takes you to the web panel. When you click it, you’ll be asked to log in with the username “ncp” and the first password you wrote down. A wizard will show up with options to set up USB storage and access from outside the computer through the internet.
7. Add USB External Storage
Your microSD card will only have so much space, so the best thing to do for your Nextcloud Raspberry Pi server is to add USB storage. Plug your storage device into one of the USB ports on the Raspberry Pi.
Before going any further, you’ll need to make a directory for it on the Raspberry Pi’s command line (or via SSH). Type in the following order:
sudo mkdir /media/USBdrive
Use the web browser on your other computer to go to the NextCloudPi web panel. Choose USB Configuration from the wizard that comes up. You can open the wizard by clicking on the wand icon in the top toolbar. Click Continue after answering “Yes” to the first question.
The USB drive will then ask you if you want to format it. If you’re sure there are no important files on it that you want to keep, choose Format USB. Then, click Move data to USB.
8. Add access from the outside through the Internet
So far, you can only access your Nextcloud server from your own local network, which is a bit limited. You need to use port forwarding and a dynamic DNS service to connect to your Nextcloud server over the internet from anywhere.
9. Pick a case for your Nextcloud server
It’s not a good idea to run your Nextcloud server on a bare Raspberry Pi board because dust will build up on it over time. There are a lot of different cases for Raspberry Pi 3 and 4 models that are the standard size.
Instead of a cheap plastic case, we’d suggest something like the DeskPi Pro, which is more solid. This comes with an M.2 to SATA adapter and has enough room inside the case for a SATA hard drive. It also has an ICE Tower cooling system and a heatsink to keep it from getting too hot.
The Argon ONE M.2 case is another good choice. It lets you use any size M.2 SATA drive. You could also choose a sturdy case for Raspberry Pi by itself and plug in a regular USB storage drive.
Build Your Own Raspberry Pi Cloud Server: Success
Congratulations, you have now used NextCloudPi to set up a cloud server on your Raspberry Pi. You can use a web browser on another device to go to its dashboard. You can even use a Nextcloud app for iOS and Android.