How to Install and Configure Nextcloud on a Hosteons VPS

Nextcloud is a powerful open-source self-hosted cloud storage solution that allows you to store, share, and access your files from anywhere — securely and privately. With a VPS from Hosteons, you can deploy your own Nextcloud instance in minutes.


✅ Prerequisites

Before starting, make sure:

  • You have a Hosteons KVM VPS with at least 1 GB RAM (2 GB recommended).
  • You’re using Ubuntu 22.04 (or a similar Linux distro).
  • You have a domain name pointed to your VPS IP (optional but recommended).
  • SSH access to the VPS (as root or sudo user).

🧰 Step 1: Update Your System

sudo apt update && sudo apt upgrade -y

⚙️ Step 2: Install Required Dependencies

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

🗄️ Step 3: Configure MariaDB

sudo mysql_secure_installation

Then log into MariaDB:

sudo mysql -u root -p

Run the following queries to create a database and user:

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

📦 Step 4: Download and Extract Nextcloud

cd /var/www/
sudo wget https://download.nextcloud.com/server/releases/latest.zip
sudo unzip latest.zip
sudo chown -R www-data:www-data nextcloud
sudo chmod -R 755 nextcloud

🌐 Step 5: Configure Apache for Nextcloud

Create a new config file:

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

Paste this:

<VirtualHost *:80>
    ServerName yourdomain.com

    DocumentRoot /var/www/nextcloud

    <Directory /var/www/nextcloud/>
        Require all granted
        AllowOverride All
        Options FollowSymlinks MultiViews
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/nextcloud_error.log
    CustomLog ${APACHE_LOG_DIR}/nextcloud_access.log combined
</VirtualHost>

Enable the config and necessary modules:

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

🔐 (Optional) Step 6: Secure with HTTPS using Let’s Encrypt

sudo apt install certbot python3-certbot-apache -y
sudo certbot --apache

🧪 Step 7: Final Setup via Web UI

Open your browser and go to http://yourdomain.com or http://your_server_ip

You’ll see the Nextcloud installer. Enter:

  • Admin username and password
  • Database name: nextcloud
  • Database user: nextclouduser
  • Password: your DB password
  • DB host: localhost

Click Finish Setup.


🎉 Done!

Nextcloud is now ready on your Hosteons VPS. You can install the mobile or desktop apps and start syncing your files securely.


🚀 Need a VPS?

Hosteons offers powerful, affordable VPS solutions with full root access, 10Gbps ports, and global payment methods including Crypto, Alipay, UPI, and more.

👉 Explore VPS Plans

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.