This article documents the operations and pitfalls of installing NextCloud on a Raspberry Pi.
-
Raspberry Pi 4 (4GB)
-
Many applications cannot be installed with less than 4GB. For a smooth installation, 4GB is recommended, theoretically 1GB can also work.
-
NextCloud is memory-intensive, for a smooth experience, starting with 4GB is advisable.
-
Use whatever Raspberry Pi you have, the above two points can be ignored.
-
SD Card (32GB) [A1]
-
NAS storage is affected by IO performance, Raspberry Pi’s SD card has weak IO, A1 performance is slightly better.
-
Hard Drive Enclosure (independent power supply)
-
For external hard drive use, relying on the SD card’s capacity. Installing a system will fill it up.
-
2.5-inch Hard Drive (500GB) (old hard drive)
-
Start with an old drive, later add a new NAS hard drive to increase capacity.
-
Install Ubuntu 20.04 server version on the Raspberry Pi.
-
For performance and stability, do not use the desktop version.
-
Set up Raspberry Pi WiFi (must be able to access Google to avoid download source issues).
-
Snap installation relies on being able to download third-party image sources.
-
Connect Raspberry Pi, PC, and mobile phone to the same WiFi (stay on the same subnet for IP access).
-
Convenient for SSH.
-
Convenient for accessing NextCloud web.
-
Access NextCloud via mobile app.
Update Ubuntu
sudo apt-get update
Install Snap
sudo apt-get install snap
Install NextCloud
sudo snap install nextcloud
Change Default Ports
Remember to open the ports.
sudo snap set nextcloud ports.http=81 ports.https=444
Access NextCloud
Address: ip+port
Enable Plugin
Plugin Name: External storage support
This plugin is disabled by default after installing NextCloud. Enable this plugin to use external storage.
After installing NextCloud via Snap, there may be an error as follows:
Fix “smbclient” not installed. Unable to mount “SMB / CIFS”, “SMB / CIFS uses OC login information”. Please contact the administrator for installation.
Follow the steps below to resolve:
Install Samba Client
sudo apt install samba-client
Input smbclient
Verify if installation was successful.
smbclient
Refresh the external storage page; the warning will still be displayed, but it can actually be used.
Disk Partitioning
Partition the disk to the specified size and format.
This time, the partition is specified as 25G and ext4 file system.
View Existing Partitions
df -l
Check Service Disk Status
fdisk -l
Add New Partition
fdisk /dev/sdb
Enter the following in sequence:
N 回车
P 回车
1 回车
两次回车
W 回车
Format the Partition
/dev/sdb1 is the newly partitioned disk (modify according to your path).
Format it as ext4 file system.
sudo mkfs -t ext4 /dev/sdb1
Mount the Partition
NextCloud needs to mount to /media.
sudo mount /dev/sdb1 /media
Connect NextCloud to media.
sudo snap connect nextcloud:removable-media
Add External Storage
Configure to the absolute path, which is /media here.
Directory can be arbitrary, here it is labeled as 24G.
You can see the file function, with an additional 24G soft link target identifier.
Click to enter the directory and upload files.
At this point, the installation of NextCloud and the configuration of the external hard drive are basically complete.
There will be a lot of pitfalls when mounting media.
After investigation, if the partition is larger than 50G, there will be inexplicable problems (after changing to a partition of 25G, there are no issues).
-
Prompt that the partition is damaged and cannot be mounted (using fsck to repair does not help) (error: Structure needs cleaning).
-
Prompt invalid partition cannot be mounted (actually already partitioned and formatted successfully).
-
Prompt other errors, cannot mount.
Pitfalls after successful mounting:
-
NextCloud uses USB 2.0 to mount the hard drive, speed is only 4M/S.
-
After changing to USB 3.0, it prompts insufficient power, unstable voltage, system freezes (temporarily changed back to USB 2.0).
-
Changed sockets, power banks, USB power supply, currently cannot stably support USB 3.0 (needs further investigation).
-
Connecting the Raspberry Pi to an HDMI display also affects power voltage.
END.