58.1 Nextcloud Installation

20201208 A personal nextcloud server can be deployed on Ubuntu 20.04 running on a Digital Ocean server costing $5 per month with some 20GB for data storage (100GB is an additional $10 per month).

For your own domain like example.com set up nextcloud.example.com as an external reference (A record) on your DNS with the IP address of your server.

Connect to the server and prepare it for running Nextcloud:

$ ssh root@nextcloud.example.com
# apt update
# apt upgrade
# apt install python3-pip
# pip3 install wajig
# adduser ktw
  New password: 
  Retype new password: 
# usermod -aG sudo ktw
# ufw allow OpenSSH
# ufw enable
  Command may disrupt existing ssh connections. Proceed with operation (y|n)? y
  Firewall is active and enabled on system startup
# rsync --archive --chown=ktw:ktw ~/.ssh /home/ktw
$ ssh ktw@nextcloud.example.com
$ sudo reboot

Now connect as the user ktw to the server and install Nextcloud:

$ ssh ktw@nextcloud.example.com
$ sudo snap install nextcloud
  nextcloud 20.0.2snap2 from Nextcloud installed
$ sudo nextcloud.manual-install ktw <password>
  Nextcloud was successfully installed
$ sudo nextcloud.occ config:system:set trusted_domains 1 --value=nextcloud.example.com
  System config value trusted_domains => 1 set to string nextcloud.example.com
$ sudo ufw allow 80,443/tcp
$ sudo nextcloud.enable-https lets-encrypt
  Please enter an email address (for urgent notices or key recovery): ktw@example.com
  Please enter your domain name(s) (space-separated): nextcloud.example.com
  Attempting to obtain certificates... done
  Restarting apache... done

Move data store to the additional storage (removable device):

$ sudo snap connect nextcloud:removable-media
$ sudo mkdir -p /mnt/volume_sgp1_02/nextcloud
$ sudo snap stop nextcloud
$ sudo editor /var/snap/nextcloud/current/nextcloud/config/config.php
  Replace
    'datadirectory' => '/var/snap/nextcloud/common/nextcloud/data',
  With
    'directory' => '/mnt/volume_sgp1_02/nextcloud/data',
$ sudo mv /var/snap/nextcloud/common/nextcloud/data /mnt/volume_sgp1_02/nextcloud
$ sudo snap start nextcloud

Then visit https://nextcloud.example.com to login to the nextcloud server. A nextcloud client is then run on your laptop or desktop or mobile device to synchronise data and other services across all your devices.

Further information is available from Digital Ocean to and the . Nextcloud provides a guide to move the data to a different



Your donation will support ongoing development and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.