# Nextcloud sur NAS Synology



https://docs.nextcloud.com/server/18/admin_manual/index.html



#### Mise à jour 18.0.1 -> 18.0.3

```bash
bruno@DS916:/volume1/web/nextcloud $ sudo -u http /usr/local/bin/php73 updater/updater.phar
Nextcloud Updater - version: v16.0.3-3-ga0c2b25 dirty

Current version is 18.0.1.

Update to Nextcloud 18.0.3 available. (channel: "stable")
Following file will be downloaded automatically: https://download.nextcloud.com/server/releases/nextcloud-18.0.3.zip
Open changelog ↗

Steps that will be executed:
[ ] Check for expected files
[ ] Check for write permissions
[ ] Create backup
[ ] Downloading
[ ] Verify integrity
[ ] Extracting
[ ] Enable maintenance mode
[ ] Replace entry points
[ ] Delete old files
[ ] Move new files in place
[ ] Done

Start update? [y/N] y

Info: Pressing Ctrl-C will finish the currently running step and then stops the updater.

[✔] Check for expected files
[✔] Check for write permissions
[✔] Create backup
[✔] Downloading
[✔] Verify integrity
[✔] Extracting
[✔] Enable maintenance mode
[✔] Replace entry points
[✔] Delete old files
[✔] Move new files in place
[✔] Done

Update of code successful.

Should the "occ upgrade" command be executed? [Y/n] Y
This version of Nextcloud requires at least PHP 7.2<br/>You are currently running 5.6.11. Please update your PHP version.
Keep maintenance mode active? [y/N] ^C	# Ctrl-C
This version of Nextcloud requires at least PHP 7.2<br/>You are currently running 5.6.11. Please update your PHP version.
Maintenance mode is disabled

```

A *"Should the "occ upgrade" command be executed? [Y/n]"*, répondre Non.

La version par défaut de PHP est la 5.6.11, ce qui est insuffisant (7.2 requis). On relance la suite avec la bonne version de php:

```bash
bruno@DS916:/volume1/web/nextcloud $ sudo -u http /usr/local/bin/php73 occ maintenance:mode --on
Password:
The current PHP memory limit is below the recommended value of 512MB.
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Maintenance mode already enabled
```

```bash
bruno@DS916:/volume1/web/nextcloud $ sudo -u http /usr/local/bin/php73 occ upgrade
The current PHP memory limit is below the recommended value of 512MB.
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Set log level to debug
Updating database schema
Updated database
Checking for update of app accessibility in appstore
Checked for update of app "accessibility" in appstore
Checking for update of app activity in appstore
Checked for update of app "activity" in appstore
Checking for update of app admin_audit in appstore
Checked for update of app "admin_audit" in appstore
.../...
Checking for update of app viewer in appstore
Checked for update of app "viewer" in appstore
Checking for update of app workflowengine in appstore
Checked for update of app "workflowengine" in appstore
Starting code integrity check...
Finished code integrity check
Update successful
Maintenance mode is kept active
Reset log level
bruno@DS916:/volume1/web/nextcloud $ sudo -u http /usr/local/bin/php73 occ maintenance:mode --off
The current PHP memory limit is below the recommended value of 512MB.
Maintenance mode disabled
```



#### Mode maintenance:

```bash
bruno@DS916:/volume1/web/nextcloud $ sudo -u http /usr/local/bin/php73 occ maintenance:mode --on
Password:
The current PHP memory limit is below the recommended value of 512MB.
Maintenance mode enabled
```

#### Réparation:

```bash
bruno@DS916:/volume1/web/nextcloud $ sudo -u http /usr/local/bin/php73 occ maintenance:repair
Password:
The current PHP memory limit is below the recommended value of 512MB.
Nextcloud is in maintenance mode - no apps have been loaded

 - Repair MySQL collation
   - All tables already have the correct collation -> nothing to do
 - Repair mime types
 - Clean tags and favorites
   - 0 tags of deleted users have been removed.
   - 0 tags for delete files have been removed.
   - 0 tag entries for deleted tags have been removed.
   - 0 tags with no entries have been removed.
 - Repair invalid shares

.../...

```

#### Ajouter les index manquants à la base de donnée:

```bash
bruno@DS916:/volume1/web/nextcloud $ sudo -u http /usr/local/bin/php80 occ db:add-missing-indices
The current PHP memory limit is below the recommended value of 512MB.
Check indices of the share table.
Check indices of the filecache table.
Check indices of the twofactor_providers table.
Check indices of the login_flow_v2 table.
Check indices of the whats_new table.
Check indices of the cards table.
Check indices of the cards_properties table.
Check indices of the calendarobjects_props table.
Adding calendarobject_calid_index index to the calendarobjects_props table, this can take some time...
calendarobjects_props table updated successfully.
Check indices of the schedulingobjects table.
Adding schedulobj_principuri_index index to the schedulingobjects table, this can take some time...
schedulingobjects table updated successfully.
```

#### Quitter le mode maintenance:

```bash
bruno@DS916:/volume1/web/nextcloud $ sudo -u http /usr/local/bin/php80 occ maintenance:mode --off
Password:
The current PHP memory limit is below the recommended value of 512MB.
Maintenance mode disabled
```



Ajouter les 2 lignes suivantes au `/usr/local/etc/apache22/sites-enabled/httpd.conf`

```bash
Redirect 301 /.well-known/carddav /nextcloud/remote.php/dav
Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav
```

puis redémarrer Apache:

```bash
$ sudo stop pkg-apache22
pkg-apache22 stop/waiting
$ sudo start pkg-apache22
pkg-apache22 start/running, process 16823

$ reload pkg-apache22
```



#### Exécuter les taches cron de Nextcloud :

<u>Webcron:</u> [cron-job.org](https://cron-job.org/en/)

<u>Planificateur de taches Synology:</u>

Tache planifiée -> script défini par l'utilisateur:

- Utilisateur: root
- Programmer: Quotidienne
- Exécuter la commande: `sudo -u http /usr/local/bin/php73 -f /volume1/web/nextcloud/cron.php`

<u>Crontab:</u>

```bash
$ sudo -i
# Edit /etc/crontab

$ nano /etc/crontab
#minute    hour    mday    month    wday    who    command
49    0    *    *    2    root    /usr/local/bin/php73 -f /volume1/web/nextcloud/cron.php

49/TAB/0/TAB/*/TAB/*/TAB/2/TAB/root/TAB/commande

#Restart the cron deamon by typing:
$synoservice -restart crond
```



<u>Tester la tache dans le terminal:</u>

```bash
# ok
sudo -u http /usr/local/bin/php73 -f /volume1/web/nextcloud/cron.php
```





 [Installer Nextcloud en ligne de commande](../../Divers/nextcloud.md) 

 [Nextcloud sur VPS/Plesk](../../Plesk/nextcloud.md) 

