Update format

This commit is contained in:
RealStickman 2023-02-19 15:29:32 +01:00
parent e0651eea6c
commit 9913447ba2

View File

@ -4,38 +4,59 @@ visible: true
--- ---
[toc] [toc]
## Installation ## Installation
Nextcloud will be using apache
`# apt install mlocate apache2 libapache2-mod-php mariadb-client mariadb-server wget unzip bzip2 curl php php-common php-curl php-gd php-mbstring php-mysql php-xml php-zip php-intl php-apcu php-redis php-bcmath php-gmp php-imagick`
Not found: `php-http-request python-certbot-apache` Nextcloud will be using apache
No password set ```sh
`# mariadb -u root -p` apt install mlocate apache2 libapache2-mod-php mariadb-client mariadb-server wget unzip bzip2 curl php php-common php-curl php-gd php-mbstring php-mysql php-xml php-zip php-intl php-apcu php-redis php-bcmath php-gmp php-imagick
`CREATE DATABASE nextcloud;`
For UTF8 support use this instead:
`"CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"`
`GRANT ALL ON nextcloud.* TO 'nextcloud'@'localhost' IDENTIFIED BY '<password>';`
`FLUSH PRIVILEGES;`
Exit the MariaDB prompt
Download Nextcloud into `/var/www`
`# wget https://download.nextcloud.com/server/releases/nextcloud-(version).tar.bz2`
`# tar -xf nextcloud-(version).tar.bz2`
Change owner to the apache user
`# chown -Rfv www-data:www-data /var/www/nextcloud`
Create nextcloud configuration for apache
`# vi /etc/apache2/sites-available/nextcloud.conf`
Configuration file
``` ```
Not found: `php-http-request python-certbot-apache`
No password set
```sh
mariadb -u root -p
```
```sql
CREATE DATABASE nextcloud;
```
For UTF8 support use this instead:
```sql
CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
GRANT ALL ON nextcloud.* TO 'nextcloud'@'localhost' IDENTIFIED BY '<password>';
FLUSH PRIVILEGES;
```
Exit the MariaDB prompt
Download Nextcloud into `/var/www`
```sh
wget https://download.nextcloud.com/server/releases/nextcloud-(version).tar.bz2
tar -xf nextcloud-(version).tar.bz2
```
Change owner to the apache user
```sh
chown -Rfv www-data:www-data /var/www/nextcloud
```
Create nextcloud configuration for apache
```sh
vi /etc/apache2/sites-available/nextcloud.conf
```
Configuration file
```apacheconf
<VirtualHost *:80> #specify listen ip addresses: (address):(port) for ipv4, [(address)]:(port) vor ipv6, *:80 for all <VirtualHost *:80> #specify listen ip addresses: (address):(port) for ipv4, [(address)]:(port) vor ipv6, *:80 for all
ServerAdmin webmaster@localhost ServerAdmin webmaster@localhost
DocumentRoot /var/www/nextcloud DocumentRoot /var/www/nextcloud
@ -60,32 +81,52 @@ Configuration file
</VirtualHost> </VirtualHost>
``` ```
Enable nextcloud and disable the default site Enable nextcloud and disable the default site
`# a2ensite nextcloud.conf && a2dissite 000-default.conf`
Edit `ports.conf` for apache2 to only bind the addresses you need ```sh
a2ensite nextcloud.conf && a2dissite 000-default.conf
```
`# systemctl restart apache2` Edit `ports.conf` for apache2 to only bind the addresses you need
```sh
systemctl restart apache2
```
### Cron ### Cron
To execute regular jobs, I personally use cron.
Edit `crontab` as the `www-data` user.
`sudo -u www-data crontab -e`
Add this following line: To execute regular jobs, I personally use cron.
`*/5 * * * * php -f (nextcloud dir)/cron.php` Edit `crontab` as the `www-data` user.
```sh
sudo -u www-data crontab -e
```
Add this following line:
```
*/5 * * * * php -f {NEXTCLOUD DIR}/cron.php
```
### Configuration ### Configuration
The main config file is `(nextcloud dir)/config/config.php`
The main config file is `{NEXTCLOUD DIR}/config/config.php`
#### Automatic Trash clearing #### Automatic Trash clearing
> [See this page](https://bayton.org/docs/nextcloud/nextcloud-hoarding-trash-how-to-force-automatic-removal-of-deleted-items/) for more options
> [See this page](https://bayton.org/docs/nextcloud/nextcloud-hoarding-trash-how-to-force-automatic-removal-of-deleted-items/) for more options
This settings keeps the files for 15 days, unless drive space is getting low. This settings keeps the files for 15 days, unless drive space is getting low.
In that case it delets them earlier. In that case it delets them earlier.
`'trashbin_retention_obligation' => 'auto, 15',`
```
'trashbin_retention_obligation' => 'auto, 15',
```
#### Trust Proxy #### Trust Proxy
This disables the warning of untrusted proxy in the webinterface.
This disables the warning of untrusted proxy in the webinterface.
``` ```
'trusted_proxies' => 'trusted_proxies' =>
array ( array (
@ -94,9 +135,11 @@ This disables the warning of untrusted proxy in the webinterface.
``` ```
#### Trusted Domains #### Trusted Domains
Array of trusted domains.
Array of trusted domains.
``` ```
'trusted_domains' => 'trusted_domains' =>
array ( array (
0 => '<domain 1>', 0 => '<domain 1>',
1 => '<domain 2>', 1 => '<domain 2>',
@ -104,23 +147,36 @@ Array of trusted domains.
``` ```
## Maintenance ## Maintenance
### Maintenance Mode
Enable maintenance mode to prevent data inconsistencies
`$ sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --on`
To disable maintenance mode again, run the same command with `--off` instead of `--on` ### Maintenance Mode
Enable maintenance mode to prevent data inconsistencies
```sh
sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --on
```
To disable maintenance mode again, run the same command with `--off` instead of `--on`
### Upgrade with CLI ### Upgrade with CLI
`$ sudo -u www-data php /var/www/nextcloud/updater/updater.phar`
```sh
sudo -u www-data php /var/www/nextcloud/updater/updater.phar
```
### Backup Database ### Backup Database
Dump database to file
`$ mysqldump --single-transaction -h [server] -u [username] -p[password] [db_name] > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak`
> [Official documentation](https://docs.nextcloud.com/server/latest/admin_manual/maintenance/backup.html) Dump database to file
```sh
mysqldump --single-transaction -h [server] -u [username] -p[password] [db_name] > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
```
> [Official documentation](https://docs.nextcloud.com/server/latest/admin_manual/maintenance/backup.html)
#### Backup Script #### Backup Script
```
```sh
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
@ -139,20 +195,24 @@ sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off
``` ```
### Restore Database ### Restore Database
```
```sh
mariadb -h $server -u $username -p$password -e "DROP DATABASE nextcloud" mariadb -h $server -u $username -p$password -e "DROP DATABASE nextcloud"
mariadb -h $server -u $username -p$password -e "CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci" mariadb -h $server -u $username -p$password -e "CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci"
``` ```
`$ mariadb -h $server -u $username -p$password $db_name < nextcloud-sqlbkp.bak` ```sh
mariadb -h $server -u $username -p$password $db_name < nextcloud-sqlbkp.bak
```
> [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/maintenance/restore.html) > [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/maintenance/restore.html)
## Collabora Online Container ## Collabora Online Container
> Unfinished > Unfinished
``` ```sh
# podman run -t -d --name collabora-online -p 9980:9980 \ podman run -t -d --name collabora-online -p 9980:9980 \
-e "extra_params=--o:ssl.enable=false" \ -e "extra_params=--o:ssl.enable=false" \
--restart always \ --restart always \
--label "io.containers.autoupdate=image" \ --label "io.containers.autoupdate=image" \
@ -160,10 +220,11 @@ mariadb -h $server -u $username -p$password -e "CREATE DATABASE nextcloud CHARA
``` ```
## Onlyoffice Container ## Onlyoffice Container
> Unfinished > Unfinished
``` ```sh
# podman run -it -d --name onlyoffice -p 9480:80 \ podman run -it -d --name onlyoffice -p 9480:80 \
--restart always \ --restart always \
--label "io.containers.autoupdate=image" \ --label "io.containers.autoupdate=image" \
docker.io/onlyoffice/documentserver:latest docker.io/onlyoffice/documentserver:latest