Blog / Articles / A Guide on Installing and Using Nextcloud on a VPS

A Guide on Installing and Using Nextcloud on a VPS

A Guide on Installing and Using Nextcloud on a VPS

Nextcloud, a leading player in the field of self-hosted, open-source file storage, and online collaboration solutions, offers an impressive suite of features catering to personal as well as business use, placing it in a league of its own. With Nextcloud, you can seamlessly sync and share files, manage your calendar, contacts, emails, and much more. It gives you complete control over your data, ensuring privacy and enabling you to avoid vendor lock-in. Moreover, Nextcloud's vibrant community of developers continuously innovates to add new features and fix potential vulnerabilities, resulting in an ever-evolving, robust platform.

In this article, we will dive deeper into why Nextcloud is considered the best self-hosted, open-source solution for personal cloud storage, team collaboration, file backup, archiving, media streaming, and many more applications. We will also provide a comprehensive guide to installing Nextcloud on a Virtual Private Server (VPS), allowing you to maximize the efficiency, flexibility, and privacy that Nextcloud offers. Let's get started!

What is Nextcloud?

Nextcloud is a versatile, open-source software that allows users to create a self-hosted, private cloud storage service. Originating as a fork of the ownCloud project in 2016, Nextcloud has since evolved into a full-fledged productivity platform, offering a broad range of functionalities beyond mere file storage.

Nextcloud's architecture is designed around the principles of security, privacy, and control. It is a web-based application primarily written in PHP and JavaScript, which makes it highly portable across various systems. The data stored in Nextcloud can be accessed through a web interface, desktop clients for Windows, MacOS, and Linux, or mobile apps for Android and iOS.

Core Features and Functionalities

Nextcloud offers an impressive array of features and capabilities that go far beyond traditional cloud storage services. Some of its key functionalities include:

  • File Hosting and Synchronization: The basic function of Nextcloud is to provide a private platform for storing, syncing, and sharing files. You can access your files from any device, anywhere, anytime - as long as you have an internet connection.

  • Collaboration Tools: Nextcloud includes built-in document editing tools, compatible with Microsoft Office and OpenDocument formats. Multiple users can edit a document simultaneously, similar to Google Docs. Additionally, it offers features like comments, tags, and versioning, making collaboration easier.

  • Communication: Nextcloud comes with its own secure communication platform, Nextcloud Talk, enabling users to chat, have audio/video calls, or conduct webinars directly within the platform.

  • Calendar and Contacts: Nextcloud provides an integrated calendar and contacts management system, enabling users to organize their schedule and manage their contacts seamlessly. These tools support standard protocols, making it easy to sync with other services.

  • Email Client: It even has a built-in email client that supports POP/IMAP protocols, allowing you to handle all your email accounts from a single interface.

  • Privacy and Security: Nextcloud puts a strong emphasis on security with features like end-to-end encryption, two-factor authentication, brute-force protection, and more. Being self-hosted, it gives you complete control over your data and who has access to it.

  • Extensibility: Thanks to its open-source nature and active developer community, Nextcloud can be extended with a wide range of apps. Whether you want to install a music player, a task tracker, or a Kanban board like Trello, there's likely an app for it in the Nextcloud App Store.

  • Scalability: Whether you're a single user looking to keep your personal data in control or a large organization with thousands of users, Nextcloud can scale to meet your needs.

Private, Self-Hosted Cloud Solution

Nextcloud’s greatest strength is its self-hosted nature. Unlike public cloud services where your data is stored on someone else's servers, with Nextcloud, you host your own data on your own server. This model provides a multitude of benefits, most notably full control over your data, enhanced privacy, and no vendor lock-in. It gives you the power to decide where your data resides and who has access to it. Whether you're an individual seeking control over your digital life, a team looking for an efficient collaboration platform, or an enterprise needing a secure and scalable cloud solution, Nextcloud delivers on all fronts. 

Nextcloud Compared to Other Competitors

