Nextcloud: Full Setup & Implementation Guide

Originally published at: Nextcloud: Full Setup & Implementation Guide – LearnLinuxTV

The popular LearnLinuxTV guide to setting up your own cloud with Nextcloud has been freshly updated for 2022! In this video, Jay will walk you through setting up an Ubuntu server for use with Nextcloud. In this tutorial, you’ll be walked through the process of installing Nextcloud, setting up a TLS cert, implementing online document editing, and more!

3 Likes

If you have a reverse proxy running and you want to deploy with docker, you can use the following stack. Edit your preferences and deploy in less than a minute.

Make sure to add DNS records and reverse proxy settings for both cloud.yourdomain.com and office.yourdomain.com.

version: '3'

services:

  nextcloud:
    image: linuxserver/nextcloud:latest
    container_name: nextcloud-cloud
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Copenhagen               # Edit this line
    volumes:
      - /path/to/docker-data/nextcloud/nextcloud-conf:/config  # Edit this line
      - /path/to/docker-data/nextcloud/nextcloud-data:/data    # Edit this line
    ports:
      - 8775:443      # Edit the first number to your preferred port for Nextcloud
    restart: unless-stopped

  collabora:
    image: collabora/code:latest
    container_name: nextcloud-office
    cap_add:
      - MKNOD
    environment:
      - 'domain=cloud\\.yourdomain\\.com'  # Edit this line
      - 'dictionaries=en_GB en_US da_DK'   # Edit this line
      - 'DONT_GEN_SSL_CERT=True'
      - 'extra_params=--o:ssl.enable=false --o:ssl.termination=true'
      - 'TZ=Europe/Copenhagen'             # Edit this line
# Include this if you want to map the Collabora config file - make sure you have a working config first (after inital deployment)
#    volumes:
#      - /path/to/docker-data/nextcloud/collabora-conf/coolwsd.xml:/etc/coolwsd/coolwsd.xml
    ports:
      - 8780:9980      # Edit the first number to your preferred port for Collabora
    restart: unless-stopped
    depends_on:
      - nextcloud

WHOOPS !!! Somehow, I broke it!
2022 Nextcloud: Full Setup & Implementation Guide (Updated for 2022!)

Little help please. A year ago, I successfully set up my NEXTCLOUD on Linode following this tutorial: Nextcloud: Complete Setup Guide - YouTube

Everything worked from the original tutorial…but with a few “complaints” from NextCloud. I went through the 2022 update tutorial: Nextcloud: Full Setup & Implementation Guide (Updated for 2022!) - YouTube
and made a few changes to my original instance this tutorial recommended substituting my domain info instead of Jay’s. The changes I made did NOT throw any error messages. Specifically I made these changes:

  • sudo chmod 660 /var/www/<nextcloud_directory>/config/config.php
  • sudo chown root:www-data /var/www/<nextcloud_directory/config/config.php
  • ‘default_phone_region’ => ‘US’,
  • sudo apt install libmagickcore-6.q16-6-extra
  • sudo vim /etc/apache2/sites-available/nextcloud.learnlinux.cloud-le-ssl.conf
  • Header always set Strict-Transport-Security “max-age=15552000; includeSubDomains”

And without knowing why…my bookmarked log in page no longer loads and my Android will not let me access my files. My hunch is that something related to the sudo chmod commands fouled the system.

How do I begin to diagnose and fix this? Thanks to all. Whew…what a lesson in "if it ain’t broke…don’t fix it:…
Mint Daddy
PS - re ran: sudo system ctl status and got this error. Can it help diagnose? Changed my domain and user name for my privacy…

$ sudo systemctl status

● <my.domain.com>
State: degraded
Jobs: 0 queued
Failed: 1 units
Since: Wed 2022-03-09 22:47:31 UTC; 21h ago
CGroup: /
├─user.slice
│ └─user-1001.slice
│ ├─session-205.scope
│ │ ├─22333 sshd: <me_user> [priv]
│ │ ├─22452 sshd: <me_user>@pts/0
│ │ ├─22458 -bash
│ │ ├─23650 sudo systemctl status
│ │ ├─23651 systemctl status
│ │ └─23652 pager
│ └─user@1001.service …
│ └─init.scope
│ ├─22346 /lib/systemd/systemd --user
│ └─22347 (sd-pam)
├─init.scope
│ └─1 /sbin/init autoinstall
└─system.slice
├─haveged.service
│ └─531 /usr/sbin/haveged --Foreground --verbose=1 -w 1024
├─apache2.service
│ ├─ 749 /usr/sbin/apache2 -k start
│ ├─ 2491 /usr/sbin/apache2 -k start
│ ├─ 2493 /usr/sbin/apache2 -k start
│ ├─ 2494 /usr/sbin/apache2 -k start
│ ├─ 2497 /usr/sbin/apache2 -k start
│ ├─ 2498 /usr/sbin/apache2 -k start
│ ├─ 2596 /usr/sbin/apache2 -k start
│ └─21308 /usr/sbin/apache2 -k start
├─packagekit.service
│ └─22708 /usr/lib/packagekit/packagekitd
├─systemd-networkd.service
│ └─567 /lib/systemd/systemd-networkd
├─systemd-udevd.service
│ └─375 /lib/systemd/systemd-udevd
├─cron.service
│ └─584 /usr/sbin/cron -f
├─system-serial\x2dgetty.slice
│ └─serial-getty@ttyS0.service
│ └─617 /sbin/agetty -o -p – \u --keep-baud 115200,38400,9600 t>
├─mariadb.service
│ └─730 /usr/sbin/mysqld
├─polkit.service
│ └─672 /usr/lib/policykit-1/polkitd --no-debug
├─networkd-dispatcher.service
│ └─594 /usr/bin/python3 /usr/bin/networkd-dispatcher --run-startu>
├─multipathd.service
│ └─469 /sbin/multipathd -d -s
├─accounts-daemon.service
│ └─580 /usr/lib/accountsservice/accounts-daemon
├─ModemManager.service
│ └─23243 /usr/sbin/ModemManager
├─systemd-journald.service
│ └─353 /lib/systemd/systemd-journald
├─atd.service
│ └─603 /usr/sbin/atd -f
├─unattended-upgrades.service
│ └─745 /usr/bin/python3 /usr/share/unattended-upgrades/unattended>
├─ssh.service
│ ├─ 658 sshd: /usr/sbin/sshd -D [listener] 6 of 10-100 startups
│ ├─22468 sshd: [accepted]
│ ├─23639 sshd: [accepted]
│ ├─23640 sshd: root [priv]
│ ├─23641 sshd: root [net]
│ ├─23644 sshd: unknown [priv]
│ ├─23645 sshd: unknown [net]
│ ├─23646 sshd: unknown [priv]
│ ├─23647 sshd: unknown [net]
│ ├─23648 sshd: [accepted]
│ └─23649 sshd: [net]
├─fwupd.service
│ └─23387 /usr/libexec/fwupd/fwupd
├─snapd.service
│ └─597 /usr/lib/snapd/snapd
├─rsyslog.service
│ └─595 /usr/sbin/rsyslogd -n -iNONE
├─upower.service
│ └─18227 /usr/lib/upower/upowerd
├─systemd-resolved.service
│ └─569 /lib/systemd/systemd-resolved
├─udisks2.service
│ └─602 /usr/lib/udisks2/udisksd
├─dbus.service
│ └─585 /usr/bin/dbus-daemon --system --address=systemd: --nofork >
├─systemd-timesyncd.service
│ └─508 /lib/systemd/systemd-timesyncd
├─system-getty.slice
│ └─getty@tty1.service
│ └─619 /sbin/agetty -o -p – \u --noclear tty1 linux
└─systemd-logind.service
└─600 /lib/systemd/systemd-logind

