Are you looking to take control of your data with a private cloud solution but need help figuring out where to start? Setting up NextCloud on Proxmox using Ubuntu 22.04 could be the perfect solution, offering robust functionality without the complexity of Docker.

How to install NextCloud on Proxmox

In this article, I will guide you through the installation of NextCloud on Proxmox with Ubuntu 22.04. While the officially recommended NextCloud installation method involves a Docker with the AIO (All-in-One) installation package, installing directly in a VM or container without a Docker is more efficient.

I asked the Reddit community for opinions about installing NextCloud. The result was that the method without a Docker was acceptable, and there are several ways to install NextCloud. I found a good video on YouTube in German that explains how it works.

In short the steps involved to install NextCloud:

  • Create a new container with Ubuntu.
  • Install Apache and PHP
  • adjust PHP.ini
  • Install MariaDB and create a database for NextCloud.
  • Download the latest NextCloud version
  • Create a conf file to register NextCloud with Apache
  • Create a folder for the NextCloud data.
  • Install an SSL certificate with letsencrypt
  • Configure NextCloud

In case you are not sure what NextCloud is, here is a short introduction

What is NextCloud?

NextCloud is an open-source software suite that allows you to run your private cloud storage service. It provides a safe, secure, and flexible way to store your files, photos, and documents, all managed under your control. NextCloud isn’t just about file storage; it includes features such as calendars, contacts, email, and file-sharing capabilities. It’s highly customizable through various apps that extend its functionality, making it a robust alternative to public cloud services like Google Drive or Dropbox. Synology also offers Synology Drive, an alternative to NextCloud. I wrote a how-to article

Now that you have a basic understanding of NextCloud let’s explore how to set it up on your Proxmox server using Ubuntu 22.04.

How to Install NextCloud on Proxmox Using Ubuntu

Prerequisites for Installing NextCloud on Proxmox

Before you start installing NextCloud on your Proxmox server using Ubuntu, there are a couple of essential prerequisites you need to ensure:

Domain Name

Having a domain name is crucial as it not only helps you efficiently access your NextCloud installation from the web but also allows you to configure SSL certificates more seamlessly, enhancing the security of your connection.

Public IPv4 Address

If possible, having a public IPv4 address is highly recommended. This facilitates direct Internet access to your NextCloud server, making it accessible from anywhere. This is particularly important if you use NextCloud as a cloud service for multiple users across different locations.

Alternative: Port Forwarding

If you cannot get a public IPv4 address, you can use port forwarding as an alternative. This method allows you to redirect network traffic from a specific port on your router to your NextCloud server within your local network. It’s a practical solution that allows external access to your installation without a dedicated public IP. Remember to configure this setting in your router’s administration panel, directing HTTP traffic on port 80 and HTTPS traffic on port 443 to the internal IP address of your Proxmox server.

Step 1: Create a new container with Ubuntu

I’m not going into the details of installing Ubuntu 22.04 in a Container. My article “Proxmox Containers vs VM: Which is Right for Your Needs?” describes the process. It is very straightforward.

Start the Ubuntu container and update Ubuntu. I prefer to get into the sudo mode with ‘sudo -s’. Therefore, all my commands won’t start with sudo.

apt-get update -y
apt-get upgrade -y
apt-get dist-upgrade -y

Step 2: Install Apache and PHP

First, we install Apache

apt install apache2 -y

then we install PHP

apt install software-properties-common
add-apt-repository ppa:ondrej/php
apt update

and the required PHP modules. As of this writing (April 2024), NextCloud recommends PHP 8.3

apt install php8.3 libapache2-mod-php8.3 php8.3-zip php-dompdf php8.3-xml php8.3-mbstring php8.3-gd php8.3-curl php8.3-imagick libmagickcore-6.q16-6-extra php8.3-intl php8.3-bcmath php8.3-gmp php8.3-cli php8.3-mysql php8.3-zip php8.3-gd  php8.3-mbstring php8.3-curl php8.3-xml php-pear unzip nano php8.3-apcu redis-server ufw php8.3-redis php8.3-smbclient php8.3-ldap php8.3-bz2

Step 3: Adjust php.ini

We need to change a few settings in the php.ini. I use the nano editor with this command.

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

Here is the list of what we need to change in the php.ini

If your Ubunut installation has 8GB of RAM, I recommend allocating 50% to PHP, which is 4096. The ‘upload_max_filesize’ and ‘post_max_size’ are essential to define the file sizes allowed in NextCloud.

In the nano editor, you can search for the settings with ‘control+W’ (MAC) or ‘CTRL+W (Windows). To save the settings, press ‘control+O,’ and to exit the editor, press ‘control+X.’ I’m on a MAC