In the market of file synchronization and sharing services, there's an array of options available, each with its own set of features, costs, and benefits. Let's compare Nextcloud to some of its key competitors, both open-source and proprietary.

  • Google Drive: As a part of Google's ecosystem, Google Drive offers seamless integration with other Google services. However, it's not self-hosted, and the data privacy is a concern for many users, as Google has access to the data stored on their servers.
  • Dropbox: Dropbox is another widely used platform, popular for its ease-of-use and reliability. But again, it is a paid service and is not self-hosted.
  • OneDrive: Microsoft's OneDrive offers tight integration with Windows and Office 365. However, it is not open-source, not self-hosted, and the free version comes with limited storage.
  • ownCloud: ownCloud is an open-source, self-hosted file sync, and share solution like Nextcloud. It offers many similar features but lacks some of the advanced tools like integrated video conferencing that Nextcloud offers.
  • Seafile: Seafile is another open-source alternative, known for its high performance and reliability. While it does well in file syncing and sharing, it doesn't provide the comprehensive suite of productivity tools that Nextcloud offers.

Below is a comparison table to help illustrate how Nextcloud stacks up against these competitors in various aspects:

Criteria Nextcloud Google Drive Dropbox OneDrive ownCloud Seafile
Data Privacy High: Full control over data, can be hosted on private server. Medium: Stored on Google's servers, subject to Google's privacy policy. Medium: Stored on Dropbox's servers, subject to Dropbox's privacy policy. Medium: Stored on Microsoft's servers, subject to Microsoft's privacy policy. High: Full control over data, can be hosted on private server. High: Full control over data, can be hosted on private server.
Cost Variable: Free to use, server and maintenance costs apply if self-hosted. Variable: Free up to 15 GB, various paid plans available. Variable: Free with limited storage, paid plans for more storage. Variable: Free with limited storage, paid plans for more storage. Variable: Free to use, server and maintenance costs apply if self-hosted. Variable: Free to use, server and maintenance costs apply if self-hosted.
Capacity High: Depends on the server configuration. Variable: Depends on the plan chosen, up to 2 TB for individuals. Variable: Depends on the plan chosen, up to 3 TB for individuals. Variable: Depends on the plan chosen, up to 6 TB. High: Depends on the server configuration. High: Depends on the server configuration.
File Collaboration High: Integrated with collaborative editing tools. High: Integrated with Google Docs, Sheets, and Slides. Medium: Integration available with third-party tools like MS Office. High: Integrated with Office Online. Medium: Integration available with third-party tools. Low: Basic collaboration features, no integrated tools.
Self-hosted Yes No No No Yes Yes
Open-source Yes No No No Yes Yes
Communication Tools Yes (Nextcloud Talk) Yes (Google Meet) No Yes (Microsoft Teams) No No

Step-by-Step Guide to Installing Nextcloud on a VPS with Ubuntu using Docker

Below is a comprehensive guide detailing the step-by-step process to install a Nextcloud instance on a VPS running Ubuntu 22.04 LTS using Docker:

Prerequisites:

  • A VPS running Ubuntu 22.04 LTS with root access. Ubuntu is a popular choice for servers due to its stability and large community support.

Step 1 - Update your Ubuntu system: Before installing any new software, it's a good practice to update the system's package database. In the terminal, run the following commands:

sudo apt update
sudo apt upgrade

Step 2 - Install Docker: If Docker isn't installed on your VPS, you can install it by running the following commands:

curl -fsSL https://get.docker.com | sudo sh

This command downloads a script from Docker's website and runs it. The script adds Docker’s official GPG key, sets up the Docker stable repository, and then installs Docker. As part of the installation process, this script also sets up Docker to start on boot.

Step 3 - Run the Nextcloud All-in-One Docker container: Use the following command to download and start the Nextcloud All-in-One container (ensure you select, copy, and paste the entire set of strings from the code snippet below into your terminal before running it):

