Nextcloud on home network

With Ubuntu Server 18.04, Nextcloud snap install is an option during OS setup. It doesn’t get easier than that.

1 Like

Just to re-iterate. I’m asking what are the pitfalls of setting Nextcloud up on my home PC, and what is the setup procedure, or where might I find a guide to it.

I am not asking how to install Nextcloud on my home PC - It’s pretty obvious how to do that. Find ‘NextCloud’ in some Repository/Docker/Snap/Download and click ‘install’.

Nor am I asking how hard/easy it is - I’ve no doubt I will inevitably find that out.

Nor am I asking if it is possible I could mess it up completely - I’m sure it is.

I just want to know if it can be done, and if so whether there is a guide available to the dozens of setting choices which come after one has clicked on ‘install’ that would explain which are best for a LAN setup on a Desktop PC.

What would you suggest I set up first in order to gain this experience. Is there some smaller but similar project available?

Why would ‘other stuff going on on my machine’ interfere with NextCloud. I don’t understand why any setup would want to allow that to happen?

Great, that’s exactly what I want for now - something which only works on my LAN. I’m quite content to wait until I get home to sync everything and I don’t have to worry as much about security.

Happy with that, but this is what I’m looking for. So far my Google Searches have come up empty of guides for LAN setups with NextCloud running on a Desktop PC, and the guides for things like Pi and NAS don’t explain what they’re doing, they’re just “type this…click that…” and I don’t know if that’s what also needs doing on an LAN/PC system or whether those instructions are specific to the setup in the guide.

If you know of any reading that would explain how the system works, or what all the “type this…click that…” instructions are actually doing, I’d be really grateful for a link. I’m quite happy to spend as much time as it takes to understand how this works, just don’t know where to start is all.

running a debian-(derivative) installation you can probably just follow the “server”-installation-instructions, since there is no real distinction between “server-” and "desktop-"software that would prohibit the installation of either on on the other (disregarding hardware).
i recommend against docker/snap/… because it seems easy to install at first (“one click”) but adds multiple layers of complexity and dependencies.
it will probably be helpful to use a fixed ip for your nextcloud-host and all clients must “know” it or be able to resolve it. also if you are lan-only, you’ll have to use a self-signed ssl-cert.
just install the complete LAMP-stack (or nginx instead of apache) and pay special attention to the required php-modules. you might find the required software faster if you use apt or synaptic (if you like GUI) for installation instead of ubuntu-software. then download the latest nc-version and configure it.
just to state the obvious: if you run it on your desktop-system the ressources will be shared between ALL processes running on that, so if you are transcoding a movie at 100% load nextcloud will be noticeably slower to respond.
GOOD LUCK!

1 Like

No, I’m just speaking of experience and conventions in general. Whenever I hear the phrase “give a bit of my hard drive” it’s a huge red flag. You should absolutely move ahead with this project, and that will be good experience.

Just as an example, the other day I was helping someone who had installed the Nextcloud snap after already installing Apache via apt. Port 80 was in use on his machine, and the snap wouldn’t start as a result.

You’re talking about installing it on a desktop PC. I have no idea what else may be installed on it that could interfere with whatever installation method you choose.

My advice to you is just go for it. The worst thing that’s likely to happen is you uninstall it and start over. You can find the full documentation here, and the procedure is basically the same whether you access it from the internet or not.

https://docs.nextcloud.com/

I’m on Manjaro and use the package manager. That takes care of dependencies. What other layers of ‘complexity’ does the snap version handle? I’m not sure how well snap is supported on Manjaro.

Thanks, I think I will just install it now and deal with the setup one question at a time. At the risk of sounding completely uninitiated in these matter (which, as you can tell, I am) I was not so concerned about things simply not working, but more with me accidentally opening up my personal computer to the entire internet. ‘Not working’ would be fine, I can fix that. Unknowingly turning my PC into an unsecured webhost, however…

It’s true that snap and Docker add complexity because you now have to know some things about snap and Docker. However, I disagree that they add dependencies. Both of them eliminate dependencies.

Docker images contain a stable set of dependencies so that the software is no longer dependent upon any packages on the host server.

Snap does this too by installing and sandboxing a separate instance of everything needed by the package. You won’t find an easier installation than snap, but I usually don’t recommend it for two reasons: 1.) I’m not comfortable with the way it stores data, and 2.) if you decide you want SMB external storage support one day, you’re up a creek.

As far as being accessible to the internet, that’s all down to what you put in your firewall.

