Introduction
NextCloud is a powerful, open-source file synchronization and sharing solution that allows individuals and organizations to host their own cloud storage platform.
This Document will provide step by step on how download, install, and setup your Raspberry Pi and NextCloud
These Steps are not limited to the exact Raspberry Pi (4) or Ubuntu Server 23.10 (64-bit) if there are later versions available to you, or if you have different machine you may use similiar steps as guidance. Feel free to do your own research to overpass any road blocks.
Prerequisites
Before proceeding with the installation, ensure you have the following:
- Raspberry Pi
- SD Card (with sufficient storage capacity)
- Internet connection
- Basic familiarity with command-line interfaces
Installation Steps
- Download Raspberry Pi Imager: Visit Raspberry Pi Software and download the Raspberry Pi Imager.
-
Prepare SD Card: Insert the SD Card into your PC and open the Raspberry Pi Imager.
- Select your Raspberry Pi device
- Choose "Other general-purpose OS"
- Choose "Ubuntu"
- Choose "Ubuntu Server 23.10 (64-Bit)" (or later version)
-
Configure Settings:
Windows: (CTRL + Shift ⇧ + ⨉)
Mac: (⌘ + Shift ⇧ + ⨉)- Setup your hostname (this will be your machine's name)
- Setup your username and password
- Setup Locale Settings
- Enable SSH under the SERVICES tab
- Install Ubuntu Server Image: Proceed to install the Ubuntu Server image on your SD Card.
-
Open Terminal (Windows) or Terminal (Mac): Use the appropriate terminal application.
Windows: Open Terminal, Command Prompt, or PowerShell
Mac: Open Terminal - SSH into Raspberry Pi: (replace 'username' and 'hostname' with your chosen credentials).
- Upgrade and Update Ubuntu Server:
- Install Snap Daemon:
- Verify Snap Version:
- Install NextCloud:
- Verify NextCloud Installation:
- Configure Firewall:
- Access NextCloud Web Interface: Visit http://{Raspberry Pi - IP Address} in your web browser.
- Enter a username and strong password to create the first administrator account, and click Install.
- Create Administrator Account: Enter a username and strong password to create the first administrator account.
- Edit Configuration File:
- Modify Trusted Domains: Update 'trusted_domains' with your domain name and IP address.
- Install Let's Encrypt SSL Certificate:
- Restart NextCloud:
- Access NextCloud Dashboard: Visit https://{your_domain_name} or https://{your_public_ip_address} in your web browser.
- Plug in External Drive.
- List Drives:
- Partition and Format Drive:
- Create new GPT table:
- Check your Disk:
- Get your Drive UUID
- Create the directory
- Reload Mount:
- Check Mount:
- Change NextCloud Data Directory to be your external drive
Step 1: Prepare Ubuntu Server Image
Step 2: Connect to Raspberry Pi
If you're working directly on the Raspberry Pi, skip the next step.
Otherwise, follow these steps to connect remotely:
username would be the username you used in point 3
hostname would be the hostname you used in point 3
(If you run into issues with your hostname, you may use the IP address of your Raspberry Pi)
"ssh: Could not resolve hostname fl1ght5network: No such host is known."
(in my case it is FL1GHT5@FL1GHT5Network or FL1GHT5@10.1.1.5)
Step 3: Install and Configure NextCloud
snap 2.61.1 snapd 2.61.1 series 16 ubuntu 23.10 kernel 6.5.0-1005-raspi
Name Version Rev Tracking Publisher Notes core18 20231027 2810 latest/stable canonical✓ base core22 20230801 867 latest/stable canonical✓ base lxd 5.20-f3dd836 27054 latest/stable canonical✓ - nextcloud 27.1.6snap1 40247 latest/stable nextcloud✓ - snapd 2.61.1 20674 latest/stable canonical✓ snapd
Rules updated Rules updated (v6)
Rules updated Rules updated (v6)
(in my case it is http://10.1.1.5)
Remember to keep it as HTTP and not HTTPS, We have not YET setup an SSL certificate with web encryption to use HTTPS.
Find the "trusted_domains' =>` section, and replace the Server IP with your domain name as below.
Output: 'trusted_domains' => array ( 0 => 'nextcloud.example.com', ),
Edit the trusted_domains to be similiar to the following:
'trusted_domains' => array ( 0 => 'localhost', 1 => 'https://your_Domain_Name', # (if you have a domain name such as FL1GHT5.net) 2 => 'your_device_ip_address', # (in my case it is 10.1.1.2) 3 => 'your_public_ip_address' # (you can use sites like https://whatismyipaddress.com/ to find your IPv4 Public IP Address) ),
In order for Let's Encrypt to verify that you actually own the domain(s) for which you're requesting a certificate, there are a number of requirements of which you need to be aware: 1. In order to register with the Let's Encrypt ACME server, you must agree to the currently-in-effect Subscriber Agreement located here: https://letsencrypt.org/repository/ By continuing to use this tool you agree to these terms. Please cancel now if otherwise. 2. You must have the domain name(s) for which you want certificates pointing at the external IP address of this machine. 3. Both ports 80 and 443 on the external IP address of this machine must point to this machine (e.g. port forwarding might need to be setup on your router). Have you met these requirements? (y/n) Y Please enter an email address (for urgent notices or key recovery): {your_email@address} Please enter your domain name(s) (space-separated): {your_domain.name}
Step 4: Mount External Drive (Optional)
If you wish to mount an external drive for data storage, follow these additional steps:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS loop0 7:0 0 68.5M 1 loop /snap/core22/867 /snap/core22/867 loop1 7:1 0 169M 1 loop /snap/lxd/25953 /snap/lxd/25953 loop2 7:2 0 35.5M 1 loop /snap/snapd/20298 /snap/snapd/20298 loop3 7:3 0 35.2M 1 loop /snap/snapd/20674 /snap/snapd/20674 loop4 7:4 0 134.1M 1 loop /snap/lxd/27054 /snap/lxd/27054 loop5 7:5 0 49.1M 1 loop /snap/core18/2810 /snap/core18/2810 loop6 7:6 0 296.1M 1 loop /snap/nextcloud/40247 /snap/nextcloud/40247 loop7 7:7 0 0B 0 loop sda 8:0 0 3.6T 0 disk └─sda1 8:1 0 3.6T 0 part mmcblk0 179:0 0 28.9G 0 disk ├─mmcblk0p1 179:1 0 512M 0 part /boot/firmware └─mmcblk0p2 179:2 0 28.4G 0 part /snap / ({your_disk_name} is in my case the sda)
GPT fdisk (gdisk) version 1.0.9 Partition table scan: MBR: protective BSD: not present APM: not present GPT: present Found valid GPT with protective MBR; using GPT. Command (? for help): d Prtition number (1-2): 1 Command (? for help): d Using 2 Command (? for help): w Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!! Do you want to proceed? (Y/N): y OK; writing new GUID partition table (GPT) to /dev/{your_disk_name}. The operation has completed successfully.
GPT fdisk (gdisk) version 1.0.9 Partition table scan: MBR: protective BSD: not present APM: not present GPT: present Found valid GPT with protective MBR; using GPT. Command (? for help): n Partition number (1-128, default 1): 1 First sector (34-7813969886, default = 2048) or {+-}size{KMGTP}: Last sector (2048-7813969886, default = 7813967871) or {+-}size{KMGTP}: Current type is 8300 (Linux filesystem) Hex code or GUID (L to show codes, Enter = 8300): Changed type of partition to 'Linux filesystem' Command (? for help): w Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!! Do you want to proceed? (Y/N): y OK; writing new GUID partition table (GPT) to /dev/{your_disk_name}. The operation has completed successfully.
(You will notice that you have successfully created a GPT partition to your disk look for /dev/{your_disk_name}1 in my case this is /dev/sda1)
Mount Drive Upon Boot:
(copy the UUID of /dev/{your_disk_name}1 >> UUID"{your_disk_uuid}")
Press [INSERT] key to start typing
# Cloud Storage UUID=8a48a5e7-1b95-4b77-80fd-d3cf88ea85e7 /snap ext4 defaults 0 0
Press [ESC] key then type :wq to write and quit followed by [ENTER] key
Resources I have complied and used to make this project possible:
NextCloud Documentation: Installation on Linux
VULTR Documentation: How to Install NextCloud on Ubuntu 22.04 with Snap
DigitalOcean: How To Install and Configure Nextcloud on Ubuntu 20.04
Tech Guides: How to Partition, Format, and auto Mount Disk on Ubuntu 20.04
Tech Guides: How to Install Nextcloud on Ubuntu, Move Data Directory, Setup Free DDNS Domain & SSL Certificate