In this tutorial, you will learn how to deploy your Nextcloud server and configure it to store to an object storage service that supports the Amazon S3 APIs.
Before starting, you will need to have the following ready and setup:
Log in to the server and install the snappy packaging system (preinstalled already for Ubuntu 16.04). Then install Nextcloud with snappy (as root or sudo user).
sudo apt-get update sudo apt-get install snappy # (only if you’re using below Ubuntu 16.04) Sudo snap install Nextcloud
Create the admin user
After completing the installation (which may take time) of Nextcloud, you have to setup an administrator for the cloud service.
sudo nextcloud.manual-install <your_name> <password>
You will see
“Successfully Installed” notice after this.
Setting the Hostname
Adding your hostname or IP to the configuration file will give access to the server from outside, so this step is necessary. If you installed the server with snappy, then the configuration file for the Nextcloud server will be at
Open that file with your preferred text editor, you will find many settings with the following array structure:
<?php $CONFIG = array ( <settings here> );
There is an option for the hostnames:
'trusted_domains' => array ( 0 => 'localhost', ),
With this set, you will only be able to access the web interface of Nextcloud with the localhost hostname only, to add your hostname
<your_domain>.com or whatever, or even your public IP address in case you don’t have a domain name, add an entry to the array:
'trusted_domains' => array ( 0 => 'localhost', 1 => 'example.com', ),
Save the file and exit.
Wait for a minute for the configurations to take effect and then on your local computer browser, visit the site with your hostname or IP address, you should see the login page for Nextcloud.
If you see this page then congratulations, your Nextcloud server is setup correctly. Login with your admin username and password and explore the system.
There are clients for all major desktop and mobile systems for Nextcloud. Visit their site and install them.
Changing the primary storage
By default, the Nextcloud server is configured to save your data to a local block storage drive (on the server running Nextcloud), you will find the sample files at
We will change the primary storage option to point to an object storage service, object stores are much cheaper and faster to read from (for the distributed caching mechanism). You can read more about object storage and how it differs from typical block storage drives from here.
Go to the same configuration file at
/var/snap/nextcloud/3680/nextcloud/config/config.php, and add the folloing setting to the main array:
'objectstore' => array( 'class' => 'OC\\Files\\ObjectStore\\S3', 'arguments' => array( 'bucket' => 'nextcloud', 'autocreate' => true, 'key' => 'EJ39ITYZEUH5BGWDRUFY', 'secret' => 'M5MrXTRjkyMaxXPe2FRXMTfTfbKEnZCu+7uRTVSj', 'hostname' => 'example.com', 'port' => 1234, 'use_ssl' => true, 'region' => 'optional', // required for some non amazon s3 implementations 'use_path_style'=>true ), ),
A new option
“objectstore” is added to the array, this will setup a connection to an object store that supports the Amazon S3 API using an access key.
Prior to this, you will need to deploy an access key to your object storage service provider, and copy the access key and secret to the config file.
After this, Nextcloud will be connecting to your object store to read and write data.
Now you’ve setup your own cloud storage service on your own server, data you store are kept at a higher privacy than using other clients like Dropbox. You’ll find that this way is a lot cheaper if you’re paying for extra storage on other providers. This could be a storage solution for many users on your home or work.