Build your Nextcloud Server using one shell script

The initial script (install-nextcloud.sh) will install your self hosted Nextcloud within few minutes fully automated. Your server will be built of:

Fail2Ban (Nextcloud and SSH jails)

MariaDB

Nextcloud 13.0.2

NGINX 1.14

OpenSSL 1.1.0h

PHP 7.2.5

Redis-Server

self signed or Let’s Encrypt SSL using the second script

UFW (22, 80, 443)

The only precondition for the install-nextcloud.sh script is to use Ubuntu 18.04 LTS as your server OS. You will find a script for Ubuntu 16.04.4 LTS either, it is called install-nextcloud-Ubuntu16044LTS.sh. At least but optionally you may request a ssl certificate from letsencrypt by issuing the second script called “ssl-certificat.sh”.

Hey Carsten. First of all great work, though I cannot seem to get it to work (PINE64+ board with Ubuntu Xenial Minimal installed) as the browser returns an error (Unsecure connection).
Referring to the problem above I came up with a suggestion. Are you keen on developing a remove shell script for the whole install? I think it would help many.
Cheers.

No i won’t. But what is your problem in detail? Did you issue the second script or only the first? what errors were written in the log-files (e.g. nginx or letsencrypt or nextcloud.log) Please send me an emal with further informaion i will try to help you. OK? Cheers, Carsten

Hi Carsten,
Thanks for the script. I’ve tried this twice on digitalocean but all I get is HTTP ERROR 500 when trying to access in the browser. Went through the process, added ssl, and even edited trusted_domains in config.php to reflect the ip, and made sure overwrite.cli.url was pointing to the right domain in config.php. Still no luck.

I found the problem. For some reason, the script changes both the database name and username to nextcloud.example.com in config.php even though I entered just nextcloud. So it was a database error. Fixed it and everything works fine now.

Strange. The database will be set to nextcloud hard coded.CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
You were only asked for the name of the db-user and its password.
Maybe someting went wrong while editing the config.php?

I did enter ‘nextcloud’ for db-user. however, the first time i opened config.php, it had appended .example.com to db-user and db-name. I thought that was the way it should be until i checked the logs and found database connection errors.

Thank you very much for these manual, I have utilized your step-by-step guide before and now these scripts. Great work!
I came across a small issue on a new installation of Ubuntu Server 18.04 with the ssl-certificate.sh-script.

With “sh ./ssl-certificate.sh” i would always get the error ‘syntax error: “(” unexpected’. Only when omitting ‘sh’ and just enter ‘./ssl-certificate.sh’ the script would run without issue.

Just thought to mention this as a small thank you for your great work!