I build nextcloud-server package for three Debian release (stretch, buster and bullseye).

Steps for install:

1. Install database (in my example I use PostgreSQL):

apt-get install postgresql

2. Create database,user on database:

su - postgres
psql
CREATE DATABASE nextcloud;
CREATE USER nextuser WITH PASSWORD 'HereSomeGoodPassword';
GRANT ALL PRIVILEGES ON DATABASE nextcloud to nextuser;
\q

3. Add repository & keyring:

echo 'deb http://apt.jurisic.org/debian/ bullseye main contrib non-free' >> /etc/apt/sources.list.d/jurisic.list
wget -q http://apt.jurisic.org/Release.key -O- | apt-key add -
apt-get install nextcloud-server

4. Enable ssl for apache2:

The default installation of Nextcloud is not secured by SSL. To enable SSL in your webserver, run these commands:

a2enmod ssl
a2ensite default-ssl
service apache2 restart

You will probably get a SSL warning, this warning should be accepted. To avoid such warnings, get a free signed SSL certificate from LetsEncrypt.

5. Nextcloud web installer:

When the shell part of the installation is finished, proceed by opening the Nextcloud web installer in your browser. The URL is http://[YOURIP]/nextcloud

Enter the desired administrator username and password in the login fields. Please choose a secure password and also a username that is not "admin" or "administrator" might be a good choice to make it less easy for attackers to guess your admin login.

Nextcloud is using sqlite as storage engine by default. This is not a good choice performace wise, so I will choose PostgreSQL as database backend. We have created a PostgreSQL database above, enter the details of that database now:

  • Username:         nextuser
  • Password:          The password that you have choosen for the database.
  • Database name: nextcloud
  • Hostname:         localhost

Then click on the button to finish the installation. You will get greeted with a welcome screen.