Now that your dedicated storage environment or new Virtualmin server is ready, follow these commands to install Nextcloud via SSH.
• 1. SSH into your dedicated Nextcloud server and navigate to your web root:
I use sudo su this gives me root privileges before i use cd
Use this general format, replacing the username with your own:
cd /home/yourdomainusername/public_html/
Depending on exactly how you are deploying Nextcloud, adjust your path accordingly:
• Root Install (Main domain): cd /home/yourdomainusername/public_html/
• Subfolder Install (e.g., /nextcloud): cd /home/yourdomainusername/public_html/nextcloud/
• Subdomain Install (e.g., mynextcloud.yourdomain.com): cd /home/yourdomainusername/public_html/
(Note: In Virtualmin, subdomains typically route right back to the public_html environment unless you have built out completely separated infrastructure, so the base folder path remains the same).
• 2. Install unzip (if it is not already installed on your server):
Ubuntu / Debian:
sudo apt install unzip -y
CentOS / Alma / Rocky:
sudo dnf install unzip -y
• 3. Install required PHP extensions:
Nextcloud requires specific PHP modules to function correctly. Install them based on your operating system:
Ubuntu / Debian:
sudo apt install php-gd php-mysql php-curl php-mbstring php-intl php-gmp php-bcmath php-xml php-zip php-imagick -y
CentOS / Alma / Rocky:
sudo dnf install php-gd php-mysqlnd php-curl php-mbstring php-intl php-gmp php-bcmath php-xml php-zip php-pecl-imagick -y
• 4. Download the Nextcloud package:
wget https://download.nextcloud.com/server/releases/latest.zip
• 5. Extract the downloaded file:
unzip latest.zip
• 6. Move the extracted files into place:
rsync -a nextcloud/ ./
This moves file from /nextcloud to your public_html / root web folder
• 7. Clean up the installation files to keep your server tidy:
rm -rf nextcloud latest.zip
You will need to change ownership in my install
sudo chown -R mynextcloud:mynextcloud /home/mynextcloud/public_html
Change to your username ls -la will show root root
After chown it should show ls -la username username