So. I’ve decided to finally set aside some time to do this and hit my first query already. I think I’ve got my head around what a web server does (serves web pages) and that Nextcloud is a service designed to run from a web server.

So I’m about to install nginx on my machine. I looked up the instructions for setting up a home server and found quite a long and convoluted set of codes, which is fine, I can follow those, but I don’t understand what the difference is between following these long complicated instructions and following the ‘web installer’ “Right-click here and save the file to your computer - Upload setup-nextcloud.php to your web space”

If I’ve got a web space on my home pc (because I’ve just installed a web server on it), then why can’t I just follow those two instructions to get Nextcloud on it?

It doesn’t mention doing so anywhere in the guide.

Hold on, take a step back and answer this first:

  1. Are you still doing this on Manjaro? That’s fine if so, but just keep in mind the more fringe of a distro you use, the less testing there has been, increasing the possibility of unforeseen issues.
  2. What installation method have you chosen (manual, snap, docker, distri’s package mgr)? It sounds like you intend to do manual installation on Manjaro with nginx for the web server but I wanted to confirm since some time has passed.

Thanks for getting back to me.

Yes, still using Manjaro, happy to accept a little unforeseen complication (as long as accidentally publishing my bank details to the internet isn’t one of them). If it doesn’t work on Manjaro it’s probably not worth me doing it. At the moment (until I move on to a bigger system) this is just a file and calendar sharing method over my LAN, nothing more, so if it doesn’t work with Manjaro, I’ll just revert to sharing things manually.

I theoretically have chosen to try the package manager install. Nextcloud is in the Manjaro distro, so that usually means it’s been tested and works. I haven’t used snaps and dockers before and I don’t really want to try two new things at once.

However, having said all that, the current plan (which I’m asking about) would be to set up nginx, obtain a locally hosted webdomain by that means, and then use the Nextcloud web installer php. But that just seems far too simple for a method that’s not actually advised anywhere I can find, hence my confusion.

Okay, if you’re unzipping Nextcloud into a folder for nginx, that’s the manual method. If you’re using apt or rpm then that’s a distro package.

I may not be able to help you with nginx as I use Apache and haven’t messed with it, but instructions for it are in the official documentation.

This may be oversimplifying a little, but you do actually unzip it in a folder under your web root and then go to the web page.

You can find plenty of guides that describes this installation method, although they might not look like if from the beginning. I used it to get my stuff going, and it works wonderfully. Just get the prerequisite software running as you are doing right now (the term you want to search for is LEMP stack, or LAMP stack for Apache instead of nginx, I find this guide (Digitalocean) very beginner friendly, with less “magic code”).

I personally found Apache easier to understand compared to nginx as a beginner. Apaches conf files are in more straightforward English if you ask me.

Thanks for the link. The guide is really easy to follow and will be very helpful. You mentioned other guides, though and the one thing the guide you linked doesn’t answer is unfortunately the one thing I really want to know before starting. How do I secure my webserver from access by the wider internet? I want it to be impossible (for now) for someone outside of my LAN to get onto my webspace. At the moment I’m not sure how I do that. Obviously if i close ports on the firewall at the server machine (which will just be my PC for now), then other devices in the house won’t be able to access the files, but I don’t know how to keep them open for internal traffic, but closed for external requests.

I had thought I understood it because I thought one had to deliberately forward ports from the router in order to allow external traffic to use them, but the guide you linked to doesn’t mention that and makes it appear as though simply installing Apache (and just opening the necessary ports at the local firewall) is enough to make the webspace available from outside the LAN. This is not what I want (yet) so I need some idea of how to modify this default behaviour. Does that make sense?

Your understanding is correct. The guide does not cover the expose it to the internet part/assume the person following it does already know how to do this. Your setup is a bit unsual, so you really won’t find many guides for “how do i block my webserver from being accessed from the Internet” As long as inbound traffic on port 443 and 80 is blocked/not forwarded (default on any sensible consumer router), the server will not be possible to reach from the internet.

Just be aware that letsencrypt will not work if the server is unable to be reached on any of those ports.

Let’s Encrypt requires port 80 specifically.

The term “port forwarding” refers to a port-specific inbound NAT translation where as “opening a port” refers to a firewall access rule. Consumer grade routers often combine the two into a single setting, but it’s important to understand that they are two separate things that are both needed. The effort to simplify it has the unfortunate side effect of making the true terminology confusing.

On your LAN, you only need the port to be not blocked (port open in firewall, or no firewall on the server itself). To access from outside your LAN, you need NAT, as well as the port open in the router’s firewall.

