How to install NextCloud using Wasabi S3 as primary storage


Let’s look at how to install NextCloud using Wasabi S3 as primary storage.

This post assumes that you have some experience with setting up NextCloud. Therefore, we will not discuss configuring proxies, HTTPS and more. Instead, we will explore how you can set up a fresh NextCloud base install with Wasabi as the S3 primary storage on Docker. You can then follow your own steps to customize your NextCloud install further as needed.

What is NextCloud?

NextCloud allows you to share files in a similar way to Dropbox and Google Drive. NextCloud is, however, more than a file share! You can use it as a collaboration platform, and you can customize it with a wide selection of useful apps.

What is Wasabi?

Wasabi Hot Cloud Storage is an S3-compliant object store that offers an infinite amount of data affordably at about 80% less than AWS S3. Additionally, Wasabi does not charge for egress or API requests – meaning you don’t pay to access your data.

Why use NextCloud with Wasabi?

NextCloud can use a block store or an S3-compliant object store as primary storage.

Block storage is great for performance but can be costly. S3 object storage is slower and is optimized for a lower cost per GB. There are many object storage providers out there. AWS S3 is more costly. Backblaze B2, another provider, is less expensive, but their service is not fully S3 compliant.

Using Wasabi as the primary S3 object store will provide you with cheap, enterprise-grade, infinite data that has 11x9s data durability.

Before we get started

You will need to sign up for a Wasabi account at Note that Wasabi does not accept signups from Gmail and alike. 

You will need a Linux host that has ample bandwidth available. The more files you have, the more data you will use. Also, your instance must have space available to allow uploads to be stored temporarily. This guide will use Ubuntu 18-04+.

You will need to have access to a database server such as MySQL. NextCloud uses the database to store metadata that is required to reconstruct the file and folder structure of the data. You will be in serious trouble if something happens to the database.

Notes about your NextCloud database

I strongly recommended that you use a managed database such as AWS RDS.

AWS RDS provides automated backups and makes database recovery easy. AWS RDS also offers high availability, and the ability to upgrade when needed. This guide will use MySQL 8+. AWS RDS saved me many times!

Setup your NextCloud Wasabi bucket

Login to your Wasabi account and create your NextCloud Wasabi bucket.

You will need to:

  • Set a bucket name.
  • Choose a region that is close to your NextCloud instance.
  • Select the ‘suspend versioning’ property
  • Select the ‘suspend logging’ property

Create your NextCloud Wasabi bucket user

Create a NextCloud Wasabi bucket API user.

You will need to:

  • Set a username
  • Select the ‘programmatic access’ option.
  • Create a group for the user to belong too.
  • Give the user appropriate read and write permissions.

Remember to save the ‘Access Key’ and ‘Secret Key’. You will not be able to retrieve your secret key again.

Create your NextCloud MySQL database

Create your NextCloud MySQL database and database user.

You can use the following sample SQL script:

CREATE USER 'nxtcld-usr'@'%' IDENTIFIED BY 'my-password';
CREATE DATABASE IF NOT EXISTS nxtcld_db CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
GRANT ALL PRIVILEGES on nxtcld_db.* to 'nxtcld-usr'@'%';
FLUSH privileges;

You will need to change the database name, user and password to your preference.

Setup Docker on your Ubuntu host

First, update your existing list of packages:

sudo apt update

Next, install Docker:

sudo apt install

Next, install Docker Compose:

sudo apt install docker-compose

Finally, setup the Docker service to run at start-up:

sudo systemctl start docker
sudo systemctl enable docker 

You can run ‘sudo docker –version’ to see if Docker installed successfully.

Setup Portainer to make Docker a breeze

Portainer is a lightweight web user interface which allows you to manage your Docker host and containers easily. You don’t need to use Portainer if you are a proficient Docker user.

Portainer, Manage Containers

Create a Portainer volume:

sudo docker volume create portainer_data

Setup the Portainer container:

sudo docker run -d -p 8000:8000 -p 9000:9000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer

You should now be able to access Portainer via the browser on http://YourLinuxHost:9000. Note Portainer will ask you to set up an admin username and password for the Linux host.

Use Portainer to create your NextCloud stack

Create a NextCloud stack using the following:

