AI Chat

Self-Hosting Nextcloud on Bare Metal: A Private Google Drive Alternative

Self-Host Nextcloud on Bare Metal Server
Ask AI to extract steps & commands from this tutorial:

Cloud storage is convenient, but it comes with a trade-off: your files, photos, and documents sit on someone else's servers, subject to someone else's terms of service, pricing changes, and data policies. Nextcloud offers a way out of that trade-off. It is an open-source, self-hosted file sync and collaboration platform — a private cloud storage system that gives you the same core functionality as Google Drive, Dropbox, or OneDrive, except you own the infrastructure and the data never leaves your control.

If you're searching for a genuine Google Drive alternative that doesn't involve handing your files to a third party, self-hosting Nextcloud on your own hardware is one of the most complete answers available. This tutorial walks through installing Nextcloud on a bare metal server, from a clean OS to a fully working private cloud you can access from your desktop, phone, or browser.

Why Self-Host Nextcloud on Bare Metal?

Running Nextcloud on a shared hosting plan or a small VPS works for personal use, but it quickly hits limits once you add more users, larger files, or apps like video calls and collaborative document editing. A dedicated bare metal server removes those limits:

  • Full resource control – no noisy neighbours competing for CPU, RAM, or disk I/O.

  • Better performance for large teams – file sync and preview generation are I/O and CPU heavy at scale.

  • Data sovereignty – your files stay on hardware you control, in a data centre location you choose.

  • Room to expand – add apps like Nextcloud Talk, Collabora Office, or Deck without worrying about resource caps.

In our experience provisioning storage-heavy workloads for clients, the single biggest performance factor for a self-hosted, privately managed Nextcloud instance is disk I/O — file previews, thumbnail generation, and multi-user sync all hammer storage far more than CPU. For businesses that need this to be reliable, a dedicated server with fast NVMe storage and a stable network connection is the right foundation for a production-grade, self-managed cloud deployment. eServers UK's bare metal plans run on Intel, AMD, and Ampere hardware, come with full root access and a 99.99% Uptime SLA, and include free DDoS protection up to 250 Gbps as standard — all worth having once Nextcloud becomes your team's primary storage rather than a side project.

If you also need your Nextcloud instance reachable through your own IP range and routing policy rather than a shared provider default, pairing it with a BGP peering setup gives you that level of network control as well.

Nextcloud vs. Google Drive: What Actually Changes

Before diving into installation, it's worth being clear about what self-hosting changes and what it doesn't. Nextcloud is not a drop-in clone of Google Drive — it's a different ownership model with a comparable feature set:

Feature Google Drive Self-Hosted Nextcloud
Data location Google's data centres Your own dedicated server
Storage limits Fixed by subscription tier Limited only by your disk capacity
File sync & sharing Yes Yes
Collaborative editing Google Docs/Sheets Collabora Online or OnlyOffice (self-hosted)
Recurring cost Per-user subscription Server cost only, regardless of user count
Data control Subject to provider's terms Fully under your administration

This is the core appeal for businesses and privacy-conscious individuals alike: predictable infrastructure cost instead of per-seat licensing, and full administrative control over where files live.

Prerequisites

  • A bare metal or dedicated server running Ubuntu 22.04/24.04 or Debian 12.

  • Root or sudo access.

  • A domain name pointed at your server's IP address (recommended, though not strictly required).

  • Basic comfort with the Linux command line.

Step 1: Update the Server and Install Required Packages

Start by updating the system and installing Apache, MariaDB, and PHP along with the PHP extensions Nextcloud depends on.

bash

sudo apt update && sudo apt upgrade -y
sudo apt install apache2 mariadb-server libapache2-mod-php php php-mysql \
php-xml php-gd php-curl php-mbstring php-zip php-intl php-bcmath \
php-gmp php-imagick unzip -y
                            

Step 2: Create a Database for Nextcloud

Secure the MariaDB installation, then create a dedicated database and user for Nextcloud.

bash

sudo mysql_secure_installation
                            

Follow the prompts to set a root password and remove insecure defaults. Then log into MariaDB and create the database:


sudo mysql -u root -p
                            
sql

CREATE DATABASE nextcloud;
CREATE USER 'ncuser'@'localhost' IDENTIFIED BY 'your_strong_password';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'ncuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
                            

Replace your_strong_password with a genuinely strong, unique password.

Step 3: Download and Extract Nextcloud

Download the latest stable release directly from the official Nextcloud server.

bash

cd /tmp
wget https://download.nextcloud.com/server/releases/latest.zip
unzip latest.zip
sudo mv nextcloud /var/www/html/nextcloud
                            

Set the correct ownership so the web server can read and write to the Nextcloud directory:


sudo chown -R www-data:www-data /var/www/html/nextcloud
                            

Step 4: Configure Apache

Create a new Apache virtual host configuration for Nextcloud:

bash

sudo nano /etc/apache2/sites-available/nextcloud.conf
                            

Add the following, replacing your_domain.com with your actual domain or server IP:

apache