Thanks for getting back to me. That covers my most of my concerns. I suppose I’m constantly getting thrown by…

I’m baffled as to why. With Nextcloud on my LAN, I get a completely secure way to serve files, calendars, to do list, synchronise bookmarks and back up data between all my devices seamlessly. I can’t think of anything else that can do that, and yet I keep being told that my plan is unusual. That’s why, despite everyone’s great advice, I’m still nervous, I can’t for the life of me think why not everyone is doing this, how could one possibly achieve the same thing any other way? Just synchronising calendars between a PC and an Android device is a nightmare without using Google. Contacts are even worse. And presumably most people using Nextcloud are doing so at least partly because of privacy concerns, so would rather not use Google etc.

Anyway -

I’ve installed LAMP (went with Apache in the end), my webserver is working properly, I’ve installed Nextcloud. I ended up mostly following this, but with help from the Nextcloud manual and the webpage you linked too. Now, I go to my localhost and I get a Nextcloud page with

" Internal Server Error
The server was unable to complete your request."

Googling here just brings up this which doesn’t seem to have been solved.

Any clues as to what I’ve done wrong would be appreciated.

Thanks, that’s cleared that up. If you’ve still time, I’d appreciate it if you could have a look at the problem I’m now experiencing (above). Thanks.

Because there is a great utility in having it accessible outside of your LAN as well, and that most people who like to dip their toes into hosting a Nextcloud instance either already have a spare computer, Raspberry PI or similar low cost option available, or drop the $100 bucks a Pi+HDD will cost. There is also not any difference between doing it on LAN and Internet wide for the server setup. The difference is networking, (fiddling with ports) that is either dedicated to other guides, or assumed the person following the guide knows. The last bit is very annoying indeed when one is learning, but it is very common.

Internal server error could be quite a lot of things. There should be clues in the Apache logs (generally in /var/log/httpd-error.log, or similar) See if you can find something there, and post either here or on pastebin.

Thanks - I don’t have an httpd-error.log, but I found a nextcloud.foo.info-error_log. There’s a lot of information there, but it starts with

[Wed Sep 11 11:55:03.591833 2019] [php7:warn] [pid 5577] [client ::1:50476] PHP Warning: fileperms(): stat failed for /usr/share/webapps/nextcloud/data/nextcloud.log in /usr/share/webapps/nextcloud/lib/private/Log/File.php on line 140

If you have any idea what that’s referring to, maybe fixing that might fix the other problems too?

The error seems to indicate a problem with file permissions. So perhaps you can check that the Nextcloud files are all owned by www-data. This is required by Nextcloud, which runs with the user www-data.

I noticed a lot of confusion about running Nextcloud on your desktop earlier in this thread so I wanted to mention that I’ve been running Nextcloud for years on my desktop now. My desktop remains on 24/7 and it’s powerful enough to run Nextcloud next to everything else I do. Though Nextcloud doesn’t really need that much power to run, relative to a modern desktop. The difference with running Nextcloud from your desktop instead of a server is that you won’t be able to connect to it if you turn your desktop off. But that should be obvious.

The only real issue I’ve noticed is that you’ll likely need to have 2 copies of your data on your desktop. The files that you see in Nextcloud are in a specific config folder, separated by Nextcloud user. This needs to be owned by the www-data user in your OS. This is likely not the user that you normally use your desktop with (it really shouldn’t be). While you can access these files directly, with root or setting the right permissions, Nextcloud isn’t really built for that. Any changes you make locally aren’t really visible in Nextcloud. You can force Nextcloud to scan the files again with occ but that’s just a workaround.

The way you’re supposed to access Nextcloud files is through the Nextcloud client. You can install that and it will then sync it to a folder on your desktop. This is a different folder which is now a second copy of the same files that Nextcloud already stored on your desktop. There’s no real way around this but it might become less of an issue if we get the Virtual Drive functionality in the Linux client.

I’m late to the party but I saw someone mention that this is Linux software. I don’t think that’s accurate, it’s actually just a web application written in PHP. That means you can use pretty much any web stack (LAMP, MAMP, WAMP, etc) to run it. That includes WAMP or xampp on Windows. Or what I would do in Windows is run an Ubuntu lamp stack inside a virtual machine for more isolation and flexibility. As mentioned, this application is questionable as you will have two copies of the data on the desktop, but you could do something crazy like use an external USB hard drive as the data directory for nextcloud, but honestly that sounds like a really bad idea and I’m sorry for mentioning it :wink: