Complete NC Installation on Debian 9 Stretch and manual update


Hi. Thank for this guide.
After the command

sudo -u www-data php occ maintenance:install --database "mysql" --database-name "nextcloud" --database-user "nextcloud" --database-pass "MYPASS" --admin-user "ncadmin" --admin-pass "MYPASS"

I received this Error

Nextcloud is not installed - only a limited number of commands are available
Error while trying to create admin user: An exception occurred while executing 'SHOW FULL TABLES WHERE Table_type = 'BASE TABLE'':

SQLSTATE[HY000]: General error: 1018 Can't read dir of './nextcloud/' (errno: 13 "Permission denied")

Any help, please?
Raspbian stretch on RPi 2
Edit: I’m running the command from nextcloud dir


sounds to me like a permission issue. so or your /var/lib/mysql doesnt have the correct permissions i believe should be

chown mysql:mysql /var/lib/mysql -R

Since its a sql command that fails with the error. You could also check what user is running mysql. This should also be mysql

ps -e | grep mysql (more mariadb)

And otherwise it could be permissions on the /var/www/nextcloud folder.

chown www-data:www-data /var/www/nextcloud -R


@SyS0p3r : Many thanks for your guide - Nextcloud 13 is working like a charm. Do you have any plans on updating the guide for webrtc? I’ve installed the Nextcloud Talk application, but unfortunstely it’s not working. I only receive a black screen on both devices. :frowning:

Best regards


sorry, at the moment there are no plans. i’m a bit to busy at the moment. you could try to use the webrtc part from my previous guide. it might just work.


@SyS0p3r : Thanks for your quick response! :slight_smile: I have already read your guide on setting up - however - as nextcloud created it’s own application, the integration might become obsolete within the next upcoming release(s). Have a great day! Kamekun


Besides Talk App you usually need a TURN server e.g. coturn and configure it accordingly. The configuration that was working with is also valid for Nextcloud Talk:


@MichaIng : Many thanks for the issue on github. I’ll try to setup coturn by the end of the week, as I’m currently on a business trip. Have a great day & best wishes, Kamekun


I’m trying to install Nextcloud using this guide, but I’m stranded with an SSL error.
Apache will not start

AH00526: Syntax error on line 32 of /etc/apache2/sites-enabled/default-ssl.conf:
SSLCertificateFile: file ‘/etc/ssl/certs/ssl-cert-snakeoil.pem’ does not exist or is empty

The file does not exist.


the error almost always is exactly what is wrong. does the file exist at the given path? if you follow the guide to the letter u should have

mkdir /etc/apache2/ssl
cd /etc/apache2/ssl
openssl req -new -x509 -days 365 -nodes -out /etc/apache2/ssl/apache.pem -keyout /etc/apache2/ssl/apache.key

and use the nextcloud.conf provided.

cd /etc/apache2/sites-available/
mv download nextcloud.conf

and maybe just rename the default-ssl.conf to default-ssl.conf.bak if you dont have any other specific site configs in it.


I am too still seeing the default apache2 page. I follow the guide to the letter, except for the let’sencrypts that I fixed later. Removing the other configs is not a good idea because then nothing works:

david@cloud:/etc/apache2/sites-available$ ls
000-default.conf  default-ssl.conf  nextcloud.conf
david@cloud:/etc/apache2/sites-available$ sudo mv default-ssl.conf default-ssl.conf.bak
david@cloud:/etc/apache2/sites-available$ sudo mv 000-default.conf 000-default.conf.bak
david@cloud:/etc/apache2/sites-available$ ls
000-default.conf.bak  default-ssl.conf.bak  nextcloud.conf
david@cloud:/etc/apache2/sites-available$ sudo systemctl restart apache2
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.

And nothing gets displayed.

Apparently, the way you described to obtain the certificate is deprecated. I followed this instead:
How to get certificate with Letsencrypt using DNS to verify domain
The only way I could see it working was by adding the lines for the cert to the default-ssl.conf too because that’s the only one that gets served now.

Could you help me?

EDIT: solved, see below. Thanks

david@cloud:/etc/apache2/sites-available$ sudo a2ensite nextcloud.conf 
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LANG = "en_GB.UTF-8"
	are supported and installed on your system.
perl: warning: [as above]
Site 000-default disabled.
To activate the new configuration, you need to run:
  systemctl reload apache2
david@cloud:/etc/apache2/sites-available$ sudo a2dissite default-ssl.conf
perl: warning: [as above]
Site default-ssl disabled.
To activate the new configuration, you need to run:
  systemctl reload apache2
david@cloud:/etc/apache2/sites-available$ sudo service apache2 reload

To fix locales:

sudo apt install locales
sudo /usr/sbin/dpkg-reconfigure locales



Are there any changes needed for Ubuntu? I know they’re quite similar and following your guide seems to end up installing both php7.2 and php7.1 on Ubuntu due to the mcrypt package (which is apparently deprecated in 7.2).

Is this necessary to run the install or to have any features?



Joined to say thanks for the guide as it worked perfectly. Do you have a BTC address to donate a beer?



Hi nashichassoulas.

Thanks for the great feedback. Glad the guide worked for you. All donations are welcome :slight_smile: the BTC address is 13UZVReLLLCa1iPhziBa7diJGCS34Hunwd


Download not available anymore :confused:


Link in original howto works. In some of the reply messages there are old links. The one below must work


if you see this problem check
main config file /etc/apache/apache2.conf should be

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All

(was AllowOverride None)



Many thanks for the guide, I had no issue at all and it worked soon as it should.
One question: How can I update to php7.2. Do you have a guide for that too?


try this instruction. Looks like it should do the trick!


Hi Erik

thank you for the guide for php 7.2. I am not sure if I have to care with nextcloud if I update to php 7.2. Do you know about something I should care?

Thank you again for the nextcloud guide.



The most important is to update from 5.6 to 7.x. But i always try to update php to the latest version within a week after the last version comes out. Latest versions have security and performance patches but some times also create new security issues. so best to update, but do investigate before update.