OCC Nextcloud Command in Yunohost

I have been using Yunohost as a manager for much of my personal web for several years now, and within that I have my Nextcloud instance. I have really liked it, but there are a few caveats that one needs to take into account when going this route.

First, updates are at the pace determined by the Yunohost/Nextcloud team. This means that you can be a little behind. In fact, when Nextcloud jumped to using PHP 7.3 in version 16, we were stuck in 15.x for quite some time. Actually 15.x was deprecated and the jump was all the way to 18.x when the full upgrade finally came. This was due to the upgrade to Debian 10 in Yunohost being almost there, and nobody wanted to do the work only to have the upgrade upset it all. I get it, but it was frustrating.

That said, they have done a great job of keeping the current versions available on a regular basis. My monthly maintenance, usually gets me at or just a point version behind current. Kudos to the team!

The other thing is, and this is really the reason I am posting this, is that the back end necessarily gets a little weirded out. Nextcloud is in different folders, and other things change which make using normal online guides a little more difficult.

One of the biggest things to note is that in Nextcloud there is a back end command line option called OCC. This is pretty cool, and quite powerful. I can usually use the OCCWeb app to run things I need to, but once in a while it just won’t work. That means going to the command line in Yunohost, and having to bridge the gap a bit. This is not at ALL intuitive.

The main thing to remember is that where in most Nextcloud instances the user for commands is www-data. This does not work! To make Nextcloud compatible with Yunohost, they have had to change the user to nextcloud. This is not always apparent, and you can bash your head against a wall dealing with permissions issues that don’t exist if you don’t know that. I know this from past experience messing up my entire install.

A consequence of this, is that the OCC command is much clunkier in the command line. You have to go to the folder OCC is in, which is usually /var/www/nextcloud/, to run the command. You can put the whole path in the command, but come on? Who wants to do that?

You also need to call out PHP to get it to recognize the OCC call. In the end, your call looks like this:

sudo -u nextcloud php7.3 occ

that is instead of just typing in “occ”. And that doesn’t include any of the commands you want to run. That is just the base to get you there.

Fortunately it is a rare occurrence that you need to use the OCC interface, but in some ways, that infrequency make it more difficult, as you will forget all that detail, and have to research it all over again. It is in the documentation for Nextcloud in Yunohost, but it isn’t something that comes up in most searches.

So, while I do recommend both Yunohost and Nextcloud, if you have to deal with anything in Nextcloud relating to OCC, keep some notes around. You will need them.

Personally, this post is mainly so I don’t have to go hunting it down in the future like I did tonight!

Leave a Reply

Your email address will not be published. Required fields are marked *