version: '2'

     container_name: my-nextcloud
     image: nextcloud
      - 8080:80
      - /containers/my-nextcloud-apps:/var/www/html/apps
      - /containers/my-nextcloud-config:/var/www/html/config  
      - /containers/my-nextcloud-data:/var/www/html/data  
     restart: always 

Configure the S3 primary store for your NextCloud instance

This step must be completed before installing NextCloud. This shows you how you can install NextCloud using Wasabi S3 as primary storage on Docker

Open the ‘/containers/my-nextcloud-config‘ folder on your Linux host and create a file named: storage.config.php.

Add the following info into the storage.config.php file:

$CONFIG = array (
'objectstore' => array(
        'class' => '\\OC\\Files\\ObjectStore\\S3',
        'arguments' => array(
                'bucket' => 'my-nextcloud-bucket',
                'autocreate' => true,
                'key'    => 'BYQLD4LZGEXAMPLE',
                'secret' => 'dycOcoq6R9YwTVEXAMPLE',
                'hostname' => '',
                'region' => 'us-west-1',
                'port' => 443,
                'use_ssl' => true,

You will need to change the bucket name, hostname, region, key and secret as per your configuration.

You can use any one of the following Wasabi service URLs that matched your bucket configuration:

  • Wasabi US East 1 (N. Virginia): or
  • Wasabi US East 2 (N. Virginia):
  • Wasabi US West 1 (Oregon):
  • Wasabi EU Central 1 (Amsterdam):

Finally, make sure that the storage.config.php file has 644 permissions and is owned by the www-data user.

Open your browser and open http://YourLinuxHost:8080. You should be able to see the NextCloud setup page that looks something like this:

NextCloud, Setup

You will need to:

  • Enter a NextCloud admin user and password
  • Select ‘storage and database’
  • Keep the data folder value as: /var/www/html/data
  • Set the database type to ‘MySQL/MariaDB’
  • Enter your database user, password and database name.
  • Set the database host and port. Example:
  • Keep the default setting to install the default apps.

The install will take some time. Do not reload the page and wait for the following page to load:

This step will take a few minutes to complete.

NextCloud will load the following page once the installation is complete:

NextCloud, After Install

Your NextCloud Wasabi S3 Primary store will contain objects similar to this:

Wasabi, List Bucket Contents

Once you have confirmed that NextCloud is installed and that NextCloud is using Wasabi as the S3 primary store: Navigate to the ‘/containers/my-nextcloud-config‘ folder on your Linux host and edit the ‘config.php’ file.

Change the last line from:



'filelocking.enabled' => false,

Next steps

Your NextCloud is now configured to use Wasabi as the S3 primary store. But, you may notice a performance issue.

The performance of NextCloud will be heavily dependent on:

  • The number of cores and total memory available for the NextCloud application and database server. My preference is to provide no less than 2 cores and 2 Gb of RAM.
  • The speed of your network between NextCloud, the database and Wasabi. Your network performance should not be a problem if your NextCloud application and database server is in the Cloud. Most Cloud providers offer (at minimum) Gigabit networks with premium connectivity.
  • The availability of a Redis cache server. Redis is essential and will significantly improve NextCloud’s performance. Redis will also help reduce the number of queries to the database.
  • You using the ‘Preview Generator’ app in NextCloud and pre-generating image thumbnails.

All round, NextCloud works well, and the performance is quite good once the install is complete.

Let me know how your NextCloud install went and feel free to provide tips for other users.

Hi, my name is Anto! I am a cloud computing hobbyist! Give me anything to do with the cloud, and I am interested. I work for a Cloud computing company by day and as a Cloud computing hobbyist by night! My projects use PHP, NodeJs, Ubuntu, MySQL and of course Amazon Web Services. Hopefully, my blog aids your cloud journey! Feel free to post a comment and share your thoughts.

3 Comments on “How to install NextCloud using Wasabi S3 as primary storage”

  1. Hello ,
    Thanks for your great post. I followed this guide uptill the Nextcloud installation page but the MYSQL was throwing errors and I hit a road block.
    I will appreciate your help perhaps pay to fix this remotely.

    1. Happy to see that you like my guide. Let me know the error you are getting and provide perhaps some screenshot.

      I will email you will my contact details.

Leave a Reply

Your email address will not be published. Required fields are marked *