Nextcloud is a cracking good open source file synchronisation and sharing tool, but we're
gonna make it better! I use Nextcloud instead of the likes of OneDrive or Dropbox because it
gives me more flexibility and I can host it myself; but the Nextcloud team have a bigger
vision. They're building it out to be a full, open source, self-hosted, cloud collaboration platform.
They want it to be seen as a proper alternative to Microsoft 365 or Google Workspace. Now I'm not
going to pretend it's on a par with those - the scale is very different; but it is pretty cool
that you can build something like that yourself. What does interest me are the online document
editors because, yes, those are essential for a collaboration platform; but they're also
just really handy to have integrated into your personal file sharing tool - which is
my use case. The thing is... I think Nextcloud's could be better. So I'm going to make them better!
Welcome back to the Pro Tech Show. Now why do I think there's room for improvement in Nextcloud's
document editors - specifically the Nextcloud Office online suite? Well, let me take you back
to an earlier video where I showed you some of the problems I had when I switched my laptop
to Linux for a couple of weeks. One of the biggies was compatibility with Microsoft Office documents
when I was using LibreOffice. I encountered multiple issues where my documents ended up getting mangled.
I'm not going to go over that again in detail. I'll link the other video in the description if
for some reason you want to recreate some issues at home. All I want to show you now
is this spreadsheet from last time. This was one of the examples. When I opened it in LibreOffice
the table formatting was missing. When I saved it the formatting at that point was purged, even if I
reopened it with Microsoft. Basically, I could nuke the formatting on someone else's document without
even realising. Nextcloud Office has exactly the same problem; because Nextcloud Office
is really just their integration of Collabora Online into Nextcloud, and Collabora Online is based
on... you get asked it... LibreOffice. So I have the same problems, here. If my Nextcloud lived
completely within a isolated bubble it would be fine; but because I use a lot of documents that
came from the Microsoft World (aka the real world as far as most of everyone else is concerned) I
can't fully trust this to edit my documents without potentially breaking them. Now in that other video
I found a solution in the form of ONLYOFFICE. Whilst doing that I discovered four things.
One: ONLYOFFICE has a web version in addition to the desktop apps. Two: there is a Nextcloud integration
for it ready to go. Three: the community edition is completely free; and four: ONLYOFFICE sponsored
that other video so maybe if I make one showing how to integrate ONLYOFFICE into Nextcloud I
can get them to pay for it. They did, by the way; so seeing as this video is sponsored by ONLYOFFICE
that's go to our apps, disable Nextcloud Office, and enable ONLYOFFICE so you can see it. Now if I go
click on my document again you'll see it opens in ONLYOFFICE, straight in the browser. There's
my property formatted table. I now I have an in-browser editor with decent Microsoft Office
compatibility. I prefer to use a desktop app over a web app if I'm going to be spending any
time in a document but sometimes you just want to quickly open a file without downloading the entire
thing, and this is perfect for that. Combining ONLYOFFICE with Nextcloud also opens the door to some
interesting options related to forms; but I'm going to get to that later. First, I'm going to show you
how to get this installed. If you jump over to onlyoffice.com, go to "GET ONLYOFFICE", then "Docs
Community"; then you have this download page with packages for Windows, different Linux distributions,
Docker, a snap package, etc., etc. Now I can't show you all of these. Docker is Docker, though. If you
deployed Nextcloud in a container you may as well deploy ONLYOFFICE in a container as well,
and I'll assume you're already familiar with how to deploy containers having done it before.
For those who prefer to install things themselves, then because we're integrating this with Nextcloud
and Nextcloud runs on Linux, I'm going to show a Linux install rather than Windows; and I'm going to do it on AlmaLinux 8.
The AlmaLinux instructions will work as is for Rocky Linux, CentOS, or Red Hat as well;
and personally I like the whole Enterprise Linux platform that these are part of. Plus there are a
couple of quirks that you might need to know about. Instead of downloading it click on the
"Read instructions" link and you get a pretty decent guide. I'm not going to work through this in the
video because I'm willing to bet you can read. So I'll link it in the video description rather than read it
to you. Instead, if I click over here to get to the generic instructions instead of the CentOS ones
you'll notice there's a 1-click install where you just run a script and it does everything for
you. We're going to use this; but if you just run it as-is on version 8 of one of the Enterprise
Linux distributions like AlmaLinux you'll hit a couple of issues. So instead of a big boring
install video going through a guide you can read anyway I'm going to show you a couple of tweaks
you need to run the 1-click install script, then I'll show you how to enable encryption once you've
got it installed via whatever method you prefer, and how to solve a couple of common issues that
tend to trip people up when they try to integrate with Nextcloud; because they are the things you
won't find in the guide. The first little issue you might hit with the 1-click install script is a
dependency on the semanage tool. Semanage isn't included by default on version 8 and onwards of
the Enterprise Linux platform so this affects Red Hat and its derivatives. To get that installed the
package we need is policycoreutils-python-utils. Install that and you're good. The other issue
you might come across is not with the 1-click install script itself but with a similar script
used by RabbitMQ. ONLYOFFICE uses RabbitMQ; so to avoid reinventing the wheel, ONLYOFFICE's
installation script calls RabbitMQ's script to set up the repos; but RabbitMQ's script is a
little bit too specific when it's checking which distro you're using. Rather than just checking if
you're using something based on Red Hat it checks exact distro names and the list hard-coded into
it are all from version 7. So it will recognise the now-defunct Scientific Linux, but it won't recognise
newer distros like AlmaLinux or Rocky Linux. It tells you how to override this distro
detection, but the easiest thing for us to do is just add the repo manually. They've provided the
config right here for Red Hat 8 and 9 so all we need to do is create a new file in /etc/yum.repos.d and
copy-paste it. In this example I'm creating a file called rabbitmq.repo, and when I save that we
no longer need RabbitMQ script. We can now go ahead and install ONLYOFFICE using the 1-click
install script. We'll download that using wget, use "chmod +x" to make it executable, and then all we
have to to do is run it with elevated permissions using sudo. It'll ask if you want to use Docker
or install the packages for your own distro. Pick your poison. I'll do the package install. That's
going to sort everything out for you. While it's running I'll quickly give you a rundown of what
it's doing to your server. ONLYOFFICE uses NGINX as its web server, PostgreSQL for the database, and
RabbitMQ for message queuing. The script is going to install all of these along with their various
prerequisites, and configure them for ONLYOFFICE. It will also install the Microsoft TrueType fonts
to make sure your Microsoft documents display consistently, and will configure the HTTP and
HTTPS ports on your local firewall. One thing of note is that in my case running AlmaLinux it
will add NGINX's own repository rather than using the one that ships with the operating system. This
means you get a bang up-to-date version of NGINX rather than more dated version that ships with AlmaLinux.
You might see this as a benefit or you might prefer to stick with the older version. The main
reason you might want to stick with the older version is if you're paying for vendor support.
This is more likely to apply to those of you running Red Hat Enterprise Linux. The version of
NGINX it ships with RHEL 8 works fine with ONLYOFFICE and will benefit from Red Hat support,
whereas if you opt for the latest version directly from NGINX themselves you might not be able to get
help from Red Hat if you encounter a problem with it. That said, either of them should work just fine.
Once the script completes, you're done! You have ONLYOFFICE installed. Although everything will
be running now you should run "systemctl enable supervisord" to make sure ONLYOFFICE
starts automatically after a reboot. To check it's installed browse to http://{the name of your server}
and you should see this page; but we don't want to leave it on HTTP. Let's enable HTTPS for encrypted
goodness. The NGINX configuration used by ONLYOFFICE is at /etc/onlyoffice/documentserver/nginx/.
"ds.com" is the live config file. The other two are templates. The fastest way to enable HTTPS
is to copy the SSL template over the top of the live file. So copy ds-ssl.conf.templ to ds.conf,
then edit it. Scroll down to the HTTPS host and the two lines you need to change are the SSL
certificate and the SSL key. You can also use Let's Encrypt to automate this but that's beyond the
scope of this video so I'm just going to drop in the files. I'll link to Certbot's instructions
for NGINX in the video description, but again, you have Nextcloud so I'm assuming you have some
familiarity with certificates at this point. The value for ssl_certificate should be the path to
your certificate file, and ssl_certificate _key should be the path to your private key. One little
thing to be careful about here: the certificate file should include the full certificate chain and
not just the certificate itself. This will become important later. Often you'll find that you have
the certificate in one file and a separate file that contains the CA chain or bundle. If that's the
case you can easily combine them using the "cat" command it's "cat", certificate, chain, and output that
to a file that will contain your full chain. Make sure you put them in the correct order.
Now restart NGINX and if all is well you'll be able to access access ONLYOFFICE using HTTPS.
That's ONLYOFFICE installed and configured, now we'll jump over the Nextcloud to get it integrated.
Logged in as an admin go to "Apps" in the menu under your profile icon. If you have Nextcloud Office
enabled under "Active apps" go ahead and click the "Disable" button. We don't need that anymore. Now
just click on the search button here and search for ONLYOFFICE, then click "Download and enable".
It should only take a few seconds. Back to the menu dropdown and this time you want "Administration
settings". Scroll down and you should see ONLYOFFICE in the menu to the left. Enter the HTTPS
URL for your ONLYOFFICE server. For the secret key look in the file /etc/onlyoffice/documentserver/local.json.
Have a look in this section called "secret" and you'll find a randomly
generated string. That's the secret key you need to give to Nextcloud. Before we leave this file, though;
check the "Authorization" value for these header settings. Depending on how you've installed
ONLYOFFICE, it may say "Authorization" or it may say "AuthorizationJWT". If it's the latter then delete
the letters "JWT" just says "Authorization". Save the file and restart the supervisord service
to apply any changes. Pow paste your secret key into Nextcloud and click "Save". At this point
there are several errors you might encounter, so let's work through a few fixes to problems where
people tend to get stuck. Firstly, if you find that NGINX won't start and you're getting permissions
errors related to your certificate files, but you've checked the permissions and they're
definitely correct: you might want to check if SELinux is getting in the way. Because certificates
are often copied from elsewhere it's possible your file is tagged with the wrong SELinux context.
This will present as a permissions error in the logs. People may tell you to disable SELinux but
there is no need to do so, and it's not a good idea. Repeat after me: we do not disable security
to work around a misconfiguration! The easy way to fix this particular problem is to use the restorecon
command: "restorecon -RvF" and then the directory containing the files you want to fix the contacts
for. If NGINX is working but you're hitting problems with the Nextcloud integration settings
then make sure you've used secret key from the local.json file on the ONLYOFFICE server. This
key is randomly generated for each install. In older versions this wasn't the case but
it is now, so use your own and don't copy-paste someone else's from the internet. Also, remember
what I said about using the full certificate chain? This applies to both NGINX for ONLYOFFICE
and Apache for Nextcloud. Both of them need access to the entire certificate chain. If
you just give wither of them the certificate itself it will work fine in your web browser because
your web browser will go out to the internet to find the rest of the chain, and as long as it can
trace it back to a trusted root certificate it will be happy. The Nextcloud and ONLYOFFICE
servers won't do this. Each of them expects the other to present the full certificate chain back
to a trusted root. Most of the guides I've seen tell you to disable certificate validation to
work around the problem, but we don't accept such half measures; because remember: we don't disable
security features because of a misconfiguration! If ONLYOFFICE is not using the full chain your
error will mention an SSL certificate problem. If Nextcloud is not using the full chain you'll get an
"Error while downloading the document file to be converted". You'll get the same error if you didn't
set the "Authorization" header correctly, too. Finally, if you've done everything correctly and you get an
error that says "403 Forbidden" then it's likely to be an issue with your secret key not being
applied everywhere in ONLYOFFICE. this seems to happen on a fresh install. I'm not entirely sure
why, but I do know they have a script to fix it. Again, be wary of guides that tell you to start
deleting security-related configuration; because yes, we can make this error go away by deleting a
secret string section used for URL signing; but I'm really hoping that by now you're coming around the
idea that it's better to fix things properly than go the lazy route and disable security features.
To fix this one: with root permissions run "documentserver-update-securelink.sh".
Now click "Save" again in Nextcloud and there you go: problem solved! We can test this by clicking on
a document and checking it opens in the browser. One slight Quirk I've noticed is that following
some UI changes Nextcloud made in version 25, at the time of recording it gets wedged inside this
rounded border. If you don't like this behaviour you can go back to the ONLYOFFICE settings in
Nextcloud, and if you scroll down just before the file format settings you have a tickbox to open
the file in the same tab. If you turn that off then when you click on a document ONLYOFFICE
will open it in a new tab and it won't be stuck inside that rounded border. Personally, although
the border doesn't actually affect functionality I don't really like it, and I prefer it this way.
In addition to opening documents by clicking on them, you can also create new documents and
forms from the plus icon, here. This seems to be as good a time as any to talk to you about that
little forms enhancement I mentioned earlier. See, ONLYOFFICE have done quite a bit of work to try
and make it easier to create and use fillable forms; but I didn't talk about it in the last
video because it's an ONLYOFFICE-specific thing and I was more interested in Microsoft Office
compatibility. If the feature required everyone to have a copy of ONLYOFFICE installed it was
breaking compatibility in the other direction for me. However, once we've integrated ONLYOFFICE with
Nextcloud it gets more interesting; because now you don't need to have ONLYOFFICE installed if
you're distributing the forms through Nextcloud. The story goes that ONLYOFFICE were frustrated
that both the Microsoft Office content controls and Adobe Forms had practical limitations, either
with compatibility or functionality, so they built their own formats and combined the best features
of both; and work on the web, mobile, desktop, and are open source. They're also an extension to the
existing Microsoft Open XML standard so I think the hope is that other vendors might use them
as well. Now, I have never used Adobe Forms. I mean I've filled them in but I've never created them. I
have used Microsoft Office content controls... and they're a pain. The fact that you need to enable
an optional developer toolbar just to access them kind of tells you all you need to know.
From a quick play with ONLYOFFICE's approach, two things stood out. One is that splitting the
editing format from the file you distribute to end-users makes the end-user experience a lot simpler. The
other is that having a dedicated tool for making these forms is a heck of a lot easier to use than
a buried away developer toolbar. Here's the bit I really like. Although there's a new format
here with extra features, you can just save them as a standard DOCX or PDF file. So
forgetting Nextcloud and new document formats for a moment: the next time I'm faced with creating a form
for Microsoft-land I'm just going to build it in ONLYOFFICE, then save it as a DOCX where it'll
appear as Microsoft content controls. It'll save me time and nobody's going to be any the wiser.
So there you go! In looking at ways to improve my Nextcloud experience I've ended up finding a
way to improve my desktop forms experience. Niche, perhaps; but worth sharing I thought. What's also
worth sharing is this video! Go on. If you found it at all useful hit the like button and share it
with anyone it might help. If you want more detail about the Office compatibility issues that pushed me
toward ONLYOFFICE in the first place, watch this video here; and if you'd like to learn more about
Nextcloud, watch this video. That one is a bit dated because ownCloud have now released their
Infinite Scale platform. Get subscribed and drop me a comment to let me know if you'd like to see
a video about that. It is on my to-do list, but it's a long list and every comment bumps it up a spot!