NextCloud Installation

Secure & Optimized Install Script

NextCloud with Infinite Storage

Optimized NextCloud deployment with infinitely scalable storage
and office, webmail, and single sign on integrations.

NextCloud logoNextCloud is an open source Dropbox alternative that provides a self-hosted file sync and share solution for on-premise or cloud environments. Given growing privacy concerns, many users prefer to know exactly where their data is stored, and how it is handled. Getting started is a little bit more involved than simply downloading Dropbox, Google Drive or OneDrive, so its important to understand the recommended system requirements:

  • Red Hat Enterprise Linux 7 / Ubuntu 16.04 LTS
  • MySQL/MariaDB
  • PHP 7.0 +
  • Apache 2.4 with mod_php

NextCloud screenshotSince Red Hat is a commercially supported OS, this guide is designed for Ubuntu 16.04. Your NextCloud server could be in your home or office, or with a cloud provider such as DigitalOcean (referral link, you get $50 free credit).

On-Premise Hardware Recommendations

  • Forward ports 80 and 443 from your NAT gateway (router) to your server’s IP address.
  • Assign the server a static IP address or DHCP reservation.
  • If you public (external) IP address is dynamic, set up a dynamic DNS service.
  • Ideally the server should be wired into your network with a Gigabit Ethernet connection, have a RAID 1 or 5 array and be connected to an uninterruptible power supply (UPS).

Hostname and DNS Settings

You should also have a hostname to access your NextCloud server from the Internet. While you can set up NextCloud with a bare IP address, Let’s Encrypt will not issue a SSL certificate without a domain or subdomain. You can register a domain name, use a subdomain of your existing domain or a free dynamic DNS service such as No-IP.

Before beginning the install, create an DNS ‘A’ record pointing the hostname at your external IP address, preferably with a low TTL (3600 or less). Clear your browser and DNS cache locally; If you’re using Google’s Public DNS service at 8.8.8.8, 4.4.4.4, flush the DNS cache there too.


NextCloud Installation and Optimization Scripts

With just a couple of commands, you can have an installed and optimized instance of NextCloud on any Ubuntu 16.04 server. These scripts follow the NextCloud performance optimization recommendations we published. We suggest going with a server that has at least 512 MB of RAM for 1 to 5 users, more if possible.

A Note About Security

We’re proud to encourage security by default. The resulting install from the HTTPS script earns an A+ on Qualy’s SSL Test and an A on NextCloud Security Scanner, provided you are using the latest version of NextCloud. The HTTP script should only be used for a local install, or if you plan to provide your own SSL certificate. 

Usage Instructions

Copy & paste the scripts from GitHub.
Remember to edit the user defined variables above # DO NOT EDIT

  • Check the latest version of NextCloud at https://nextcloud.com/install/.
  • Generate a long, secure MySQL root & user password using random.org.
  • For any instance intended to be accessed over the Internet, use the HTTPS script.

sudo su
nano installNextCloud-ssl.sh
nano optimizeNextCloud.sh
chmod +x installNextCloud-ssl.sh optimizeNextCloud.sh
./installNextCloud.sh

Complete the setup wizard at the NextCloud URL in a browser, then run the optimization script in the shell. 

./optimizeNextCloud.sh

Some installs may be affected by a NextCloud issue where some of the icons in the UI are missing. To correct this problem, visit ${nextcloud_url}/nextcloud/settings/apps and disable the Theming app. Refresh the page, then re-enable the Theming app.

Install NextCloud on HTTPS (recommended)

Install NextCloud on HTTP

NextCloud Optimization Script