sudo docker run \
--sig-proxy=false \
--name nextcloud-aio-mastercontainer \
--restart always \
--publish 80:80 \
--publish 8080:8080 \
--publish 8443:8443 \
--volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config \
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
nextcloud/all-in-one:latest

This command does several things:

  • "sudo docker run": This command tells Docker to run a new container.
  • "--sig-proxy=false": This option allows you to exit the container shell that gets attached automatically when using docker run by using [CTRL] + [C] without shutting down the container.
  • "--name nextcloud-aio-mastercontainer": This sets the name of the container.
  • "--restart always": This tells Docker to always restart the container if it stops. If it is manually stopped, it will only restart when Docker is restarted or the container itself is manually restarted.
  • "--publish 80:80, --publish 8080:8080, --publish 8443:8443": These options tell Docker to bind the container's ports to ports on the host machine. This is necessary for you to access Nextcloud.
  • "--volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config, --volume /var/run/docker.sock:/var/run/docker.sock:ro": These options tell Docker to create a volume for the container. Volumes are the preferred mechanism for persisting data generated by and used by Docker containers.
  • "nextcloud/all-in-one:latest": This tells Docker to use the latest version of the nextcloud/all-in-one image.

Step 4 - Access the Nextcloud All-in-One Interface: After the initial startup, you should be able to open the Nextcloud All-in-One Interface on port 8080 of your server. For example, if your VPS's IP address is 180.180.180.180, you would navigate to https://180.180.180.180:8080 in your web browser. Your Nextcloud AIO password will be available on the screen when you open the login interface for the first time. Be sure to write it down,  but if you lose the password and get stuck at login screen, retrieve your login credentials using this command:

sudo cat /var/lib/docker/volumes/nextcloud_aio_mastercontainer/_data/data/configuration.json | grep password

or, alternatively, this command:

docker exec -it nextcloud-aio-mastercontainer cat /mnt/docker-aio-config/data/configuration.json | grep password

Step 5 - Open necessary ports in your firewall: If you're using UFW to manage your firewall, you can open the necessary ports with the following commands:

sudo ufw allow 80/tcp
sudo ufw allow 8080/tcp
sudo ufw allow 8443/tcp
sudo ufw allow 3478/tcp
sudo ufw allow 3478/udp

These commands tell UFW to allow incoming traffic on ports 80, 8080, 8443, and 3478.

Remember, this guide is based on the Nextcloud All-in-One Docker image, which includes many features and services. If you only need a basic Nextcloud installation, the steps may be different. For more detailed information and troubleshooting, please refer to the official Nextcloud All-in-One GitHub page: https://github.com/nextcloud/all-in-one

Securing Your Nextcloud All-in-One Docker Installation

When setting up a Nextcloud All-in-One instance on a Docker container, it's crucial to prioritize security to protect your data and ensure the integrity of your server. Here are some guidelines to help you secure your Nextcloud installation:

Secure Access with Domain and TLS Certificate:

To securely access your Nextcloud instance, it's recommended to use a domain name instead of an IP address and a TLS certificate to enable https access. This ensures that the connection between your server and your users is encrypted. Nextcloud All-in-One Docker image comes with its own built-in mechanism for obtaining and renewing Let's Encrypt certificates.

When you first start the Nextcloud All-in-One container, you can access the Nextcloud All-in-One Interface on port 8080 of your server. If your firewall/router has port 80 and 8443 open/forwarded and you point a domain to your server, you can get a valid certificate automatically by opening the Nextcloud All-in-One Interface via: https://your-domain-that-points-to-this-server.tld:8443

This will automatically generate a Let's Encrypt certificate for your domain and configure the server to use it. The certificate will also be automatically renewed when it's close to expiring.

Docker Security:

Docker provides some built-in security measures, but it's important to follow best practices to ensure your containers are secure:

  • Regularly update Docker and your containers: This ensures that you have the latest security patches.
  • Use the principle of least privilege: Don't run Docker containers as root unless necessary. Instead, create a user specifically for running Docker containers.
  • Limit container resources: Use Docker's resource constraints to prevent a single container from consuming too many system resources.
  • Use Docker's built-in security features: Docker has several built-in security features, such as seccomp profiles and AppArmor, that can help secure your containers.

