{"id":17140,"date":"2026-01-21T16:01:24","date_gmt":"2026-01-21T10:31:24","guid":{"rendered":"https:\/\/www.youstable.com\/blog\/?p=17140"},"modified":"2026-01-21T16:01:26","modified_gmt":"2026-01-21T10:31:26","slug":"install-nextcloud-from-command-line","status":"publish","type":"post","link":"https:\/\/www.youstable.com\/blog\/install-nextcloud-from-command-line","title":{"rendered":"Install NextCloud From Command Line in 2026"},"content":{"rendered":"\n<p><strong>To install Nextcloud from the command line<\/strong>, prepare a LEMP or LAMP stack, create a database, download the Nextcloud release, configure your web server and TLS, then run the non interactive \u201cocc maintenance:install\u201d command. <\/p>\n\n\n\n<p>Finally, enable cron, Redis caching, and hardening settings. The steps below cover Ubuntu\/Debian (Nginx\/Apache), Snap, and Docker options. If you want a private, self hosted cloud, installing Nextcloud from the command line is the fastest, most controllable method. <\/p>\n\n\n\n<p>This guide shows how to Install NextCloud From Command Line on Ubuntu\/Debian using Nginx (LEMP) or Apache (LAMP), plus quick alternatives with Snap and Docker, fully optimized, secure, and production ready.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"what-youll-need-prerequisites\">What You\u2019ll Need (Prerequisites)<\/h2>\n\n\n\n<p><strong>Before you begin, ensure the following are in place:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A fresh Ubuntu 22.04\/24.04 or Debian 12 server (VPS or dedicated)<\/li>\n\n\n\n<li>Sudo or root access <a href=\"https:\/\/www.youstable.com\/blog\/how-to-connect-to-server-via-ssh\/\">via SSH<\/a><\/li>\n\n\n\n<li>A domain (e.g., cloud.example.com) with DNS A\/AAAA records pointing to your server<\/li>\n\n\n\n<li><strong>Open ports:<\/strong> 80 (HTTP) and 443 (HTTPS)<\/li>\n\n\n\n<li>At least 2 GB RAM (4+ GB recommended for larger teams), SSD storage<\/li>\n\n\n\n<li>Time synchronized (systemd-timesyncd or chrony)<\/li>\n<\/ul>\n\n\n\n<p><strong>Tip:<\/strong> For reliable performance, a VPS with dedicated vCPU and NVMe SSD helps. YouStable\u2019s SSD VPS plans provide stable resources and easy OS templates ideal for Nextcloud.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"quick-install-paths-choose-your-method\">Quick Install Paths (Choose Your Method)<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>LEMP (Nginx + PHP-FPM + MariaDB\/PostgreSQL):<\/strong> Best performance, flexible hardening<\/li>\n\n\n\n<li><strong>LAMP (Apache + PHP + MariaDB\/PostgreSQL):<\/strong> Simpler for Apache users<\/li>\n\n\n\n<li><strong>Snap package:<\/strong> Fast all in one, minimal tuning needed<\/li>\n\n\n\n<li><strong>Docker\/Compose: <\/strong>Portable and reproducible deployments<\/li>\n<\/ul>\n\n\n\n<p>Below we deep dive into LEMP on Ubuntu\/Debian, then show Apache, Snap, and Docker variants.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"install-nextcloud-from-command-line-ubuntu-debian-nginx-step-by-step\">Install Nextcloud from Command Line (Ubuntu\/Debian, Nginx) &#8211; Step-by-Step<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"1-update-system-and-install-core-packages\">1) Update system and install core packages<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update &amp;&amp; sudo apt -y upgrade\nsudo apt -y <a href=\"https:\/\/www.youstable.com\/blog\/install-nginx-on-linux\/\">install nginx<\/a> mariadb-server redis-server unzip wget curl gnupg2 ufw software-properties-common\nsudo ufw allow OpenSSH\nsudo ufw allow \"Nginx Full\"\nsudo ufw enable<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"2-install-php-fpm-and-required-extensions\">2) Install PHP-FPM and required extensions<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt -y install php-fpm php-cli php-mysql php-gd php-curl php-xml php-zip php-mbstring php-intl php-bcmath php-gmp php-imagick php-apcu php-redis php-ldap<\/code><\/pre>\n\n\n\n<p>Ensure PHP-FPM is running and note the socket path, e.g., \/run\/php\/php8.2-fpm.sock.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"3-secure-mariadb-and-create-the-nextcloud-database\">3) Secure MariaDB and create the Nextcloud database<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mysql_secure_installation\nsudo mysql -u root -p\n# Inside the MariaDB shell:\nCREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;\nCREATE USER 'ncuser'@'localhost' IDENTIFIED BY 'StrongPasswordHere';\nGRANT ALL PRIVILEGES ON nextcloud.* TO 'ncuser'@'localhost';\nFLUSH PRIVILEGES;\nEXIT;<\/code><\/pre>\n\n\n\n<p>Alternatively, you can use PostgreSQL for better scalability. The \u201cocc\u201d installer supports both.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"4-download-and-verify-nextcloud\">4) Download and verify Nextcloud<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>wget https:\/\/download.nextcloud.com\/server\/releases\/latest.zip\nwget https:\/\/download.nextcloud.com\/server\/releases\/latest.zip.asc\nwget https:\/\/nextcloud.com\/nextcloud.asc\ngpg --import nextcloud.asc\ngpg --verify latest.zip.asc latest.zip  # verify signature (recommended)\nunzip latest.zip\nsudo mv nextcloud \/var\/www\/nextcloud\nsudo mkdir -p \/var\/www\/nextcloud-data\nsudo chown -R www-data:www-data \/var\/www\/nextcloud \/var\/www\/nextcloud-data\nsudo find \/var\/www\/nextcloud\/ -type d -exec chmod 750 {} \\;\nsudo find \/var\/www\/nextcloud\/ -type f -exec chmod 640 {} \\;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"5-configure-nginx-server-block\">5) Configure Nginx server block<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/nginx\/sites-available\/nextcloud<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>server {\n    listen 80;\n    server_name cloud.example.com;\n    root \/var\/www\/nextcloud;\n    client_max_body_size 512M;\n    fastcgi_buffers 64 4K;\n\n    add_header X-Content-Type-Options nosniff;\n    add_header X-Frame-Options SAMEORIGIN;\n    add_header X-XSS-Protection \"1; mode=block\";\n    add_header Referrer-Policy no-referrer;\n    add_header X-Download-Options noopen;\n    add_header X-Permitted-Cross-Domain-Policies none;\n\n    index index.php index.html \/index.php$request_uri;\n\n    location = \/robots.txt { allow all; log_not_found off; access_log off; }\n\n    location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ { deny all; }\n    location ~ ^\/(?:\\.|autotest|occ|issue|indie|db_|console) { deny all; }\n\n    location \/ {\n        try_files $uri $uri\/ \/index.php$request_uri;\n    }\n\n    location ~ \\.php(?:$|\/) {\n        fastcgi_split_path_info ^(.+?\\.php)(\/.*)$;\n        include fastcgi_params;\n        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n        fastcgi_param PATH_INFO $fastcgi_path_info;\n        fastcgi_param modHeadersAvailable true;\n        fastcgi_param front_controller_active true;\n        fastcgi_pass unix:\/run\/php\/php8.2-fpm.sock;\n        fastcgi_intercept_errors on;\n        fastcgi_request_buffering off;\n    }\n\n    location ~ \\.(?:css|js|woff2?|svg|gif|map)$ {\n        try_files $uri \/index.php$request_uri;\n        add_header Cache-Control \"public, max-age=15778463\";\n        access_log off;\n    }\n\n    location ~ \\.(?:png|html|ttf|ico|jpg|jpeg)$ {\n        try_files $uri \/index.php$request_uri;\n        access_log off;\n    }\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ln -s \/etc\/nginx\/sites-available\/nextcloud \/etc\/nginx\/sites-enabled\/nextcloud\nsudo nginx -t &amp;&amp; sudo systemctl reload nginx<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"6-obtain-a-lets-encrypt-ssl-certificate\">6) Obtain a Let\u2019s Encrypt SSL certificate<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt -y install certbot python3-certbot-nginx\nsudo certbot --nginx -d cloud.example.com --redirect --agree-tos -m admin@example.com -n\nsudo systemctl reload nginx<\/code><\/pre>\n\n\n\n<p>This adds <a href=\"https:\/\/www.youstable.com\/blog\/redirect-http-to-https-using-htaccess\/\">HTTPS with automatic redirects<\/a> and renewal timers.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"7-run-the-non-interactive-nextcloud-installer-occ\">7) Run the non interactive Nextcloud installer (occ)<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo -u www-data php \/var\/www\/nextcloud\/occ maintenance:install \\\n  --database \"mysql\" \\\n  --database-name \"nextcloud\" \\\n  --database-user \"ncuser\" \\\n  --database-pass \"StrongPasswordHere\" \\\n  --admin-user \"ncadmin\" \\\n  --admin-pass \"AnotherStrongPassword\" \\\n  --data-dir \"\/var\/www\/nextcloud-data\"<\/code><\/pre>\n\n\n\n<p>For PostgreSQL, use \u201c&#8211;database pgsql\u201d and supply a PostgreSQL user and DB.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"8-enable-caching-trusted-domains-and-security-settings\">8) Enable caching, trusted domains, and security settings<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Set the trusted domain and URL\nsudo -u www-data php \/var\/www\/nextcloud\/occ config:system:set trusted_domains 1 --value=cloud.example.com\nsudo -u www-data php \/var\/www\/nextcloud\/occ config:system:set overwrite.cli.url --value=https:\/\/cloud.example.com\n\n# Enable APCu (local cache) and Redis (file locking\/memcache)\nsudo -u www-data php \/var\/www\/nextcloud\/occ config:system:set memcache.local --value='\\OC\\Memcache\\APCu'\nsudo -u www-data php \/var\/www\/nextcloud\/occ config:system:set memcache.locking --value='\\OC\\Memcache\\Redis'\nsudo -u www-data php \/var\/www\/nextcloud\/occ config:system:set redis --value='{\"host\":\"127.0.0.1\",\"port\":6379}' --type=json\n\n# Set recommended defaults\nsudo -u www-data php \/var\/www\/nextcloud\/occ background:cron\nsudo -u www-data php \/var\/www\/nextcloud\/occ config:system:set default_phone_region --value=US\nsudo -u www-data php \/var\/www\/nextcloud\/occ config:system:set logtimezone --value=UTC<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"9-configure-cron-for-background-jobs\">9) Configure cron for background jobs<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo crontab -u www-data -e<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>*\/5 * * * * php -f \/var\/www\/nextcloud\/cron.php &gt;\/dev\/null 2&gt;&amp;1<\/code><\/pre>\n\n\n\n<p>Background jobs handle previews, cleanups, and federation tasks efficiently.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"10-verify-the-installation\">10) Verify the installation<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo -u www-data php \/var\/www\/nextcloud\/occ status\nsudo tail -f \/var\/log\/nginx\/access.log \/var\/log\/nginx\/error.log<\/code><\/pre>\n\n\n\n<p>Open https:\/\/cloud.example.com in your browser. You should see the Nextcloud login.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"apache-variant-lamp-in-brief\">Apache Variant (LAMP) in Brief<\/h3>\n\n\n\n<p>Prefer Apache? Replace Nginx steps with the following essentials.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt -y install apache2 libapache2-mod-php\nsudo a2enmod rewrite headers env dir mime ssl http2 proxy_fcgi setenvif\nsudo a2dismod php*   # use PHP-FPM with Apache for performance\nsudo a2enconf php8.2-fpm<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/apache2\/sites-available\/nextcloud.conf<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;VirtualHost *:80&gt;\n  ServerName cloud.example.com\n  DocumentRoot \/var\/www\/nextcloud\n\n  &lt;Directory \/var\/www\/nextcloud\/&gt;\n    Require all granted\n    AllowOverride All\n    Options FollowSymLinks MultiViews\n  &lt;\/Directory&gt;\n\n  &lt;FilesMatch \"\\.php$\"&gt;\n    SetHandler \"proxy:unix:\/run\/php\/php8.2-fpm.sock|fcgi:\/\/localhost\/\"\n  &lt;\/FilesMatch&gt;\n\n  Header always set Strict-Transport-Security \"max-age=15552000; includeSubDomains\"\n  ErrorLog ${APACHE_LOG_DIR}\/nextcloud-error.log\n  CustomLog ${APACHE_LOG_DIR}\/nextcloud-access.log combined\n&lt;\/VirtualHost&gt;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo a2ensite nextcloud\nsudo a2dissite 000-default\nsudo systemctl reload apache2\nsudo apt -y install certbot python3-certbot-apache\nsudo certbot --apache -d cloud.example.com --redirect -m admin@example.com --agree-tos -n<\/code><\/pre>\n\n\n\n<p>Then run the same \u201cocc maintenance:install\u201d and hardening commands shown earlier.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"optional-snap-or-docker-from-command-line\">Optional: Snap or Docker from Command Line<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"snap-fastest-single-node-install\">Snap (fastest single node install)<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt -y install snapd\nsudo snap install core\nsudo snap install nextcloud\n# Create admin:\nsudo nextcloud.manual-install ncadmin \"AnotherStrongPassword\"\n# Add domain and TLS:\nsudo nextcloud.occ config:system:set trusted_domains 1 --value=cloud.example.com\nsudo nextcloud.enable-https lets-encrypt<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"docker-compose-portable\">Docker Compose (portable)<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir -p ~\/nextcloud &amp;&amp; cd ~\/nextcloud\nnano docker-compose.yml<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>services:\n  db:\n    image: mariadb:11\n    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW\n    restart: unless-stopped\n    environment:\n      - MYSQL_ROOT_PASSWORD=RootPass\n      - MYSQL_DATABASE=nextcloud\n      - MYSQL_USER=ncuser\n      - MYSQL_PASSWORD=StrongPasswordHere\n    volumes:\n      - db:\/var\/lib\/mysql\n\n  redis:\n    image: redis:7-alpine\n    restart: unless-stopped\n\n  app:\n    image: nextcloud:latest\n    restart: unless-stopped\n    ports:\n      - \"8080:80\"\n    depends_on:\n      - db\n      - redis\n    environment:\n      - MYSQL_HOST=db\n      - MYSQL_DATABASE=nextcloud\n      - MYSQL_USER=ncuser\n      - MYSQL_PASSWORD=StrongPasswordHere\n    volumes:\n      - nextcloud:\/var\/www\/html\n    links:\n      - redis\n\nvolumes:\n  db:\n  nextcloud:<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>docker compose up -d\n# Access via http:\/\/server-ip:8080 and finalize setup. Add a proper reverse proxy and TLS (e.g., Caddy\/Traefik\/Nginx) for production.<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"performance-tuning-and-hardening\">Performance Tuning and Hardening<\/h3>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"php-and-upload-limits\">PHP and upload limits<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/php\/8.2\/fpm\/php.ini<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>memory_limit = 512M\nupload_max_filesize = 512M\npost_max_size = 512M\nopcache.enable=1\nopcache.enable_cli=1\nopcache.memory_consumption=256\nopcache.interned_strings_buffer=16\nopcache.max_accelerated_files=10000\nopcache.validate_timestamps=1\nopcache.revalidate_freq=60\nexpose_php = Off<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart php8.2-fpm<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"nginx-security-headers-and-hsts\">Nginx security headers and HSTS<\/h3>\n\n\n\n<p>Add or confirm these in your server block for better security and caching control.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>add_header Strict-Transport-Security \"max-age=15552000; includeSubDomains\" always;\nadd_header X-Content-Type-Options nosniff;\nadd_header X-Frame-Options SAMEORIGIN;\nadd_header X-XSS-Protection \"1; mode=block\";\nadd_header Referrer-Policy no-referrer;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"database-basics\">Database basics<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use utf8mb4 for full Unicode support<\/li>\n\n\n\n<li>Run mysql_secure_installation and limit remote root access<\/li>\n\n\n\n<li>Schedule backups (logical dump + offsite copy)<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"backups-and-updates\">Backups and updates<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Files backup (example)\nrsync -Aax \/var\/www\/nextcloud\/ \/backup\/nextcloud-app\/\nrsync -Aax \/var\/www\/nextcloud-data\/ \/backup\/nextcloud-data\/\n\n# MariaDB backup\nmysqldump -u root -p nextcloud &gt; \/backup\/nextcloud_$(date +%F).sql<\/code><\/pre>\n\n\n\n<p>Test restore procedures regularly. Keep the OS and PHP packages updated.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"common-errors-and-fixes-from-the-cli\">Common Errors and Fixes from the CLI<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>403 or 404 after install:<\/strong> Check Nginx\/Apache vhost root path and try_files rules.<\/li>\n\n\n\n<li><strong>File upload size too small:<\/strong> Increase upload_max_filesize and post_max_size, reload PHP\/Nginx.<\/li>\n\n\n\n<li><strong>\u201cCan\u2019t write into config directory\u201d:<\/strong> Fix ownership to www data and correct permissions.<\/li>\n\n\n\n<li><strong>Background jobs not running:<\/strong> Ensure crontab for www data is set to run every 5 minutes.<\/li>\n\n\n\n<li><strong>Redis not used:<\/strong> Confirm php redis installed and Redis settings set via occ.<\/li>\n\n\n\n<li><strong>SELinux (RHEL based): <\/strong>Set proper contexts or temporarily permissive for testing.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"upgrade-nextcloud-safely-from-the-command-line\">Upgrade Nextcloud Safely from the Command Line<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create backups of app, data, and database<\/li>\n\n\n\n<li>Put Nextcloud in maintenance mode<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo -u www-data php \/var\/www\/nextcloud\/occ maintenance:mode --on\nsudo -u www-data php \/var\/www\/nextcloud\/occ upgrade\nsudo -u www-data php \/var\/www\/nextcloud\/occ maintenance:mode --off<\/code><\/pre>\n\n\n\n<p>For major upgrades, read the official changelog and upgrade step-by-step across supported versions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"why-host-nextcloud-on-youstable\">Why Host Nextcloud on YouStable<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>SSD or NVMe backed VPS with dedicated vCPU for faster PHP and database performance<\/li>\n\n\n\n<li>Clean IPv4, modern data centers, and quick OS templates (Ubuntu\/Debian)<\/li>\n\n\n\n<li>24\u00d77 expert support that understands web hosting, WordPress, and self hosted stacks like Nextcloud<\/li>\n<\/ul>\n\n\n\n<p>If you want predictable performance and simple scaling, <strong><a href=\"https:\/\/www.youstable.com\/\">YouStable\u2019s VPS and dedicated servers<\/a><\/strong> are a strong fit for Nextcloud deployments of any size.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"faqs\">FAQ&#8217;s<\/h2>\n\n\n<div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-question-1768881327193\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"1-is-nginx-or-apache-better-for-a-nextcloud-cli-install\">1. Is Nginx or Apache better for a Nextcloud CLI install?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Both work well. Nginx with PHP-FPM typically offers better resource usage and performance, while Apache can be simpler to configure for some admins. For large instances, Nginx + PHP-FPM + Redis is a popular choice.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1768881336731\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"2-what-are-the-minimum-php-modules-for-nextcloud\">2. What are the minimum PHP modules for Nextcloud?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>At minimum: php-fpm, php-cli, php-mysql or php-pgsql, php-xml, php-zip, php-gd, php-curl, php-mbstring, php-intl. For better caching and file locking, add php-apcu and php-redis, and php-imagick for previews.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1768881347454\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"3-how-do-i-enable-https-during-a-command-line-install\">3. How do I enable HTTPS during a command line install?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Use Certbot with the Nginx or Apache plugin to issue Let\u2019s Encrypt certificates, then auto configure redirects and renewal. Example: \u201ccertbot &#8211;nginx -d cloud.example.com &#8211;redirect -n\u201d. For Docker, terminate TLS in your reverse proxy.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1768881418369\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"4-can-i-install-nextcloud-with-postgresql-from-the-cli\">4. Can I install Nextcloud with PostgreSQL from the CLI?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Yes. Install PostgreSQL, create a database and user, then run the installer with \u201c&#8211;database pgsql\u201d and the correct credentials. Many large deployments prefer PostgreSQL for concurrency and stability.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1768881425767\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"5-whats-the-fastest-way-to-deploy-nextcloud-for-testing\">5. What\u2019s the fastest way to deploy Nextcloud for testing?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Snap is the quickest single node method. Run \u201csnap install nextcloud\u201d, set the admin user, and enable Let\u2019s Encrypt. For production grade portability, Docker with a reverse proxy (Caddy\/Traefik\/Nginx) is also fast and reproducible.<br \/>With these steps, you can Install NextCloud From Command Line confidently, optimize performance, and harden security from day one. As your storage and users grow, consider scaling up on a <a href=\"https:\/\/www.youstable.com\/vps-hosting\/\">YouStable VPS<\/a> or <a href=\"https:\/\/www.youstable.com\/dedicated-servers\/\">dedicated server<\/a> for consistent, reliable performance.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>To install Nextcloud from the command line, prepare a LEMP or LAMP stack, create a database, download the Nextcloud release, [&hellip;]<\/p>\n","protected":false},"author":21,"featured_media":17853,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[350],"tags":[],"class_list":["post-17140","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-knowledgebase"],"acf":[],"featured_image_src":"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2026\/01\/Install-NextCloud-From-Command-Line.jpg","author_info":{"display_name":"Sanjeet Chauhan","author_link":"https:\/\/www.youstable.com\/blog\/author\/sanjeet"},"_links":{"self":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/17140","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/comments?post=17140"}],"version-history":[{"count":8,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/17140\/revisions"}],"predecessor-version":[{"id":17855,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/17140\/revisions\/17855"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/media\/17853"}],"wp:attachment":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/media?parent=17140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/categories?post=17140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/tags?post=17140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}