Here’s the correct, production‑grade method to install Nextcloud on a Hostcarts VPS, based on the official Nextcloud installation documentation and standard Ubuntu server setup practices.
This guide is optimized for your Hostcarts environment and follows the same structure you use for your infrastructure deployments.
This method uses Apache + MariaDB + PHP, which is the officially recommended stack.
Sources: Nextcloud
Below is a structured, technical installation guide using the Step-by-Step Troubleshooting/Setup Template.
Sources: Nextcloud
sudo apt update && sudo apt upgrade -y
Official docs recommend installing all required PHP extensions.
sudo apt install apache2 mariadb-server libapache2-mod-php \
php-gd php-mysql php-curl php-mbstring php-intl php-gmp \
php-xml php-imagick php-zip php-bz2 php-fpm php-cli -y
Enable Apache modules:
sudo a2enmod rewrite headers env dir mime ssl
sudo systemctl restart apache2
Enter MariaDB:
sudo mysql
Run:
CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'StrongPassword';
CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';
FLUSH PRIVILEGES;
QUIT;
(These steps match official documentation.) Nextcloud
Get the latest version:
cd /tmp
wget https://download.nextcloud.com/server/releases/latest.tar.bz2
tar -xjf latest.tar.bz2
Move it to the web directory:
sudo mv nextcloud /var/www/
sudo chown -R www-data:www-data /var/www/nextcloud
sudo chmod -R 755 /var/www/nextcloud
sudo nano /etc/apache2/sites-available/nextcloud.conf
Paste:
ServerName cloud.example.com
DocumentRoot /var/www/nextcloud/
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
ErrorLog ${APACHE_LOG_DIR}/nextcloud_error.log
CustomLog ${APACHE_LOG_DIR}/nextcloud_access.log combined
Enable site:
sudo a2ensite nextcloud.conf
sudo systemctl reload apache2
sudo apt install certbot python3-certbot-apache -y
sudo certbot --apache -d cloud.example.com
sudo -u www-data crontab -e
Add:
*/5 * * * * php -f /var/www/nextcloud/cron.php
Redis improves performance significantly.
This is recommended in modern Nextcloud guides. YouStable
Install Redis:
sudo apt install redis-server php-redis -y
sudo systemctl enable redis-server --now
Edit config:
sudo nano /var/www/nextcloud/config/config.php
Add:
'memcache.local' => '\\OC\\Memcache\\APCu',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' => [
'host' => 'localhost',
'port' => 6379,
],
Open browser:
http://cloud.example.com
Enter:
Nextcloud will auto‑create tables. Nextcloud
Your Nextcloud is now fully installed on Hostcarts VPS