Nextcloud Security:

Nextcloud also provides several security features that you should take advantage of:

  • Enable two-factor authentication: This adds an extra layer of security to your Nextcloud accounts.
  • Regularly update Nextcloud: Like Docker, regularly updating Nextcloud ensures that you have the latest security patches.
  • Use strong, unique passwords: This is a basic security measure, but it's still important. Use a password manager to generate and store strong, unique passwords for your Nextcloud accounts.

General VPS Security Guidelines:

Finally, here are some general security guidelines for your VPS:

  • Regularly update your system: This ensures that you have the latest security patches for your operating system and all installed software.
  • Use strong, unique passwords: Again, this is a basic security measure, but it's still important. Use a password manager to generate and store strong, unique passwords for all your accounts.
  • Limit access to your server: Only allow trusted individuals to access your server, and limit the number of open ports.
  • Enable a firewall: A firewall can help protect your server from unauthorized access. If you're using Ubuntu, UFW is a good choice.
  • Regularly monitor your server: Keep an eye on your server's resource usage and logs to detect any unusual activity.

Using Nextcloud

When you first log into Nextcloud, you're taken to the Files page. This is your main workspace in Nextcloud.

  • Files Page: This page shows all the files and folders that are in your Nextcloud account. It has a traditional file explorer layout with a directory tree on the left side and the contents of the current directory displayed in the middle. You can navigate through your files and folders by clicking on them.

  • Navigation Bar: On the left-hand side, there's a navigation bar. It has icons for all of your enabled apps. Clicking on an icon will take you to that app.

  • Settings: At the bottom left corner of the navigation bar, you'll find your profile picture or avatar. Clicking on this opens a dropdown menu with options to log out, access your personal settings, or view the help documentation.

Basic Features

  • Uploading Files: To upload a file, click the "+" button at the top of the Files page. This opens a dropdown menu with options to upload files, create text files, or create new folders. Select 'Upload file' and then select the file from your device you want to upload.

  • Sharing Files: Nextcloud makes it easy to share your files with others. Click the 'Share' icon (which looks like three connected dots) next to the file or folder you want to share. This opens a sidebar where you can enter the usernames or email addresses of the people you want to share with. You can also generate a public link which can be shared with anyone.

  • Collaboration: Collaboration in Nextcloud is centered around the 'Comments', 'Sharing', and 'Versions' tabs in the sidebar. 'Comments' allows you to chat with other users about a particular file. 'Sharing' shows you who has access to the current file. 'Versions' allows you to revert a file to a previous version, which is especially useful when multiple people are editing the same document.

Installing Nextcloud Apps

Nextcloud's functionality can be expanded by installing additional apps.

  • Go to the 'Apps' section: You can access this by clicking the 'Apps' icon in the navigation bar.

  • Explore available apps: The Apps page shows all of the apps that are available for your Nextcloud instance. They're divided into categories like 'Office & Text', 'Multimedia', 'Calendar & Contacts', and more.

  • Install an app: To install an app, simply click the 'Download and enable' button next to the app. Some apps might require additional configuration after they're installed.

  • Enable or disable apps: Installed apps can be enabled or disabled from the 'Your apps' section. Just click the 'Disable' or 'Enable' button next to the app.

Using Nextcloud Mobile and Desktop Apps

