How can I create a personal cloud server?

Updated: 04/02/2019 by Computer Hope
Illustration: Syncing a desktop computer, laptop, and smartphone with Nextcloud.

Cloud computing services have become widely used, ranging from cloud storage services, like Dropbox and iCloud, to productivity suites, like G Suite and Office 365. These services offer the ability to sync documents across devices and to use professional software from any web browser or mobile device. As cloud computing matures, an increasingly popular solution is for users to operate a personal cloud server.

In these instructions, we'll create a cloud storage service that you control using the open-source software, Nextcloud. We'll create a local test server, limited to operating in your local network. Then we'll install the Nextcloud client on your desktop computer and mobile device, and synchronize files between them. Then we'll show how you can run this same general configuration on a remote hosting service, so you can access your cloud from anywhere.

About Nextcloud

Nextcloud is a cloud storage server designed to scale to hundreds of thousands of users. You can run the client software on Windows, macOS, Linux, Android, and iOS, syncing files to multiple devices.

You can also access your files on the web by logging in to your Nextcloud web portal. The portal features an Administrator Control Panel, where you can add users, configure group permissions, and set individual disk quotas. The portal also uses a plugin system to provide additional features, such as real-time chat and video conferencing for you and your other users.

To learn more about Nextcloud, visit the official website at https://nextcloud.com.

Create a local Nextcloud server

Note

If you want to skip the local installation, and install Nextcloud on a web hosting service with a domain name, proceed to running Nextcloud on the Internet.

In this section, we create a Nextcloud server on your local network. The cloud service will only be available to devices connected to your network. This setup lets you try out Nextcloud in the security of your local network, without spending any money on a domain name or a remote web hosting service.

You could run the server on a dedicated computer, but for testing, it's easier to install it on a VM (virtual machine), which you can run on your primary computer. Your computer will require the following resources:

Download Ubuntu 18 Server

Nextcloud requires a server running Linux. The recommended Linux OS for Nextcloud is Ubuntu Server, so that's what we'll use in this example.

Ubuntu is free to download and use. Download Ubuntu Server 18.04 from http://releases.ubuntu.com/18.04.2/ubuntu-18.04.2-live-server-amd64.iso. It's a large file, at about 2 GB.

Install VirtualBox and create a VM

In this example, we use Oracle VM VirtualBox to create and run our VM. VirtualBox is free of charge for personal use.

  1. In a browser, go to https://www.virtualbox.org/wiki/Downloads. Click Windows hosts to download the installer for Windows.
  2. Run the installer using the default installation options. When the installation is complete, run VirtualBox.
  3. In VirtualBox, click New to create a new virtual machine.

Screenshot: Click the New button.

  1. Name the VM. The name can be anything, but it should contain the word Ubuntu. Make sure "Type" is set to Linux and "Version" is set to Ubuntu (64-bit). Click Next.

Screenshot: Give the virtual machine a name containing the word Ubuntu.

  1. Set the "Memory size" to 1024 MB (1 GB). Click Next.

Screenshot: Set the memory size to 1024 MB.

  1. For "Hard disk," choose Create a virtual hard disk now and then click Create.

Screenshot: Select Create a virtual hard disk now, and click Create.

  1. For "Hard disk file type," choose VDI. Click Next.

Screenshot: Select Hard disk file type VDI.

  1. For "Storage on physical hard disk," choose Dynamically allocated.