<VirtualHost *:80>
    DocumentRoot /var/www/html/nextcloud
    ServerName your_domain.com

    <Directory /var/www/html/nextcloud>
        Require all granted
        AllowOverride All
        Options FollowSymLinks MultiViews
    </Directory>
</VirtualHost>
                            

Enable the site and the required Apache modules:

bash

sudo a2ensite nextcloud.conf
sudo a2enmod rewrite headers env dir mime
sudo systemctl restart apache2
                            

Step 5: Open the Firewall for Web Traffic

bash

sudo ufw allow 'Apache Full'
sudo ufw enable
                            

Step 6: Complete the Web-Based Setup

Visit http://your_domain.com (or your server's IP) in a browser. Nextcloud's setup wizard will prompt you to:

  1. Create an admin username and password.

  2. Confirm the data folder location (default is fine for most setups).

  3. Enter the database details you created in Step 2:

    • Database user: ncuser

    • Database password: the one you set earlier

    • Database name: nextcloud

    • Database host: localhost

Click Finish setup, and Nextcloud will initialise your instance.

Step 7: Secure Your Instance with HTTPS

Running Nextcloud over plain HTTP is not safe for real use, especially since you'll be logging in with a password and syncing personal files. Install a free TLS certificate with Certbot:

bash

sudo apt install certbot python3-certbot-apache -y
sudo certbot --apache -d your_domain.com
                            

Certbot will automatically configure Apache to redirect HTTP traffic to HTTPS and handle certificate renewal.

Step 8: Tune Nextcloud for Production Use

A few settings make a real difference once you move beyond initial testing:

Enable PHP's OPcache and increase memory limits. Edit your PHP configuration:


sudo nano /etc/php/8.3/apache2/php.ini
                            

Set:

ini

memory_limit = 512M
upload_max_filesize = 10G
post_max_size = 10G
                            

Set up the background cron job, which Nextcloud uses for scheduled tasks like file scanning and notifications:


sudo crontab -u www-data -e
                            

Add:


*/5 * * * * php -f /var/www/html/nextcloud/cron.php
                            

Then switch the background job type to Cron inside Nextcloud's admin settings (Settings → Administration → Basic settings).

Step 9: Extend Nextcloud with Apps

One of Nextcloud's biggest advantages over commercial cloud storage is its app ecosystem. From the Apps section in the admin panel, you can add:

  • Collabora Online or OnlyOffice – real-time collaborative document editing.

  • Nextcloud Talk – self-hosted video calls and chat.

  • Deck – Trello-style project boards.

  • Calendar and Contacts – synced across devices via CalDAV/CardDAV.

Each app runs on your own server, so there's no per-seat licensing from a third-party SaaS provider.

Keeping Your Nextcloud Instance Reliable

A self-hosted platform is only as good as the infrastructure behind it. Two things matter most for a production Nextcloud deployment, based on what typically causes issues once real users start relying on it daily:

  • Storage performance – file sync and preview generation are disk-intensive, so NVMe storage makes a noticeable difference with larger teams.

  • Regular backups – back up both the Nextcloud data directory and the MariaDB database on a schedule, ideally to a separate location or off-site storage target.

Conclusion

Self-hosting Nextcloud gives you the convenience of cloud storage without handing your files over to a third party. On a dedicated bare metal server, you get the performance headroom to run it reliably for a team, add collaboration apps, and scale storage as your needs grow — all while keeping full control of your data.

If you're planning a Nextcloud deployment and want a server sized correctly for your storage and user count, get in touch with the eServers UK team. We can help you pick the right disk configuration, bandwidth, and network setup for a smooth, production-ready deployment.

Frequently Asked Questions

Is Nextcloud really free to self-host? +

The Nextcloud server software itself is free and open-source. The only ongoing cost is the infrastructure it runs on — your dedicated server, storage, and bandwidth — which for most small-to-medium teams is significantly cheaper than per-user cloud storage subscriptions.

Can multiple users share one Nextcloud instance? +

Yes. Nextcloud supports unlimited user accounts on a single instance (limited only by your server's resources), each with their own storage quota, shared folders, and permission levels.

Do I need a domain name to self-host Nextcloud? +

It's strongly recommended, mainly because it makes setting up a free TLS certificate with Certbot straightforward. Nextcloud can technically run on a bare IP address, but a domain name makes both HTTPS and day-to-day access far simpler.

How does self-hosted Nextcloud compare to Dropbox or OneDrive for data privacy? +

With Nextcloud, no third party has access to your files unless you explicitly grant it. Commercial providers like Dropbox and OneDrive operate under their own data policies and may process or scan file contents depending on their terms of service.

Discover eServers Dedicated Server Locations

eServers provides reliable dedicated servers across multiple global regions. Whether you need low latency, regional compliance, or proximity to your audience, our wide geographic coverage ensures the perfect hosting environment for your project.

Our Bandwidth providers

We are Partners with 15 +

At eServers , we proudly partner with 15+ leading global tech providers to deliver secure, high-performance hosting solutions. These trusted alliances with top hardware, software, and network innovators ensure our clients benefit from modern technology and enterprise-grade reliability.

Hosting Solutions