For convenience and better accessibility, Nextcloud provides mobile apps for both Android and iOS devices, as well as desktop apps for Windows, macOS, and Linux operating systems. This allows you to synchronize your files across multiple devices and access your Nextcloud instance from anywhere, at any time.

  • Mobile Apps: Nextcloud's mobile apps are available in the Google Play Store for Android and in the App Store for iOS. Once installed, simply open the app and enter the URL of your Nextcloud server, along with your username and password. The mobile app allows you to access your files, upload photos and videos directly from your device, and even select files for offline use.
  • Desktop Apps: The Nextcloud desktop client can be downloaded from the Nextcloud website. After installing the client, you'll need to connect it to your Nextcloud server using your server URL, username, and password. Once connected, the client will create a 'Nextcloud' folder on your computer. Any files you place in this folder will be automatically synced with your Nextcloud server, and vice versa.
  • Syncing Files: The key advantage of using Nextcloud's mobile and desktop apps is the ability to keep your files synchronized across all devices. Whenever you make a change to a file in your Nextcloud folder on one device, the change will be reflected on all other devices. This allows for a seamless work process, where you can start working on a file on your office computer, and finish it on your personal laptop or even on your mobile device.
  • Notifications and Collaboration: Beyond just file synchronization, the Nextcloud apps also offer features for real-time collaboration, such as notifications whenever a shared file is modified. You can also leave comments on files, or view existing comments, making remote collaboration effortless.

Now, you should have a general understanding of how to use and customize your Nextcloud instance to suit your needs. Remember to keep your apps up-to-date to enjoy the latest features and improvements.

Congrats on Building Your Own Cloud!

To sum up, Nextcloud is a powerful tool that provides a secure and private solution for your data storage and collaboration needs. Whether you're an individual seeking control over your personal data, or an organization looking for an efficient, scalable solution for remote collaboration, Nextcloud offers a comprehensive suite of features that can cater to your needs. By setting it up on a VPS, you have even more control over your data while being able to access it from anywhere, at any time. With the added benefits of the mobile and desktop apps, Nextcloud truly enables you to have your own cloud, your way.

⏴ Back to Blog

Article Summary

What is Nextcloud and why is it considered a leading player in self-hosted cloud solutions?

Nextcloud is an open-source software that allows users to create a self-hosted, private cloud storage service. It offers a wide range of features beyond mere file storage, including team collaboration, file backup, and media streaming, making it a robust platform for both personal and business use.

How does Nextcloud differ from competitors like Google Drive, Dropbox, and OneDrive?

Unlike public cloud services, Nextcloud is self-hosted, giving you complete control over your data and ensuring enhanced privacy. It also offers a comprehensive suite of productivity tools, which many competitors lack.

What are the core features of Nextcloud?

Nextcloud offers file hosting and synchronization, built-in document editing tools, a secure communication platform called Nextcloud Talk, integrated calendar and contacts management, and a built-in email client, among other features.

How does Nextcloud prioritize privacy and security?

Nextcloud puts a strong emphasis on security with features like end-to-end encryption, two-factor authentication, and brute-force protection. Being self-hosted, it also gives you complete control over your data.

What are the prerequisites for installing Nextcloud on a VPS?

You'll need a VPS running Ubuntu 22.04 LTS with root access. It's also recommended to have Docker installed for easier deployment.

How do I install Nextcloud using Docker on a VPS?

The article provides a comprehensive step-by-step guide to install Nextcloud on a VPS running Ubuntu 22.04 LTS using Docker. The process involves updating your Ubuntu system, installing Docker, and running the Nextcloud All-in-One Docker container.

How do I secure my Nextcloud installation?

For securing your Nextcloud instance, it's recommended to use a domain name and a TLS certificate for HTTPS access. You should also regularly update Docker and Nextcloud, use strong, unique passwords, and enable a firewall.

How can I extend Nextcloud's functionality?

Nextcloud's functionality can be extended by installing additional apps from the Nextcloud App Store. These apps range from office tools to multimedia applications.

Does Nextcloud offer mobile and desktop apps?

Yes, Nextcloud provides mobile apps for Android and iOS, as well as desktop apps for Windows, macOS, and Linux, allowing you to sync your files across multiple devices.

What are the benefits of setting up Nextcloud on a VPS?

Setting up Nextcloud on a VPS gives you more control over your data while allowing you to access it from anywhere. It's a scalable solution that can meet the needs of both individuals and large organizations.

Loading...