documentation:nextcloud_18.04
Differences
This shows you the differences between two versions of the page.
| documentation:nextcloud_18.04 [2020/02/01 12:35] – external edit 127.0.0.1 | documentation:nextcloud_18.04 [2020/02/02 14:14] (current) – removed lucid | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== NextCloud 14+ Install on Ubuntu 18.04.1 ====== | ||
| - | |||
| - | Prerequisite packages for NextCloud | ||
| - | |||
| - | < | ||
| - | $ sudo apt install php7.2-gd php7.2-json php7.2-mysql php7.2-curl php7.2-mbstring php7.2-fpm | ||
| - | $ sudo apt install php7.2-intl php-imagick php7.2-xml php7.2-zip php-mime-type | ||
| - | $ sudo apt install php7.2-gmp ffmpeg libexif-dev ufw | ||
| - | $ sudo apt install php-apcu php-redis redis-server</ | ||
| - | |||
| - | Download the nextcloud server file and matching sha256 from the official website | ||
| - | |||
| - | < | ||
| - | $ wget https:// | ||
| - | |||
| - | Verify the sha256 | ||
| - | |||
| - | < | ||
| - | |||
| - | Extract the tarball after verifying the file is valid | ||
| - | |||
| - | < | ||
| - | |||
| - | Copy the nextcloud folder to the webroot, in this case /var/www. | ||
| - | |||
| - | < | ||
| - | |||
| - | ===== Create the Database ===== | ||
| - | To start the MySQL command line mode use: | ||
| - | |||
| - | < | ||
| - | |||
| - | Then a mysql> or MariaDB [root]> prompt will appear. Now enter the following lines and confirm them with the enter key. **'' | ||
| - | |||
| - | < | ||
| - | CREATE DATABASE IF NOT EXISTS nextcloud; | ||
| - | GRANT ALL PRIVILEGES ON nextcloud.* TO ' | ||
| - | |||
| - | ===== Let's Encrypt ===== | ||
| - | |||
| - | For SSL use the EFF's PPA for the Let's Encrypt certbot. | ||
| - | |||
| - | < | ||
| - | $ sudo apt update; sudo apt upgrade | ||
| - | $ sudo apt install python-certbot-nginx | ||
| - | $ sudo certbot --nginx certonly</ | ||
| - | |||
| - | Cert and Key locations: | ||
| - | |||
| - | ''/ | ||
| - | |||
| - | ''/ | ||
| - | |||
| - | By default, a generic DH key is used which weakens the key exchange. Generate a non-generic Diffie-Hellman key with OpenSSL, the line in the Nginx configuration file has already been added in the config below. | ||
| - | |||
| - | < | ||
| - | |||
| - | ===== NGINX ===== | ||
| - | Create the nginx config, and fill with a base config. | ||
| - | |||
| - | < | ||
| - | |||
| - | < | ||
| - | server 127.0.0.1: | ||
| - | server unix:/ | ||
| - | } | ||
| - | |||
| - | server { | ||
| - | listen 80; | ||
| - | listen [::]:80; | ||
| - | server_name cloud.bagelbiter.cat; | ||
| - | # enforce https | ||
| - | return 301 https:// | ||
| - | } | ||
| - | |||
| - | server { | ||
| - | listen 443 ssl http2; | ||
| - | listen [::]:443 ssl http2; | ||
| - | server_name cloud.bagelbiter.cat; | ||
| - | |||
| - | ssl_certificate / | ||
| - | ssl_certificate_key / | ||
| - | ssl_session_timeout 5m; | ||
| - | ssl_ecdh_curve prime256v1; | ||
| - | ssl_session_tickets off; | ||
| - | ssl_ciphers ' | ||
| - | ssl_prefer_server_ciphers on; | ||
| - | ssl_protocols TLSv1.2; | ||
| - | ssl_dhparam / | ||
| - | |||
| - | # Add headers to serve security related headers | ||
| - | # Before enabling Strict-Transport-Security headers please read into this | ||
| - | # topic first. | ||
| - | add_header Strict-Transport-Security " | ||
| - | # | ||
| - | # WARNING: Only add the preload option once you read about | ||
| - | # the consequences in https:// | ||
| - | # will add the domain to a hardcoded list that is shipped | ||
| - | # in all major browsers and getting removed from this list | ||
| - | # could take several months. | ||
| - | add_header Referrer-Policy " | ||
| - | add_header X-Content-Type-Options " | ||
| - | add_header X-Download-Options " | ||
| - | #add_header X-Frame-Options " | ||
| - | add_header X-Permitted-Cross-Domain-Policies " | ||
| - | add_header X-Robots-Tag " | ||
| - | add_header X-XSS-Protection "1; mode=block" | ||
| - | |||
| - | # Remove X-Powered-By, | ||
| - | fastcgi_hide_header X-Powered-By; | ||
| - | # add_header X-Content-Type-Options nosniff; | ||
| - | # add_header X-XSS-Protection "1; mode=block"; | ||
| - | # add_header X-Robots-Tag none; | ||
| - | # add_header X-Download-Options noopen; | ||
| - | # add_header X-Permitted-Cross-Domain-Policies none; | ||
| - | # add_header Referrer-Policy no-referrer; | ||
| - | # add_header X-Frame-Options " | ||
| - | # #add_header Content-Security-Policy " | ||
| - | |||
| - | # Path to the root of your installation | ||
| - | root / | ||
| - | |||
| - | location = /robots.txt { | ||
| - | allow all; | ||
| - | log_not_found off; | ||
| - | access_log off; | ||
| - | } | ||
| - | |||
| - | # The following 2 rules are only needed for the user_webfinger app. | ||
| - | # Uncomment it if you're planning to use this app. | ||
| - | #rewrite ^/ | ||
| - | #rewrite ^/ | ||
| - | # last; | ||
| - | |||
| - | location = / | ||
| - | return 301 $scheme:// | ||
| - | } | ||
| - | location = / | ||
| - | return 301 $scheme:// | ||
| - | } | ||
| - | |||
| - | # set max upload size | ||
| - | client_max_body_size 512M; | ||
| - | fastcgi_buffers 64 4K; | ||
| - | |||
| - | # Enable gzip but do not remove ETag headers | ||
| - | gzip on; | ||
| - | gzip_vary on; | ||
| - | gzip_comp_level 4; | ||
| - | gzip_min_length 256; | ||
| - | gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; | ||
| - | gzip_types application/ | ||
| - | |||
| - | # Uncomment if your server is build with the ngx_pagespeed module | ||
| - | # This module is currently not supported. | ||
| - | #pagespeed off; | ||
| - | |||
| - | location / { | ||
| - | rewrite ^ /index.php; | ||
| - | } | ||
| - | |||
| - | location ~ ^/ | ||
| - | deny all; | ||
| - | } | ||
| - | location ~ ^/ | ||
| - | deny all; | ||
| - | } | ||
| - | |||
| - | location ~ ^/ | ||
| - | fastcgi_split_path_info ^(.+? | ||
| - | try_files $fastcgi_script_name =404; | ||
| - | include fastcgi_params; | ||
| - | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
| - | fastcgi_param PATH_INFO $fastcgi_path_info; | ||
| - | fastcgi_param HTTPS on; | ||
| - | #Avoid sending the security headers twice | ||
| - | fastcgi_param modHeadersAvailable true; | ||
| - | fastcgi_param front_controller_active true; | ||
| - | fastcgi_pass php-handler; | ||
| - | fastcgi_intercept_errors on; | ||
| - | fastcgi_request_buffering off; | ||
| - | } | ||
| - | |||
| - | location ~ ^/ | ||
| - | try_files $uri/ =404; | ||
| - | index index.php; | ||
| - | } | ||
| - | |||
| - | # Adding the cache control header for js and css files | ||
| - | # Make sure it is BELOW the PHP block | ||
| - | |||
| - | location ~ \.(?: | ||
| - | try_files $uri / | ||
| - | add_header Cache-Control " | ||
| - | # Add headers to serve security related headers (It is intended to | ||
| - | # have those duplicated to the ones above) | ||
| - | # Before enabling Strict-Transport-Security headers please read into | ||
| - | # this topic first. | ||
| - | add_header Strict-Transport-Security " | ||
| - | # | ||
| - | # WARNING: Only add the preload option once you read about | ||
| - | # the consequences in https:// | ||
| - | # will add the domain to a hardcoded list that is shipped | ||
| - | # in all major browsers and getting removed from this list | ||
| - | # could take several months. | ||
| - | add_header X-Content-Type-Options " | ||
| - | add_header X-XSS-Protection "1; mode=block" | ||
| - | add_header X-Robots-Tag " | ||
| - | add_header X-Download-Options " | ||
| - | add_header X-Permitted-Cross-Domain-Policies " | ||
| - | add_header Referrer-Policy " | ||
| - | #add_header X-Frame-Options " | ||
| - | # Optional: Don't log access to assets | ||
| - | access_log off; | ||
| - | } | ||
| - | |||
| - | location ~ \.(?: | ||
| - | try_files $uri / | ||
| - | # Optional: Don't log access to other assets | ||
| - | access_log off; | ||
| - | } | ||
| - | |||
| - | # Collabora Config | ||
| - | |||
| - | # static files | ||
| - | location ^~ /loleaflet { | ||
| - | proxy_pass https:// | ||
| - | proxy_set_header Host $http_host; | ||
| - | } | ||
| - | |||
| - | # WOPI discovery URL | ||
| - | location ^~ / | ||
| - | proxy_pass https:// | ||
| - | proxy_set_header Host $http_host; | ||
| - | } | ||
| - | |||
| - | # main websocket | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | } | ||
| - | |||
| - | # download, presentation and image upload | ||
| - | | ||
| - | | ||
| - | | ||
| - | } | ||
| - | |||
| - | # Admin Console websocket | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | } | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | Remove the default nginx config. | ||
| - | < | ||
| - | Allow access to web root for nginx. | ||
| - | < | ||
| - | Enable the configuration | ||
| - | < | ||
| - | |||
| - | ===== UFW ===== | ||
| - | You will need to restart to start ufw and enable the rules. | ||
| - | < | ||
| - | $ sudo ufw allow OpenSSH | ||
| - | $ sudo ufw enable | ||
| - | </ | ||
| - | |||
| - | ===== php-fpm configuration ===== | ||
| - | When you are using php-fpm, system environment variables like PATH, TMP or others are not automatically populated in the same way as when using php-cli. A PHP call like getenv(' | ||
| - | |||
| - | In the file ''/ | ||
| - | ''; | ||
| - | |||
| - | ===== PHP OPcache ===== | ||
| - | There is a built in caching function built for php called opcache. The configuration file for php is massively verbose, so just skip to the [opcache] section and copy in this config from the official documentation. | ||
| - | [''/ | ||
| - | < | ||
| - | opcache.enable=1 | ||
| - | opcache.enable_cli=1 | ||
| - | opcache.interned_strings_buffer=8 | ||
| - | opcache.max_accelerated_files=10000 | ||
| - | opcache.memory_consumption=128 | ||
| - | opcache.save_comments=1 | ||
| - | opcache.revalidate_freq=1 | ||
| - | </ | ||
| - | |||
| - | ===== Startup ===== | ||
| - | To start NextCloud nginx and php fpm. | ||
| - | < | ||
| - | $ sudo systemctl enable php7.2-fpm</ | ||
| - | |||
| - | Navigate to the FQDM (sub.domain.tld) and enter the necessary details. Afterwards, we can setup the caching server. | ||
| - | |||
| - | ===== MemCache: APCu and Redis ===== | ||
| - | Using a memory cache should improve the performance of the server. Using the [[https:// | ||
| - | |||
| - | All we need to do to get everthing working is add a few lines to the nextcloud config.php. | ||
| - | [''/ | ||
| - | < | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ), | ||
| - | </ | ||
| - | |||
| - | ===== Email Server ===== | ||
| - | Install the mailutils package by typing: | ||
| - | |||
| - | < | ||
| - | |||
| - | Near the end of the installation process, you will be presented with a dialog window with options on how to configure Postfix. Select the default option which is **Internet Site**. | ||
| - | |||
| - | After that, you'll get another dialog window requesting to enter the **System mail name** enter the same domain name as the server. | ||
| - | |||
| - | Now you will edit the main Postfix configuration file | ||
| - | < | ||
| - | |||
| - | With the file open, scroll down until you see the entries shown in this code block. | ||
| - | |||
| - | < | ||
| - | recipient_delimiter = + | ||
| - | inet_interfaces = all</ | ||
| - | |||
| - | Change the line that reads '' | ||
| - | |||
| - | < | ||
| - | recipient_delimiter = + | ||
| - | inet_interfaces = localhost</ | ||
| - | |||
| - | After that, restart Postfix by typing: | ||
| - | |||
| - | < | ||
| - | |||
| - | To send a test email, type: | ||
| - | |||
| - | < | ||
| - | |||
| - | If everything is working correctly you should receive an email from the server. | ||
| - | |||
| - | Source [[https:// | ||
| - | |||
| - | ====== Collabora ====== | ||
| - | Install the docker image | ||
| - | < | ||
| - | $ sudo systemctl enable docker | ||
| - | $ sudo docker pull collabora/ | ||
| - | $ sudo docker run -t -d -p 127.0.0.1: | ||
| - | |||
| - | Add this to the bottom of the main nextcloud server block ''/ | ||
| - | < | ||
| - | # Collabora Config | ||
| - | | ||
| - | # static files | ||
| - | location ^~ /loleaflet { | ||
| - | proxy_pass https:// | ||
| - | proxy_set_header Host $http_host; | ||
| - | } | ||
| - | |||
| - | # WOPI discovery URL | ||
| - | location ^~ / | ||
| - | proxy_pass https:// | ||
| - | proxy_set_header Host $http_host; | ||
| - | } | ||
| - | |||
| - | # main websocket | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | } | ||
| - | |||
| - | # download, presentation and image upload | ||
| - | | ||
| - | | ||
| - | | ||
| - | } | ||
| - | |||
| - | # Admin Console websocket | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | In the Nextcloud web interface under the admin account, go to Settings > Collabora Online and type in the domain name of the server ex: | ||
| - | |||
| - | ====== Talk ====== | ||
| - | To allow Talk sessions between firewall, a TURN needs to be installed on a separate server, it serves as a mid point for connecting two WebRTC sessions in NextCloud Talk, given that P2P and STUN connections fail beforehand (that is what the documentation says?). | ||
| - | Install coturn, an open source TURN server. | ||
| - | < | ||
| - | A firewall rule needs to be added to allow coturn to function | ||
| - | < | ||
| - | |||
| - | Edit **''/ | ||
| - | < | ||
| - | # | ||
| - | # Uncomment it if you want to have the turnserver running as | ||
| - | # an automatic system service daemon | ||
| - | # | ||
| - | TURNSERVER_ENABLED=1 | ||
| - | </ | ||
| - | |||
| - | Now we are going to write the turnserver config, there is a lot of commenting in the default file, you can ignore that and just paste the following lines then edit to your needs, but these, given that they are filled out correctly will result in a working turn server **''/ | ||
| - | |||
| - | < | ||
| - | listening-ip=< | ||
| - | relay-ip=< | ||
| - | listening-port=3478 | ||
| - | tls-listening-port=5349 | ||
| - | fingerprint | ||
| - | lt-cred-mech | ||
| - | use-auth-secret | ||
| - | static-auth-secret=< | ||
| - | realm=sub.domain.tld | ||
| - | total-quota=100 | ||
| - | bps-capacity=0 | ||
| - | stale-nonce | ||
| - | cert=/ | ||
| - | pkey=/ | ||
| - | cipher-list=" | ||
| - | no-stun | ||
| - | no-loopback-peers | ||
| - | no-multicast-peers | ||
| - | |||
| - | </ | ||
| - | |||
| - | Restart coturn | ||
| - | < | ||
| - | |||
| - | Once you are done, install the Talk app in the web client, then in the admin settings, add the **server URL** and the **secret** that you generated earlier. | ||
| - | |||
| - | Source: [[https:// | ||
| - | |||
| - | |||
| - | ===== Linux Desktop Sharing ===== | ||
| - | You can share the desktop right away on any OS with the tool built into the browser, but in order to share the desktop at greater then 2fps, you need to implement a hack. | ||
| - | |||
| - | On Arch: | ||
| - | < | ||
| - | I think that the aur package enables the kernel module automatically so... | ||
| - | < | ||
| - | then, the exclusive_caps=1 options does something to make it work better in chromium | ||
| - | < | ||
| - | Now to stream the desktop or video to / | ||
| - | Where '' | ||
| - | < | ||
| - | |||
| - | ====== Keeweb ====== | ||
| - | Keeweb is a webapp that allows you to use keepass databases from the browser. It is no longer being developed so it does not work out the box with the latest version of Nextcloud. | ||
| - | |||
| - | Download and extract the last release of keeweb. | ||
| - | < | ||
| - | $ tar xvf keeweb-0.4.0.tar.gz | ||
| - | </ | ||
| - | |||
| - | Before you add this to Nextcloud some modifications need to be done. The '' | ||
| - | |||
| - | **'' | ||
| - | < | ||
| - | In the '' | ||
| - | < | ||
| - | overflow-y: hidden; | ||
| - | width: 100%; | ||
| - | } | ||
| - | |||
| - | #app > iframe { | ||
| - | width: 100%; | ||
| - | height: 100%; | ||
| - | } | ||
| - | </ | ||
| - | Copy the inner folder named keeweb to Nextcloud' | ||
| - | < | ||
| - | $ sudo chown www-data: | ||
| - | |||
| - | |||
| - | FIXME | ||
| - | Mimetype detection | ||
| - | Unfortunately, | ||
| - | Keeweb work properly, you need to add a new mimetype in the | ||
| - | **'' | ||
| - | To proceed, just copy **''/ | ||
| - | `/ | ||
| - | < | ||
| - | |||
| - | Afterwards add the following line to **''/ | ||
| - | < | ||
| - | |||
| - | After that, run the following command: | ||
| - | < | ||
| - | |||
| - | Source: [[https:// | ||
documentation/nextcloud_18.04.1580560512.txt.gz · Last modified: 2021/06/18 16:36 (external edit)