How to reinstall Nextcloud

Hi! I managed to break Nextcloud. I unselected it from the packages list. And then later selected it again. But it does not come up again. What can I do in order to reinstall it?
There is no problem if Nextcloud data is lost. I also dont remember my Nextcloud admin password.

I got Nextcloud back again by reverting to a snapshot of the Turris router.
Now I am back at the initial problem, that I can’t login to Nextcloud due to invalid credentials.

I tried the following command:
sudo -u nobody php-cli /srv/www/nextcloud/occ user:resetpassword admin
using both admin and the user I thought I had on the Nextcloud and in both cases I got a “User does not exists” error.

How can I see which users are available in the Nextcloud?
How can I add a new admin user?

root@omnia2020:~# nextcloud_install
You seem to have Nextcloud already installed.
If you want to continue, please delete file

/srv/www/nextcloud/config/config.php

Also drop Nextcloud database and user from your database.
For example using the following commands inside MySQL console

DROP DATABASE nextcloud;
DROP USER 'nextcloud'@'localhost';
DROP USER 'nextcloud'@'127.0.0.1';

You can enter MySQL console using ‘mysql -u root’ command

WARNING: This will delete all your data from Nextcloud!!

Thank you, Nones,

This helped resetting Nextcloud and now I get the possibility to set up Nextcloud under
http://turris.local/nextcloud/

Do I have to input something particular for:
data folder
Database user
Database password
Database name
localhost

or can I input anything in these fields?
I guess that I can leave the data folder: /srv/www/nextcloud/data
As localhost I can leave it localhost
But what about Database user, password, and name?

Best regards
Hristo

There is the script “nextcloud_install” which should help you …

Try to run it.

I ran it. After that I still get the front end that asks for database details:
Nextcloud

Then just in case I did again:

rm /srv/www/nextcloud/config/config.php
mysql -u root
DROP DATABASE nextcloud;
DROP USER 'nextcloud'@'localhost';
DROP USER 'nextcloud'@'127.0.0.1';

The result is that I still get the same frontend and don’t know what info to input there.
Note that in this frontend I already have the prompt for admin account creation (it is above the area from the screenshot).

Step by step:

  1. move /srv/www/nextcloud/data/admin folder to the backup location
  2. move /srv/www/nextcloud/config/config.php to the backup location
  3. login to the mysql as a root user “mysql -u root”
  4. apply commands:
    DROP DATABASE nextcloud;
    DROP USER ‘nextcloud’@‘localhost’;
    DROP USER ‘nextcloud’@‘127.0.0.1’;
  5. run the script “nextcloud_install” and follow instruction

I have no idea why, but this time it worked out despite of errors and warnings.
Thank you very much. I attach the logs, that might be helpful for somebody.

root@turris:~# ls -a /srv/www/nextcloud/data/admin
ls: /srv/www/nextcloud/data/admin: No such file or directory
root@turris:~# ls -a /srv/www/nextcloud/config/
.                  .htaccess          config.php
..                 CAN_INSTALL        config.sample.php
root@turris:~# mv /srv/www/nextcloud/config/config.php ~/
root@turris:~# mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 181
Server version: 10.4.21-MariaDB Source distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> DROP DATABASE nextcloud;
ERROR 1008 (HY000): Can't drop database 'nextcloud'; database doesn't exist
MariaDB [(none)]> DROP USER 'nextcloud'@'localhost';
ERROR 1396 (HY000): Operation DROP USER failed for 'nextcloud'@'localhost'
MariaDB [(none)]> DROP USER 'nextcloud'@'127.0.0.1';
ERROR 1396 (HY000): Operation DROP USER failed for 'nextcloud'@'127.0.0.1'
MariaDB [(none)]> quit;
Bye
root@turris:~# nextcloud_install
This script will setup Nextcloud for you automatically.
It will try to create MySQL database, change files on your filesystem and more.
If you know what you are doing, you can set it up manually.
This script is meant to help beginners to get started fast.

If you are sure you want to continue with simplified automatic setup, type uppercase yes

YES
2022-09-05 18:04:43 0 [Warning] Could not open mysql.plugin table. Some options may be missing from the help text
2022-09-05 18:04:43 0 [Warning] Could not open mysql.plugin table. Some options may be missing from the help text
2022-09-05 18:04:43 0 [Warning] Could not open mysql.plugin table. Some options may be missing from the help text
2022-09-05 18:04:43 0 [Warning] Could not open mysql.plugin table. Some options may be missing from the help text
What should be admins login?
<MyAdminUsername>
What should be admins password?
<MyAdminPassword>

Nextcloud was successfully installed
System config value updatechecker set to boolean false
System config value trusted_domains => 1 set to string <local IP>/24
System config value trusted_domains => 2 set to string turris.local
Your Nextcloud installation should be available at http://<local IP>/24/nextcloud

root@turris:~# reboot

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.