Hello I installed NextCloud following the instructions. everything works fine.
One comment to onlyoffice that it is not working ok at all. When you press the save button in onlyoffice settings it wont work anymore. Also save as (pfd or …) wil give a Downloadfailed error.

Great Video with excellent details. I could follow this, and my server is working flawlessly. This only challenge I am facing is that I am hosting it in a PC at home and could not access it externally. I have a domain name and running a pfsence firewall with HAProxy. I have other things already configured and accessible to nextcloud is not working. I did check the nexcloud documents and set the parameters for trusted proxy but still not working.

Hello and 1st of all - thank you very much for the video. :wave:

Since I recently began digging my way into Linux I thought I might as well set up a Nextcloud server.
I’ve already watched the video 2 times took notes and then went on to try it myself.

Now I ran into trouble at setting up the mariadb part.
When I do the “GRANT ALL PRIVILEGES…” part it doesn’t confirm or anything and just indents the command line below with a > leading.

I guess I probably missed something…
Btw I checked for typos multiple times.

Thanks in advance for replying. :slight_smile:

I believe you may have missed a ; (semi-colon). SQL commands require those to end the line.

@Biky thank you for your quick response.
I just found out what the issue was… and that’s kind of embarrassing. :sweat_smile:
I actually included a \ at the end of the password not thinking about the meaning of that symbol for the shell.
I just changed that and now it works.

Sorry to bother your and thanks again for your quick reply. :smiley:

1 Like

Now I ran into the next problem:

This version of Nextcloud is not compatible with > PHP 8.0.
You are currently running 8.1.2.

What do I do now? :sweat_smile:

Probably remove PHP 8 and get a PPA for 7. Or switch your OS to and older one.

@Biky Thanks again for your reply!
Solution:

$ sudo add-apt-repository ppa:ondrej/php

$ sudo apt update

$ sudo apt remove php php-apcu php-bcmath php-cli php-common php-curl php-gd php-gmp php-imagick php-intl php-mbstring php-mysql php-zip php-xml

$ sudo apt install php8.0 php-apcu php8.0-bcmath php8.0-cli php8.0-common php8.0-curl php8.0-gd php8.0-gmp php8.0-imagick php8.0-intl php8.0-mbstring php8.0-mysql php8.0-zip php8.0-xml

$ sudo update-alternatives --config php

setting that to php8.0 and finally restarting apache2.
Nextcloud now displays properly in the webbrowser. :smiley:

1 Like

So now it worked briefly… and now I get

Internal Server Error
The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the webserver log.

when I try to access the server via local ip-address and I am again clueless.

Not sure you are supposed to use it via its IP. I don’t remember the tutorial, but I believe you need to give it a hostname to listen on, like ‘nextcloud.local’ and you may add nextcloud.local in your PC’s hosts file. Then access nextcloud.local in a browser and then it might work. I’ve seen many websites that don’t work if you don’t use a hostname, but that’s mostly because of the webserver settings (I believe Jay used Apache2).

Thanks again for your time and effort. :pray:
By now I have a DDNS up and running and can access the nextcloud page either by entering the (static) local ip adress or the ddns.
Apparently there was a problem with port forwarding.

The only problem I have left is on my nextcloud setup warnings:

  • PHP configuration option output_buffering must be disabled
  • Your data directory and files are probably accessible from the internet. The .htaccess file is not working. It is strongly recommended that you configure your web server so that the data directory is no longer accessible, or move the data directory outside the web server document root.

Which are marked red so I assume they’re important. I don’t understand which data directory that warning is referring to.
Any advice? :smiley:

edit:
I found the settings for output_buffering and set it to 0 and the warning disappeared.