Regulars will be familiar with our ranting and raving about how great Nextcloud is. And it keeps getting better – the latest edition of the self-hosted storage and sharing platform, Nextcloud 19, sees it transformed into a complete Collaboration Hub.
If you already have a LAMP (Linux, Apache, MySQL, PHP) or equivalent stack set up on a home server or VPS, you can easily add a Nextcloud instance to it, either by extracting an archive to your web server’s root directory, or by copying the Web Installer PHP file there and running it directly.
Setting up a LAMP stack (or indeed a LEMP stack with Nginx and MariaDB) is easy enough (although it’s a bit of a faff having to create databases by hand) in Ubuntu or Debian – we’ve covered it before and there are countless guides a mere DuckDuckGo search away.
This time around we’re going to install Nextcloud differently, via Docker. In theory this will mean our instance will be portable, so you could go from running on your VPS to running on a home server, or vice versa, with relative ease.
Data and configuration are stored in volumes outside the Docker container (which you should consider a fairly ephemeral, fungible thing), so migrating the service just involves copying those volumes and connecting them to a new instance of the container.
First on the agenda is to install the Docker engine which requires adding their GPG key to the apt keyring:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - $ sudo apt-key fingerprint 0EBFCD88
You should check the fingerprint of that key matches the one beginning 9DC8 and given in full in the online documentation (where you can also copy and paste these lengthy commands).
Next add the Docker repos (change focal to bionic if you’re using 18.04), update caches and install Docker with:
$ sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable” $ sudo apt update $ sudo apt install docker-ce docker-ce-cli containerd.io
Check that it’s working by running the Hello World image, then fire up the Nextcloud image:
$ sudo docker run hello-world $ sudo docker run -d -p 8080:80 nextcloud
The first switch tells Docker to run the container detached (in the background), and the second tells it to expose the container’s port 80 (where the webserver is running) to port 8080 on our server.
So now – once a few hundred megs are downloaded and the container springs in to life – if you browse to http://yourserver:8080 (with your address or hostname) you should find the Nextcloud welcome screen.
You’ll see a warning about the container using SQLite; this lightweight database will be fine for a few users, but more popular setups will need a proper MySQL or MariaDB instance.
Go back to the terminal, find your container’s name (from the last column of the first command) and stop it with:
$ sudo docker ps -a $ sudo docker stop yourcontainername
Current page: NextcloudPrev Page Jitsi? Probably too much coffee Next Page Nextcloud via Docker... continued
Are you a pro? Subscribe to our newsletter
Sign up to the TechRadar Pro newsletter to get all the top news, opinion, features and guidance your business needs to succeed!