Execute the following commands in a bash shell.
Install Nextcloud using snap
sudo apt update
sudo apt install snapd -y
sudo reboot
sudo snap install core
sudo snap install nextcloud
Access Nextcloud locally or remotely on http://{ip}
with user admin
and password admin
.
sudo /snap/bin/nextcloud.enable-https self-signed
This also redirects all HTTP traffic to HTTPS.
Ensure that only the external storage to be used to store Nextcloud's data is the only external storage attached to the Raspberry Pi.
sudo mkdir /mnt/usb
sudo mount /dev/sda1 /mnt/usb -o uid=pi,gid=pi
Update fs
to the external storage's file system. Consider running sudo fdisk -l
to retrieve the value.
uuid=$(sudo ls -l /dev/disk/by-uuid/ | grep sda1 | awk '{print $9}')
echo "UUID=${uuid} /mnt/usb auto defaults,uid=pi,gid=pi,dmask=007,nofail,x-systemd.device-timeout=5 0 0" | sudo tee -a /etc/fstab
- Update the value of
datadirectory
in/var/snap/nextcloud/current/nextcloud/config/config.php
to the new storage path in/mnt/usb/
e.g./mnt/usb/data
. - Run the following code with the new storage path.
path=/mnt/usb/data
sudo snap disable nextcloud
sudo mv /var/snap/nextcloud/common/nextcloud/data "${path}"
sudo snap enable nextcloud
Warning: After running the commands in this section, the Raspberry Pi will not be able to access the Internet. To undo this operation, delete the appended configurations in /etc/dhcpcd.conf
and run sudo reboot
.
Initialize the following variables:
network={eth0|wlan0} // Ethernet or wireless respectively
ip={ip} // static IP address for the Raspberry Pi
routerIp={routerIp} // the gateway IP address for your router on the local network. Typically 192.168.0.1
dnsIp={dnsIp} // the DNS IP address (typically the same as your router’s gateway address)
E.g.
network=wlan0
ip=$(hostname -I)
routerIp=$(ip route | grep default | awk '{print $3}')
dnsIp="${routerIp}"
Then, run
lines=("interface ${network}" "static ip_address=${ip}/24" "static routers=${routerIp}" "static domain_name_servers=${dnsIp}")
for line in "${lines[@]}"; do echo $line | sudo tee -a /etc/dhcpcd.conf; done
Then, run sudo reboot
.
- Disable SSH
- Create a separate User Account