NextCloud Server Adventures


The Problem

It has been awhile! It has actually been *over a year*. Anyone who went to this server's http port (https://lantashifiles.com) would not see a working webpage. At first they would get a screenful of PHP... not exactly helpful. Later, after some work, the server was feeling generous, and an error message saying that the PHP version was too new for the version of NextCloud installed.

How long was it? Well, I upgraded the server to Debian 12 over a year ago. And it was then that NextCloud broke. During the upgrade of Debian, PHP was updated as well, and the new version of PHP was incompatible with my out-of-date NextCloud installation.

As of this past weekend, this Sylvan ranger had had enough! And she decided to bring the NextCloud server back online! NextCloud is a really easy way for this Sylvan to keep files in sync between different systems, and also for sharing files with my friends. This is especially nice for sharing files with adventuring groups (Dungeons & Dragons, Alternity, stuff like that!). It is fun to chat on too.

Together, with the help of a Human warrior friend (also a Geminaut), we finally brought NextCloud fully up to date.

The server was stubborn, and I tried my best to preserve data and settings.

The Upgrade Attempt

A Nextcloud installation sits in /var/www/nextcloud, at least on my server. There are instructions online for how to run upgrades from the Terminal, which is what we tried.

Nextcloud Manual Upgrade

You are only supposed to upgrade one version major version at a time (ex. 20.x -> 21.x).

This should have worked. But it didn't! Why? Because of this command in the instructions:

sudo -u www-data php occ upgrade

That "php occ upgrade" failed, because, well, because the first version I was trying to upgrade to required an *older* version of PHP than I had installed. The "php occ upgrade" was failing! This is the same reason my old NextCloud install was failing in the first place.

It is enough to make a Sylvan weep crystaline tears!

The Human warrior, on the other hand, was just amused.

Full Install

So we had to do a full install.

I wasn't sure I could just copy over the data directory from /var/www/nextcloud-bak (I renamed the old install to bak) to /var/www/nextcloud, and have it work.

Fortunately, everyone with an account on the Nextcloud server had a local copy of their data - the ranger (me!), the warrior (him!), the bard (guy over there ->, who likes Vim over Emacs *sigh*), the Dungeon Master, etc. Everyone having local backups was partly why I put off the headache of fixing it for so long.

So the warrior and I decided to do a full install instead. There are command line instructions for that on NextCloud's site as well.

NextCloud Command Line Installation

That should have worked, but it didn't. This part was failing:

$ cd /var/www/nextcloud/
$ sudo -u www-data php occ maintenance:install \
--database='mysql' --database-name='nextcloud' \
--database-user='root' --database-pass='password' \
--admin-user='admin' --admin-pass='password'
Nextcloud is not installed - only a limited number of commands are available
Nextcloud was successfully installed

MariaDB

Why was it failing? Well, I didn't capture the error message. I felt more like throwing something (this Sylvan is a redhead). But, something was not working with the MariaDB database. So the warrior says to me that he's going to uninstall/reinstall MariaDB.

That part really wasn't that hard, just using apt commands, purging, etc. I think these were the instructions, or something similar:

Completely Unistall and then Reinstall Mariadb

So we fixed the database, with a full reinstall. Then we proceeded to install NextCloud, going back to the instructions above.

Cleaning Up

Since I ended up deleting the old NextCloud install, I had to reset everyone's accounts up from scratch. Well, I have several people set up now,and we've been putting NextCloud through its paces.

In the Admin console, NextCloud also included a number of suggestions, such as allocating more RAM for PHP (I upped it from 128 MB to 512 MB), updating string caching, stuff like that. NextCloud is pretty helpful in explaining this, together with a regular duckduckgo search.

Features

Here are some of the features of my NextCloud install -







I am probably going to install more apps on it as well, but the above ones were a good start.

Lessons from this

One, keep your operating system up-to-date. I'd let mine fall behind, and then felt rushed because it was no longer supporting security updates.

Two, keep your NextCloud install updated! If I'd just done that, I could have just continued with update in the GUI after the OS upgrade.

Three, patience. The first part of this work occurred last Thursday. But it took some time, and the last part of it was finished on Sunday (setting everyone back up, installing the apps, testing things out).

Into the future

What is the NextCloud server for? Well, sharing files of course, and chatting. Yeah, there's Discord, but where is the fun in that? I like running my own server! It's fun. And I am in full control of it.

As someone I know told me about it - with everything you can do on it, NextCloud is like a mini-operating system.

Well, at least now Lantashi Files is fully back up, on Gemini (never broke there), and now, again, on the web!

Links

Lantashi Files, main section

Email: lantashi [at] protonmail [dot] com


Source