memory_limit = 4096M
upload_max_filesize = 20G
post_max_size = 20G
date.timezone = Europe/Zurich
output_buffering: OFF
opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=64
opcache.max_accelerated_files=10000
opcache.memory_consumption=1024
opcache.save_comments=1
opcache.revalidate_freq=1

All the opcache settings are disabled with a ‘;’. Instead of searching for and editing each setting, you can add all opcache settings at the end of the file.

PHP.ini settings for NextCloud

Step 4: Install MariaDB and create a database for NextCloud

Now, let’s install the MariaDB database. I prefer it over MySQL

apt install mariadb-server

Further, we must secure the database installation with the password for the user’s ‘root’. This is the user for the database and not Ubuntu. Make sure to note the password somewhere. 🙂

mysql_secure_installation

Once installed, we must create a database in MariaDB with a database user and password. This is later needed to configure NextCloud.

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

With the command ‘MySQL’ you get in the database mode, each command ends with a ; To exit the database mode, enter ‘exit;’

Step 5: Download the latest NextCloud version

It’s time to download the NextCloud.zip, extract it, and move the nextcloud folder to /var/www

We download it to the tmp folder

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

In the screenshot below, you see it was downloaded to the tmp folder as ‘latest.zip’. Once unpacked and moved, there is a ‘nexcloud’ folder in /var/www.

Download latest Nextcloud zip

Step 6: Create a conf file to register Nextcloud for Apache

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

We will use nano editor again to insert the information

<VirtualHost *:80>
     ServerAdmin [email protected]
     DocumentRoot /var/www/nextcloud/
     ServerName zurichclouds.com
     <Directory /var/www/nextcloud/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
          <IfModule mod_dav.c>
            Dav off
          </IfModule>
        SetEnv HOME /var/www/nextcloud
        SetEnv HTTP_HOME /var/www/nextcloud
     </Directory>
     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Replace the information in red with your Email ID and the FQN name of your server. Ideally, using a public domain or a subdomain would be best.

Again, save the file with ‘control+o’ and exit it nano with ‘control+x’. Then we need to run some command to register it with apache and restart apache

a2ensite nextcloud.conf
a2enmod rewrite
a2enmod headers
a2enmod env
a2enmod dir
a2enmod mime
# restart apache
service apache2 restart

Step 7: Create a folder for the NextCloud data

We are almost ready; let us create a folder in Ubuntu for the NextCloud data. I will name the folder ‘zurichclouds-repo’

mkdir /zurichclouds-repo
chown -R www-data:www-data /zurichclouds-repo
chown -R www-data:www-data /var/www/nextcloud/
chmod -R 755 /var/www/nextcloud/

With the ‘chown’ commands we give for the user ‘www-data’ and for the group ‘www-data’ ownership to the folder, and the ‘chmod’ command set the write permission


My pick

How-to-use-Synology-Drive-banner-2024

Synology Drive

How to install and run


Step 8: Install an SSL certificate with Letsencrypt

Please make sure port 80 is open on your firewall, else the certbot is not able to verify the SSL certificate.

We have to install first the certbot.

apt install certbot python3-certbot-apache

After you can obtain the certificate, use your email ID and your domain for the certification process.

certbot --apache -m [email protected] -d zurichclouds.com

See below how it looks when the certificate is successfully deployed. Letsencrypt certificates are valid for 90 days, but a process is already in place to automatically renew them.

Letsencrypt certificate

Proxmox server ideas


Step 9 (final step): Configure NextCloud

Fire up your browser and enter your domain name; in my case, it is https://zurichclouds.com. NextCloud configuration should greet you for the setup.

Enter the required information provided in earlier stages and click ‘Install’. Next, you could install the recommended apps.

NextClud setup
NextCloud recommended apps

If all went well, you should be logged in. Congratulations! NextCloud is ready!

Nextcloud is ready

I would love to get some feedback from you. Was this article helpful? Please share your opinion with me in the comment section below. Or, if you prefer a more personal touch, feel free to email me directly at [email protected]. Your thoughts and insights are always appreciated.

Before you go …

‘m glad you explored the steps to install Nextcloud on Proxmox using Ubuntu. If you’re now considering setting up your home lab further, you might find it valuable to look into the best server options available for such environments. I recommend checking out this detailed guide on choosing the best server for your home lab. It covers various server types and helps you understand which might best suit your needs, effectively enhancing your home lab setup.

Full Disclosure

Any purchases made from clicks on links to products on this page may result in an affiliate commission for me. 

Please keep in mind that the quantity or price of items can change at any time.

As an Amazon  Associate, I earn from qualifying purchases.

As an Aliexpress Associate, I earn from qualifying purchases. 

Als Amazon-Partner verdiene ich an qualifizierten Verkäufen

Tech Expert & Blogger


Leave a Reply

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

For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.