Screenshot: Choose Dynamically allocated.

  1. For "File location and size," choose a disk size of 10 GB. (You can choose a larger size if you'd like.) Click Create.

Screenshot: Choose disk size of 10 GB.

  1. Configure the network adapter, so it's part of your local network. With your VM highlighted on the left, click Settings.

Screenshot: Click the Settings button.

  1. On the left, click Network. On the right, under "Attached to," select Bridged adapter. Click OK.

Screenshot: On the left, click Network. In the Attached to: dropbdown box, choose Bridged Adapter.

  1. The VM is ready to go. Click Start.

Screenshot: With the Ubuntu Server virtual machine highlighted, Click the Start button.

  1. At "Select start-up disk," click the folder icon, and choose the Ubuntu ISO you downloaded. If it's still downloading, wait until the download is complete. Click Start.

Screenshot: In the Select start-up disk window, click the folder icon. Select the Ubuntu Server ISO file you downloaded.

The Ubuntu Server ISO boots. Your virtual machine is up and running.

Install Ubuntu Server on your VM

Your VM boots into the Ubuntu Server live ISO, which contains the Ubuntu installer.

Note

When you click inside the VM window, it will capture your mouse and keyboard. Your mouse cursor will disappear, and you may not be able to use Windows shortcuts such as Alt+Tab. You can release the keyboard and mouse by pressing the VirtualBox "Host Key," which is the right Ctrl key on your keyboard. To continue using the VM, click inside its window again.

Note

The installer interface is text-only. In the following steps, use the up, down, and Tab keys to change the highlighted option, the spacebar to toggle a check box, and Enter to make a selection.

  1. Set your keyboard type. If you're using a standard US keyboard, press Enter.
  2. Choose Install Ubuntu and press Enter.

Screenshot: When the virtual machine boots from the Ubuntu Server Live ISO, choose a keyboard layout, then choose Install Ubuntu.

  1. Under "Network connections," choose the network adapter that Ubuntu should use. In this example, we want it to use our Ethernet connection (eth). Choose Done and press Enter.

Screenshot: Select your network adapter, then choose Done.

  1. At "Configure proxy," press Enter.
  2. At "Configure Ubuntu archive mirror," press Enter.
  3. Under "Filesystem setup," choose the default, Use an Entire Disk. Press Enter.

Screenshot: In Filesystem setup, choose Use an Entire Disk.

  1. The 10 GB VirtualBox VDI is the only disk. At "Choose the disk to install to," press Enter.

Screenshot: Choose the VirtualBox VDI as the disk to install to.

  1. Review the summarized information, then choose Done and press Enter.
  2. Under "Confirm destructive action," choose Continue and press Enter.

Screenshot: At Confirm destructive action, choose Continue.

  1. Under "Profile setup," create a new user profile. The new profile will also be the default Ubuntu administrator account. "Your name" can be anything you like. For "Your server's name," enter a hostname for your computer (using only numbers, lowercase letters, dashes, and underscores), such as nextcloud. For "username," choose the name you will use to log in to the computer (using lowercase letters and no spaces). Choose a password, and enter it again to verify. Choose Done and press Enter.

Screenshot: In Profile Setup, create an administrator user profile, and set your hostname.

  1. Under "SSH setup," select the box marked Install OpenSSH server. An SSH allows you to remotely connect to the machine if necessary. Choose Done and press Enter.

Screenshot: Mark the box labeled Install OpenSSH, then choose Done.

  1. Under "Featured Server Snaps," choose Nextcloud. Choose Done and press Enter.

Screenshot: Under Featured Server Snaps, select Nextcloud, then choose Done.

  1. The installation process will continue. When it's done, choose Reboot now to boot the installed operating system.

Screenshot: When installation is complete, choose Reboot Now to restart the virtual machine, and boot Ubuntu Server.

Configure Ubuntu and install Nextcloud server

  1. When the server boots, log in with the name and password you chose during Ubuntu profile setup.
Note

You might notice that the login prompt gets mixed up with other system messages. If you don't see the login prompt, press Enter to display a new one.

Screenshot: When you boot Ubuntu Server, log in with your administrator name and password. If you don't see a login prompt, press Enter.

  1. Perform an initial system update. Run sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade. Enter your password when prompted. If you're asked to confirm an upgrade, type y, and press Enter.

Screenshot: Run sudo apt-get update, then run sudo apt-get upgrade.

  1. Add a firewall rule to allow OpenSSH connections. Run sudo ufw allow OpenSSH.
  2. Run sudo ufw enable to enable the firewall.
  3. Run sudo ufw status to verify that the firewall is filtering the server's network traffic.

Screenshot: Run sudo ufw allow OpenSSH, then run sudo ufw enable.

  1. Start the Nextcloud installer. Run sudo nextcloud.manual-install user pass. For user and pass, choose the name and password you want to use with your Nextcloud account. It can be different than your Ubuntu name and password. This account is the Nextcloud administrator account.

Screenshot: Run the command sudo nextcloud.manual-install username password.

After a few moments, you'll see:

 Nextcloud was successfully installed
  1. Next, open ports 80 (HTTP) and 443 (HTTPS) in your firewall. Run sudo ufw allow 80,443/tcp.

Screenshot: run sudo ufw allow 80,443/tcp.

  1. Nextcloud maintains an internal list of trusted domains. Only requests addressed to these domains will get a response from the Nextcloud server. By default, the only trusted domain is localhost (the server can only respond to itself). To view the trusted domains, run sudo nextcloud.occ config:system:get trusted_domains.

Screenshot: sudo nextcloud.occ config:system:get trusted_domains

  1. You need to add your server's IP address to the trusted domain list. First, determine your server's IP address. Run ip a | grep inet to find the IP address of the server on your local network. If you are on an IPv4 network, it should start with 192.168 or 10.0.

Screenshot: Run up a | grep inet.

  1. Here, our address is 192.168.1.173. Now, set this address as a trusted domain. Run sudo nextcloud.occ config:system:set trusted_domains 1 --value=domain, where the domain is the IP address of your server.

Screenshot: Add your server's IP address to Nextcloud's list of trusted domains.

  1. Create an SSL certificate so that Nextcloud can encrypt your data over HTTPS. Because this cloud is restricted to your home network, you can use a self-signed certificate. Run sudo nextcloud.enable-https self-signed.

Screenshot: Enable HTTPS by generating a self-signed SSL certificate.

Server configuration is complete, and your cloud is operational. The Nextcloud service is running, and your server is listening on your local network for HTTP and HTTPS connection requests.

Log in to Nextcloud

To log in to your Nextcloud web dashboard, you need to add a security exception to your browser, so it accepts your self-signed SSL certificate. Normally, you would never want to create an exception like this, unless you control the server and network. (This step is not required if you're running Nextcloud on the Internet, in which case it uses Let's Encrypt to provide SSL certificates.)

  1. In a browser, go to the address of your Nextcloud server. In this example, the address is 192.168.1.173.
  2. Your web browser will warn you that the SSL certificate is self-signed. In Chrome, click Advanced, then Proceed to...

Screenshot: In Chrome, click Advanced, then Proceed to (your server address).

If you're using Firefox, click Advanced, Add Exception, Confirm Security Exception.

Screenshot: In Firefox, click Advanced, Add exception, Confirm security exception.

  1. Enter your Nextcloud username and password, as you configured them when installing Nextcloud. Click Log in.

Screenshot: Log in with your Nextcloud admin user and password.

  1. In the Nextcloud dashboard, you can view and work with the files you've stored in the cloud. If you click the gear icon (⚙), you can access Administrator settings and customize your server preferences. No configuration is necessary to begin using Nextcloud, so we won't change anything now. For a detailed guide to Nextcloud preferences, see https://docs.nextcloud.com/server/15/user_manual/userpreferences.html.

Screenshot: The Nextcloud dashboard.

How to use Nextcloud

Your server is running, and now it needs clients. In these steps, you'll install the Nextcloud client on your desktop computer, and on a smartphone.

Install Nextcloud client on your desktop computer

  1. In a browser, go to https://nextcloud.com/install/. Click Download for desktop.
  2. Click Windows. The installer will download.

Screenshot: Choose the operating system of your desktop computer to download the appropriate Nextcloud client.

  1. Run the installer, leaving all options at the defaults. When the installation is complete, check Run Nextcloud, and click Finish.

Screenshot: Run the Nextcloud installer. When installation is complete, choose Run Nextcloud, then click Finish.

  1. At the Nextcloud Connection Wizard, click Log in.

Screenshot: In the Nextcloud Connection Wizard, click Log in.

  1. For Server Address, enter the IP address of your server.

Screenshot: Enter the IP address of your server.

  1. You are notified that the server certificate is untrusted (because it is self-signed). Check the box labeled Trust this certificate anyway. Click OK.

Screenshot: Check the box labeled Trust this certificate anyway, then click OK.

  1. Click Log in.
  1. Enter the name and password that you chose when installing Nextcloud. Click Log in.

Screenshot: Enter your Nextcloud name and password, and click Log in.

  1. Click Grant access.

Screenshot: Click Grant access.

  1. At "Setup local folder options," click Connect.

Screenshot: At the Local folder options screen, leave everything at default values, and click Connect.

  1. Nextcloud starts its first sync, and downloads the default "Welcome to Nextcloud" files to your local folder.

Screenshot: First sync.

  1. When your local folder is in sync with the server, you'll see a white checkmark in a green circle. When a sync is in progress, this icon turns blue with a white arrows.

Screenshot: Nextcloud Syncing (blue with white arrows) and In Sync icons (green with white checkmark).

  1. You'll also see the icon in your notification area. Click this icon to open the Nextcloud window. Right-click it for a menu of options, including Pause synchronization, Settings, and Quit.

Screenshot: The Nextcloud icon in the systray.

Congratulations! You're now running a private cloud server, and syncing to a client. To access your local Nextcloud folder, open a File Explorer window (press Win+E). On the left, click Nextcloud.

Screenshot: In File exlorer, the Nextcloud icon is in the left pane.

If you add files or folders here, they will automatically be synced to the cloud, and to any other devices running the client.

Install Nextcloud client on your mobile device

Note

The screenshots in this section are on an Android device, but the steps are the same on iOS.

  1. Install the Nextcloud app. On Android, use Google Play Store. On iOS, use the App Store.

Screenshot: In the Google Play store, Install Nextcloud.

  1. Open the app, and tap Log in.

Screenshot: In the Nextcloud app, click Log In.

  1. When prompted, allow access to files on your device.

Screenshot: Allow Nextcloud to access your files.

  1. For the server address, enter the IP address of your server.

Screenshot: Enter the IP address of your Ubuntu server.

  1. Tap Yes to trust the self-signed certificate.

Screenshot: Tap Yes to trust your server's self-signed cert.

  1. Tap Log in.
  1. Enter the name and password you configured in installing Nextcloud and tap Log in.

Screenshot: Log in with your Nextcloud name and password.

  1. Tap Grant access.

Screenshot: Grant access.

  1. Nextcloud is now installed. However, no files are synced yet. On mobile, where storage is at a premium, the Nextcloud client will not sync anything to your device until you ask for it. To view what's available to sync from your Nextcloud, tap the main menu button ( ☰ ).

Screenshot: Click the hamburger menu button in the upper left. It looks like three hotizontal lines.

  1. Choose All files.

Screenshot: Tap All Files.

  1. Here, you see the files already on your Nextcloud server. To sync something to your device, tap the three dots ( ⋮ ) next to the file or folder, and choose Sync.

Screenshot: To sync an item to your device, click the three vertical dots next to the item, and choose Sync.

  1. To work with files that are synced to your device, open the main menu ( ☰ ) and choose On device.

Screenshot: Tap the hamburger menu, and tap On Device.

  1. To upload files from your device to Nextcloud, open the folder where you want to put the file, and tap the plus icon (+).

Screenshot: Click the Plus icon to add files from your device to the cloud.

Starting and stopping the VM

Your Nextcloud server is now available to any devices connected to your local network, as long as your VM is running. However, you will want to stop the server when you're done testing, or when you need to shut down or reboot your computer.

You can shut down your Ubuntu server from the Ubuntu Server command line by running sudo shutdown now. To start the server later, select the VM in your VirtualBox window, and click Start.

Alternatively, you can save the machine state. Saving state will freeze the VM and all its current memory contents, and resume from this point when you start it later. To save the state, hold down the right Ctrl button on your keyboard, and press Q. Select Save the machine state, and click OK.

Screenshot: In VirtualBox, hold the right Ctrl button and press the Q key, then choose Save state.

Running Nextcloud on the Internet

If you want to access your cloud from anywhere, you can create this same setup on a remote host, such as Linode or DigitalOcean.

These steps require that you own a domain name. You will configure Nextcloud to use a subdomain of your existing domain, such as subdomain.mydomain.com. For more information about how to register a domain name, see how do I register a domain name?

In the following example, we will set up Nextcloud on a Linode "Nanode," their minimal hosting option. As of March 2019, a Nanode offers 1 CPU, 1 GB RAM, and 25 GB SSD for your hosting instance, priced at $5/mo.

Note

These steps also work on the equivalent $5/mo hosting option at DigitalOcean.

Create an Ubuntu Nanode and configure your domain

  1. Log in to your Linode account. Go to https://www.linode.com/, and click Log in. Enter your Linode name and password.
  1. At the Linode dashboard, click Create, and choose Linode.
  1. Under "Create from image," "Public Images," choose Ubuntu.
  1. For "Region," choose the location that is geographically closest to your usage area.
  1. For "Linode Plan," chose Nanode. (You can choose a more expensive hosting option if you prefer.)
  1. For "Root password," set the Administrator password for your hosting instance. The first time you log in to the instance, you will log in as username root, and the password you set here.
  1. Click Create.
  1. Determine the IP address of your server. In the Linode dashboard, click Linodes on the left. On the right, you'll see the IPv4 and IPv6 address of your Nanode. Copy down the IPv4 address.
  1. Log in to your domain name registrar account. Add a new DNS resource record to your domain name's DNS settings. (If you're not sure how to add a record to your domain name, check the documentation on your registrar's website.) Create a new Type A record. The Name of the record is the subdomain name. For example, you could name it nextcloud, mycloud, or anything else you like. (The name should contain only lowercase letters, numbers, dashes, or underscores, and no spaces). Set the Data entry of the record to the IP address of your Nanode, which you wrote down in the previous step.

Configure Ubuntu, and install Nextcloud server

  1. In your Linode dashboard, on the left, click Linodes. Under your new Nanode, click Launch Console.
  1. If necessary, press Enter to get a login prompt. For the user, enter root. For password, enter the root password you configured when creating the Nanode.
  1. Update the system.
 apt-get update && apt-get upgrade && apt-get dist-upgrade
Note

If you are prompted about updating your GRUB configuration, choose to keep the currently installed GRUB configuration.

  1. Create a regular system user, so you can log in as someone other than root. Run the adduser command. The username can be anything you like (lowercase letters, numbers, dashes, and underscores, no spaces). Enter a password, then enter it again to verify it. The rest of the information can be left blank. When prompted, type y and press Enter to create the user.
 adduser username
  1. Next, run usermod to add this user to the "sudo" group, so you can run administrator commands without logging in to the root account.
 usermod -aG sudo username
  1. Your regular user can now run commands with sudo. Log out of the root account.
 exit
  1. Log in again, with the regular user's name and password.
  1. Run the following command to check if the snap package manager is installed, and if not, install it.
 if ! which snap; then sudo apt-get install snapd; fi
  1. Install the Nextcloud server snap package. When prompted, enter the regular user's password.
 sudo snap install nextcloud
  1. Install the Nextcloud server. For newuser and newpass, enter a new username and password for the Nextcloud administrator account. (You'll use these to log in to the Nextcloud client apps and web portal.)
 sudo nextcloud.manual-install newuser newpass
  1. Configure the firewall to allow OpenSSH, HTTP, and HTTPS connections, then enable the firewall.
 sudo ufw allow OpenSSH
 sudo ufw allow 80,443/tcp
 sudo ufw enable
  1. Set your subdomain as a Nextcloud trusted domain. Only requests made to this domain name will receive a response from Nextcloud. In the next command, replace subdomain.mydomain.com with your subdomain name.
 sudo nextcloud.occ config:system:set trusted_domains 1 --value subdomain.mydomain.com
  1. Enable HTTPS using Let's Encrypt. This step will automatically create an SSL certificate for you, that needs to be renewed (for free) every 90 days.
 sudo nextcloud.enable-https lets-encrypt
  1. Verify that you meet the requirements, then type y to continue.
  1. At "Enter an e-mail address," enter an e-mail address where Let's Encrypt can notify you about certificate renewal.
  1. At "Enter your domain name(s)," enter your subdomain name, for example, subdomain.mydomain.com.

Your Nextcloud is now running on the Internet. You can use it as described in the section how to use Nextcloud, but instead of a local IP address, you'll use your subdomain name.

If you enter your subdomain name in a web browser, you can log in to the Nextcloud web portal with your Nextcloud administrator username and password. When installing the Nextcloud client, use your subdomain name as the Nextcloud server address.

Best of all, you will not need to add any trust exceptions to your browser or client, because Let's Encrypt certificates are registered with a trusted certificate authority.

General Nextcloud tips

Saving big files

If you're working with a big file and saving it frequently, Nextcloud might have trouble syncing it. This problem arises when you make changes to the file faster than it can be uploaded to the server. If you encounter this problem, wait until the Nextcloud icon in your notification area turns green before saving your document again. Or, right-click the Nextcloud icon and choose Pause synchronization. When you're ready, right-click the icon and choose Resume synchronization to upload your changes to Nextcloud.

Resolving conflicts

If changes are made to a file on two separate devices, either at the same time or while one device is not running the Nextcloud client, conflicts may arise. The conflict occurs when you try to sync both versions of the file.

If the Nextcloud server isn't sure which version of the file you want to keep, it will keep them both, and display a warning in the client window. The Nextcloud icon will change to a yellow circle with an exclamation mark.

Screenshot: Click the yellow text bar to view conflict details.

Click the yellow message bar to view the activity log, and find out which files are having a conflict.

Screenshot: In the activity log, you can see which files are conflicted.

The conflicting file will be renamed to include "conflicted copy" and the date. You can open both versions of the file and compare them, to figure out which one you want to keep.

To resolve the conflict, move the conflicted copy to a location outside of your Nextcloud folder, such as your desktop. Or, if you're sure, you can delete it.

When your Nextcloud folder contains no files with "conflicted copy" in their file name, the conflict is resolved. If your icon doesn't turn green right away, you can force a new sync, which will re-check the files in your local Nextcloud. In your client window, click the button with three dots ( ⋯ ) to the right of your main Nextcloud folder, and choose Force sync now.

Screenshot: In the Nextcloud client window, click the button with three dots next to your main Nextcloud folder. Choose Force sync now.

When the icon changes back to the green checkmark, your files are in sync again.