Author: Christian Kintu
Last Updated: Thu, Jun 9, 2022Nextcloud 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 Vultr's Block Storage and Object Storage to maximize the application's storage potential.
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
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 as vdc
, 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 type part
should display below the main vdb
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
Using a web browser of your choice, visit your domain.
https://cloud.example.com
Login to Nextcloud.
If you deployed Nextcloud as a OneClick Vultr 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.
sample.txt
file to confirm read access.You have successfully configured Nextcloud to use Vultr 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.