Introduction
Nextcloud is a self-hosted open-source file hosting application that lets you store, edit and share files privately using your own server. This article explains how to use Nextcloud with Rcs's Block Storage and Object Storage to maximize the application's storage potential.
Prerequisites
- Deploy a One-Click Nextcloud app from the Rcs Marketplace.
- Deploy a Block Storage volume and attach it to your server.
- Deploy an Object Storage Volume and create a new bucket.
- Create a domain pointing to the server.
1. Setup the Server
- Connect to the server using SSH and login as root.
Create a new server user account.
# adduser example-user
Grant the new user sudo privileges.
# adduser example-user sudo
Switch to the new user.
# su example-user
Request a Free Let's Encrypt SSL certificate using Certbot. Replace
cloud.example.com
with your linked domain.$ sudo certbot --nginx -d cloud.example.com --agree-tos
To access Nextcloud using the domain, edit the
config.php
file.$ sudo nano /var/www/html/config/config.php
Find the
trusted_domain
array.'trusted_domains' => array ( 0 => '<your-server-ip-address', ),
Add your domain as a new entry.
'trusted_domains' => array ( 0 => '<your-server-ip-address>', 1 => 'cloud.example.com', ),
Save and exit the file.
Restart Nginx to load changes.
$ sudo systemctl restart nginx
Setup Nextcloud with Rcs Block Storage
2. Setup the Block Storage Volume
List all storage devices attached to your server.
$ lsblk
Output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT loop1 7:1 0 70.3M 1 loop /snap/lxd/21029 loop2 7:2 0 55.4M 1 loop /snap/core18/2128 loop3 7:3 0 44.7M 1 loop /snap/snapd/15904 loop4 7:4 0 55.5M 1 loop /snap/core18/2409 loop5 7:5 0 61.9M 1 loop /snap/core20/1494 loop6 7:6 0 67.8M 1 loop /snap/lxd/22753 sr0 11:0 1 1024M 0 rom vda 252:0 0 25G 0 disk └─vda1 252:1 0 25G 0 part / vdb 252:16 0 40G 0 disk
Your first block storage device displays as
vdb
. Any additional attachments display asvdc
,vdd
, and so on.Set the volume disk label to
gpt
.$ sudo parted -s /dev/vdb mklabel gpt
Create a new primary partition occupying the full disk space.
$ sudo parted -s /dev/vdb unit mib mkpart primary 0% 100%
Verify the new partition.
$ lsblk
Output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT loop1 7:1 0 70.3M 1 loop /snap/lxd/21029 loop2 7:2 0 55.4M 1 loop /snap/core18/2128 loop3 7:3 0 44.7M 1 loop /snap/snapd/15904 loop4 7:4 0 55.5M 1 loop /snap/core18/2409 loop5 7:5 0 61.9M 1 loop /snap/core20/1494 loop6 7:6 0 67.8M 1 loop /snap/lxd/22753 sr0 11:0 1 1024M 0 rom vda 252:0 0 25G 0 disk └─vda1 252:1 0 25G 0 part / vdb 252:48 0 40G 0 disk └─vdb1 252:49 0 40G 0 part
A new
vdb1
volume with the typepart
should display below the mainvdb
disk.Create a new directory in
/mnt
to use as a mount point for volume.$ sudo mkdir /mnt/nextcloud-data
Mount the block storage volume.
$ sudo mount -o defaults /dev/vdb1 /mnt/nextcloud-data/
Verify the new volume mount point.
$ lsblk
Output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT loop1 7:1 0 70.3M 1 loop /snap/lxd/21029 loop2 7:2 0 55.4M 1 loop /snap/core18/2128 loop3 7:3 0 44.7M 1 loop /snap/snapd/15904 loop4 7:4 0 55.5M 1 loop /snap/core18/2409 loop5 7:5 0 61.9M 1 loop /snap/core20/1494 loop6 7:6 0 67.8M 1 loop /snap/lxd/22753 sr0 11:0 1 1024M 0 rom vda 252:0 0 25G 0 disk └─vda1 252:1 0 25G 0 part / vdb 252:48 0 40G 0 disk └─vdb1 252:49 0 40G 0 part /mnt/nextdata
Enable persistent mounting to automatically mount the block storage volume at boot time.
$ sudo echo /dev/vdb1 /mnt/nextcloud-data ext4 defaults,noatime,nofail 0 0 >> /etc/fstab
Create a sample text file in the mount directory to confirm read and write access.
$ sudo echo "hello world, your nextcloud intergration works"> /mnt/nextcloud-data/sample.txt
3. Configure Nextcloud to use Block Storage
Using a web browser of your choice, visit your domain.
https://cloud.example.com
Login to Nextcloud.
If you deployed Nextcloud as a OneClick Rcs App, you can find your default credentials on the cloud instance's panel.
Click your username in the upper right corner and select Apps from the drop-down list.
- Find External storage support on the Apps list and enable it.
- Navigate to your Username again and select Settings.
- Under the Administration section, navigate to External Storage.
- Click Add storageand select Local from the drop-down list.
- Enter your Mount Point in the Configuration field and click the checkmark symbol ✓ to save changes.
- A green tick ✅ indicates a successful connection to the mount point.
4. Test
- Navigate to Files.
- Open the Local directory, or, select External Storage and open the block storage mount point.
- Files stored on the block storage volume display, open the
sample.txt
file to confirm read access. - Upload files to the directory to confirm write access.
5. Setup Nextcloud with Rcs Object Storage
- Copy the Rcs Object Storage hostname.
- Copy your object storage Access and Secret Keys.
- Through a web browser, visit your domain and Login to Nextcloud.
- Enable the External Storage App if not already enabled.
- Navigate to Settings, and access External Storage under the Administration section.
- Click Add Storage and select Amazon S3 from the drop-down list.
- Enter your Bucket name, Hostname as displayed on your Object Storage instance panel, enable SSL and leave the Port, Region fields blank.
- Toggle the Authentication drop down and select Access Key.
- Paste the Access Key, and Secret Key as copied from your Rcs Object Storage instance panel.
- For easy identification, change the Folder name to Rcs Object Storage or your preferred custom label.
- Click the checkmark symbol ✓ to save changes.
- A green tick ✅ indicates that your Rcs Object Storage is successfully connected.
6. Test the Object Storage
- Navigate to Files.
- Open the Rcs Object Storage directory (as set earlier), or, navigate to External Storage and select your S3 object storage.
- Upload or create a sample file in the directory.
- Log in to your Rcs account, open the Object Storage panel, and confirm that the new file is available in your bucket.
7. More Information
You have successfully configured Nextcloud to use Rcs Block Storage and Object Storage volumes. You can connect multiple volumes to store different files per attachment. For more information, please visit the following resources.