Nextcloud

Aus WIKI
Zur Navigation springen Zur Suche springen

nextcloud installieren emerge -av nextcloud

Datenbank-Nutzer in mariadb anlegen

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
CREATE DATABASE IF NOT EXISTS nextcloud;
GRANT ALL PRIVILEGES ON nextcloud.* TO 'username'@'localhost' IDENTIFIED BY 'password';

Firewall probleme:

nextcloud versucht beim login nach hause zu telefonieren um genau zu sein nach https://apps.owncloud.com um zB neue versionen von apps anzeigen lassen zu können... Das versuch ich zu unterbinden in dem ich an der Methode viewApps() der Klasse settings/Controller/AppSettingsController ein wenig manipuliere.

        /**
         * @NoCSRFRequired
         * @param string $category
         * @return TemplateResponse
         */
        public function viewApps($category = '') {
                $categoryId = $this->getCategory($category);
                if ($categoryId === self::CAT_ENABLED) {
                        // Do not use an arbitrary input string, because we put the category in html
                        $category = 'enabled';
                }

                $params = [];
                $params['experimentalEnabled'] = $this->config->getSystemValue('appstore.experimental.enabled', false);
                $params['category'] = $category;
                $params['appstoreEnabled'] = $this->config->getSystemValue('appstoreenabled', true) === true;
                $this->navigationManager->setActiveEntry('core_apps');

                $templateResponse = new TemplateResponse($this->appName, 'apps', $params, 'user');
                $policy = new ContentSecurityPolicy();
//              $policy->addAllowedImageDomain('https://apps.owncloud.com');
                $templateResponse->setContentSecurityPolicy($policy);

                return $templateResponse;
        }

nextcloude 11 hab ich ein wenig anpassen müssen das curl eine port range local benutzt. dazu musste ich die Datei 3rdparty/guzzlehttp/ringphp/src/client/CurlFactory.php wie folgt anpassen:

    public function __invoke(array $request, $handle = null)
    {
        $headers = [];
        $options = $this->getDefaultOptions($request, $headers);

        // my modifications
        $options[CURLOPT_LOCALPORT]=60000;
        $options[CURLOPT_LOCALPORTRANGE]=100;

        $this->applyMethod($request, $options);

        if (isset($request['client'])) {
            $this->applyHandlerOptions($request, $options);
        }

        $this->applyHeaders($request, $options);
        unset($options['_headers']);

        // Add handler options from the request's configuration options
        if (isset($request['client']['curl'])) {
            $options = $this->applyCustomCurlOptions(
                $request['client']['curl'],
                $options
            );
        }

        if (!$handle) {
            $handle = curl_init();
        }

        $body = $this->getOutputBody($request, $options);
        curl_setopt_array($handle, $options);

        return [$handle, &$headers, $body];
    }

Upload size vergrößern in Datei .htaccess:

php_value upload_max_filesize 2G
php_value post_max_size 2G
php_value memory_limit 2G

php_value max_input_time 3600
php_value max_execution_time 3600

Nextcloud über Portrange nach aussen komunizieren lassen über Datei 3rdparty/guzzlehttp/ringphp/src/Client/CurlFactory.php

$options = $this->getDefaultOptions($request, $headers);
$options[CURLOPT_LOCALPORT]=60000;
$options[CURLOPT_LOCALPORTRANGE]=100;

Backup anlegen

cd /var/www/nextcloud
sudo -u www-data php occ maintenance:mode --on
tar -cpzf /mnt/Share/Backups/Nextcloud/NextcloudBackup_FileDir_`date +"%Y%m%d"`.tar.gz -C /var/www/nextcloud .
tar -cpzf /mnt/Share/Backups/Nextcloud/NextcloudBackup_DataDir_`date +"%Y%m%d"`.tar.gz -C /var/nextcloud_data .
mysqldump --single-transaction -h localhost -u nextcloud_db_user -p nextcloud_db > /mnt/Share/Backups/Nextcloud/NextcloudBackup_DB_`date +"%Y%m%d"`.sql
cd /var/www/nextcloud
sudo -u www-data php occ maintenance:mode --off

Der Papierkorb konnte nicht mehr geöffnet werden unter "Gelöschte Dateien" => manuell konnte ich den Papierkorb mit dem folgenden Befehl bereinigen

sudo -u apache php occ trashbin:cleanup --all-users

nicht mehr aktuelle versionen von allen Dateien bereinigen

sudo -u apache php occ version:cleanup

[unter ubuntu 22.04 installieren]

[verschlüsselung]