AWS S3-based enterprise network file sharing using Nextcloud

David Clinton
Dec 13, 2017 · 11 min read

Hardware prerequisites

Hardware and software requirements for both recommended and minimal Nextcloud installations

Building a LAMP server

# apt install apache2 mariadb-server libapache2-mod-php7.0 \
php7.0-gd php7.0-json php7.0-mysql php7.0-curl php7.0-mbstring \
php7.0-intl php7.0-mcrypt php-imagick php7.0-xml php7.0-zip \
wget nano
 # apt install lamp-server^
# mysql_secure_installation 
MariaDB [(none)]> SET PASSWORD = PASSWORD(‘your-password’);
MariaDB [(none)]> update mysql.user set plugin = ‘mysql_native_password’ where User=’root’;

Apache configuration

# a2enmod rewrite
# a2enmod headers
Alias /nextcloud “/var/www/nextcloud/”<Directory /var/www/nextcloud/>
Options +FollowSymlinks
AllowOverride All
<IfModule mod_dav.c>
Dav off
SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud
<VirtualHost *:443> <1>
DocumentRoot /var/www/nextcloud
ServerAlias <2>
Apache reads configuration files in /etc/apache2/sites-enabled/ and uses their settings to redirect requests
# ln -s /etc/apache2/sites-available/nextcloud.conf \

Downloading and unpacking Nextcloud

Links to Nextcloud download archives: either the .tar.bz2 or the .zip formats will work
$ wget 
$ tar xjf nextcloud-12.0.0.tar.bz2
# cp -r nextcloud /var/www/ 
# chown -R www-data:www-data /var/www/nextcloud/
# systemctl restart apache2
# journalctl | tail
The main Nextcloud console, complete with sample folders and files — you can work with objects here just as you would using an OS file manager

Using AWS S3 as your primary Nextcloud storage

The list of currently available apps, including External storage support

Connect Nextcloud to an S3 bucket

$ aws s3 mb nextcloud32327
The External storages setup page for Amazon S3, showing a successful connection to my S3 bucket
$ aws s3 ls s3://nextcloud32327
$ aws s3 cp test.txt s3://nextcloud32327

David Clinton

Written by

Linux system admin and tech training content provider. Known to hang out at

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade