This blog is NOT OFFICIAL website of Kali Linux. We just share Tutorials to learn Cybersecurity.

Expanding your Nextcloud instance using Linode's NVMe-backed Block Storage

Expanding your Nextcloud instance using Linode's NVMe-backed Block Storage

By Gardiner Bryant, President Heavy Element

Nextcloud is a very popular self-hosted alternative to Dropbox, Google Drive, and other cloud hosting providers. It's not only the go-to choice for individuals, either. Nextcloud has a number of enterprise-level deployments.

Nextcloud using Linode
$100 Credit / 60 days free Trial

Given the above, we decided to install Nextcloud on a Linode Dedicated CPU and see just what it would take to configure it to use Linode's new NVMe-backed block storage. This article was the result.

The first challenge is setting up an instance of Nextcloud. There are any number of ways to do this: One could install and configure a web server and a PHP environment by hand. This has the advantage of low overhead, but will mean that you'll need to harden your Linode against common Nextcloud and PHP vulnerabilities. Plus, it will require you to apply any optimizations like Redis or other such memcaches yourself.

Alternatively, you could pull down a premade Docker image from Nextcloud which should handle a lot of these things itself. But Docker can be a rather cumbersome tool and that still leaves a ton of configuration for you to do with reverse proxies.

There's also the Nextcloud snap package, however I wouldn't touch that with a ten foot pole.

Finally, after some waffling, I decided to go with Linode's One Click installer. A pre-made image of Debian 10 that automatically provisions everything you'll need to run a Nextcloud instance. Even going so far as to do some basic hardening, such as installing Fail2Ban to protect against bruteforce attacks.

The process couldn't be simpler. Open up the Linode Cloud Manager and select Marketplace on the left hand side of the screen. Then select Nextcloud from the list of available applications. Fill in your information like the Nextcloud administrative username and password, then the database password. Choose a datacenter, then choose a password for your OS. Finally, click "Create" and wait for the Linode to provision and the Nextcloud install script to finish.

So now that we've got Nextcloud ready to go, we can indeed confirm it's accessible by navigating to the /nextcloud directory on our Linode's IP address. E.g: 56.46.22.145/nextcloud 

Hold on, though. While we've got our Linode instance set up, we haven't yet configured it to utilize our block storage.

To do that, we need to first create a Volume. Let's do that by clicking "Volumes" and then hit the "Choose Volume" button. Fill in the form here by providing a name, volume size, region (which must be the same region in which your Nextcloud instance lives), choose your Nextcloud instance, and add an optional tag or two to keep things organized.

Once you've done this, hit the Create Volume button. It will immediately attach to your Nextcloud instance and the Cloud Manager will prompt you with some commands that you'll want to run via SSH.

So let's do that. Open a terminal on Linux or macOS or Powershell on Windows 10/11 and type in ssh root@<linodes ip addres>. This will allow you to log in. From here, we'll execute the first command to create a filesystem for volume we've created. In this instance we're using ext4.

Next, we'll create a mount point for our filesystem. For the sake of this article, let's say /mnt/nextcloud-data, however you can set it to be anywhere.

Next, we will mount the volume to the mount point. And finally, we'll add the final code snippet to our Linode's /etc/fstab so this volume is mounted in the same place in our filesystem after every boot.

We're almost set up, now. The last thing we should do is move the files in /var/www/nextcloud/data to our block storage. This can be done with mv -R /var/www/nextcloud/data/* /mnt/nextcloud-data. Let's also make sure that .htaccess and .ocfiles have been moved to from /var/www/nextcloud/data to /mnt/nextcloud-data as well:

mv /var/www/nextcloud/data/.ocfiles /mnt/nextcloud-data/
mv /var/www/nextcloud/data/.htaccess /mnt/nextcloud-data/

Then chown www-data:www-data -R /mnt/nextcloud-data to change the file permissions back to the web server.

The last step we need to take is telling our Nextcloud configuration where to find the block storage. Let's run nano /var/www/nextcloud/config/config.php and modify the datadirectory entry to point to /mnt/nextcloud-data.

Once we save (using `CTRL+S`) quit nano (using `CTRL+X`), we should be good to go!

Linode has awesome services, if you go through our Linode Sign up link then you will get $100 in credit and 60 days free trail with a valid credit card.

author-img
Kali Linux

Comments

1 comment
Post a Comment
  • AnonymousJuly 18, 2022 at 6:17 PM

    Musharraf Siddiq

    Delete Comment
    google-playkhamsatmostaqltradent