Linux Format

Installing CODE

Time to add the office-ey bits with CODE’s easy-touse (and hard to break) Docker image.

-

For our next trick, we’re going to install the CODE package. Collabora does provide a PPA from which you can install native DEB packages (see www.collaborao­ffice.com/code/ linux-packages), but it’s a whole lot easier to use its Docker image here. There is a docker.io package in the Ubuntu repositori­es, but it’s recommende­d to use the official package. Add the Docker repo with the following (you can copy and paste this incantatio­n from the Apt repository section of https://docs.docker. com/engine/install/ubuntu): $ curl -fsSL https://download.docker.com/linux/ ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/ docker.gpg

$ sudo chmod a+r /etc/apt/keyrings/docker.gpg

$ echo \ “deb [arch=”$(dpkg --print-architectu­re)” signed-by=/etc/apt/keyrings/docker.gpg] https:// download.docker.com/linux/ubuntu “$(. /etc/

os-release && echo “$VERSION_CODENAME”)” stable” | sudo tee /etc/apt/sources.list.d/docker.list > / dev/null

Then install Docker with:

$ sudo apt update

$ sudo apt install docker-ce

This should start the Docker daemon – check with systemctl status docker . If all is well, fetch the CODE

image with:

$ sudo docker pull collabora/code

This is about 500MB, so once it had downloaded, our clean Ubuntu Server install had grown to 12GB. Space is thus another resource to keep in mind when running on a cheap VPS. Now we can run the container:

$ sudo docker run -t -d -p 9980:9980 -e “extra_

params=--o:ssl.enable=false” collabora/code

In order to use CODE, we need to install the companion app. From the top-right menu select Apps, then find the Office & Text link on the left. Add the Nextcloud Office app (not the Collabora Online

one with the built-in server). Now find the Nextcloud Office section in the Administra­tion screen. Check the Use Your Own Server button and enter http://[ip address]:9980 in the server box. You can’t use localhost or 127.0.0.1 here because these resolve differentl­y inside the container.

We’ve run CODE in quite an insecure configurat­ion here (it only works on local installs, so don’t worry). If you’re connecting to Nextcloud over HTTPS (either with a genuine certificat­e or the self-signed one), you’ll see an error saying CODE should use the same protocol as the Nextcloud server. For the self-signed certificat­e, work around this by logging into Nextcloud via HTTP (you need to clear site cookies for this to work). If you already have a domain set up, you need to stop and delete that container (which you should also do in any case when you’re done testing). Find its name (or id) from the output of sudo docker ps , then replace that in the following:

$ sudo docker stop [container_name]

$ sudo docker rm [container_name]

To get the Docker container working with an actual domain name, run instead:

$ sudo docker run -t -d -p 127.0.0.1:9980:9980 -e ‘domain=nextcloud\\.example\\.org’ -e “extra_

params=--o:ssl.enable=false --o:ssl.terminatio­n=true” --restart always collabora/code

The backslashe­s are there (and we quote) to stop Bash from eating the dots. Note that domain here is the domain Nextcloud is running on, not the one where you want the CODE server to be reached. It’s specified here to restrict access to code. We’ve again disabled SSL, which might seem counter-intuitive, but we’ve also specified SSL terminatio­n. This way, the container thinks it’s behind an SSL-terminatin­g proxy, so it won’t worry about it.

In order for this to work, then, we had better set up such a proxy. Its job will be to take traffic from our registered domain, such as code.example.org, and tunnel it through to the Docker container. This allows both to be run (securely) from the same machine. It also saves us having to shoehorn certificat­es into the Docker container. We first need some Apache modules (these might already be active on your setup):

$ sudo a2enmod proxy proxy_http proxy_connect

proxy_wstunnel

Now we define a new virtual host by creating /etc/ apache2/sites-available/code.conf with the following text (which you may prefer to cut and paste from https://sdk.collaborao­nline.com/docs/installati­on/ Proxy_settings.html):

ServerName code.example.org

Options -Indexes

ErrorLog “/var/log/apache2/collabora_error” AllowEncod­edSlashes NoDecode ProxyPrese­rveHost On retry=0 ProxyPass /loleaflet http://127.0.0.1:9980/loleaflet loleaflet ProxyPassR­everse /loleaflet http://127.0.0.1:9980/ ProxyPass /hosting/discovery http://127.0.0.1:9980/hosting/discovery retry=0 ProxyPassR­everse /hosting/discovery http://127.0.0.1:9980/hosting/discovery ProxyPass /hosting/capabiliti­es http://127.0.0.1:9980/hosting/capabiliti­es retry=0 ProxyPassR­everse /hosting/capabiliti­es http://127.0.0.1:9980/hosting/capabiliti­es

ProxyPassM­atch “/lool/(.*)/ws$” ws://127.0.0.1:9980/ lool/$1/ws nocanon

ProxyPass /lool/adminws ws://127.0.0.1:9980/lool/

adminws

ProxyPass /lool http://127.0.0.1:9980/lool ProxyPassR­everse /lool http://127.0.0.1:9980/lool

Now we can enable the new site and restart Apache:

$ sudo a2ensite code.conf

$ sudo systemctl restart

Finally, we use Certbot again to generate certificat­es for CODE’s domain, this time skipping agreeing to the terms (which we agreed to last time) and autopopula­ting the email address:

$ sudo certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email you@example.org -d code. example.org

Now go to the Office section of the Administra­tion settings, and use https://code.example.org as the server URL. A reassuring­ly green tick should appear, telling you that your Collabora Online server is reachable. Remember that it will take some time for DNS records to propagate from your DNS registrar to the internet at large, so have a cup of tea (or perhaps several – in some grave cases, the propagatio­n can take 24 hours). You should now be able to open the

Welcome to Nextcloud.docx example file. If not, have a look at the Nextcloud logs or the Apache error log at

/var/log/apache2/collabora_error.

Running a Nextcloud server is a superb achievemen­t (so bravo if you’ve followed along successful­ly thus far), but it isn’t much use unless you set up some clients to use it. You’ll certainly want to install the Nextcloud Desktop Sync Client on your home PC. It’s available as a Snap and Flatpak, or direct from Nextcloud as an AppImage (see https://nextcloud.com/install). Traditiona­lists may prefer to install the client through Apt, however:

$ sudo apt install nextcloud-desktop

Fire up the app and pop in your Nextcloud address

(https://example.org/nextcloud, for example) and credential­s. By default, it adds a Nextcloud directory inside your home directory, which is automagica­lly synced with the client. There are also apps for Windows, Mac and mobile (Android users can get it off F-Droid if they want to avoid the big G’s store). By syncing your phone’s camera directory with Nextcloud, you get an instant cloud storage solution for your photos. It’s a wise idea to set a quota on Nextcloud’s storage, though, because things will go rapidly downhill if the server runs out of disk space.

 ?? ??
 ?? ??
 ?? ?? Besides documents, you can also create wonderful diagrams to spruce up your TPS reports.
Besides documents, you can also create wonderful diagrams to spruce up your TPS reports.
 ?? ?? Add an unprivileg­ed user and keep the admin account clean for, well, administer­ing things.
Add an unprivileg­ed user and keep the admin account clean for, well, administer­ing things.
 ?? ??
 ?? ??

Newspapers in English

Newspapers from Australia