{"id":7897,"date":"2026-04-11T10:08:52","date_gmt":"2026-04-11T04:38:52","guid":{"rendered":"https:\/\/qloudhost.com\/blog\/?p=7897"},"modified":"2026-04-11T10:08:54","modified_gmt":"2026-04-11T04:38:54","slug":"how-to-install-nextcloud-from-command-line","status":"publish","type":"post","link":"https:\/\/qloudhost.com\/blog\/how-to-install-nextcloud-from-command-line","title":{"rendered":"How to Install NextCloud From Command Line? 2026 Brief Guide"},"content":{"rendered":"\n<p>To install NextCloud from the command line, prepare a LEMP\/LAMP stack, create a database, download the Nextcloud tarball, configure your web server (Nginx or Apache), run the occ CLI installer, enable HTTPS, and set up cron and caching (Redis).<\/p>\n\n\n\n<p>The steps below cover Docker, Snap, and production-grade manual installs.<\/p>\n\n\n\n<p>If you want a private, self-hosted cloud with full control, learning how to Install NextCloud From Command Line is the fastest and most reliable path.<\/p>\n\n\n\n<p>This guide walks you through Docker, Snap, and a hardened Ubuntu\/Debian stack with Nginx, PHP-FPM, MariaDB, and Redis\u2014entirely via CLI.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"544\" height=\"469\" src=\"https:\/\/qloudhost.com\/blog\/wp-content\/uploads\/2025\/12\/Install-NextCloud-From-Command-Line.png\" alt=\"Install NextCloud From Command Line\" class=\"wp-image-8073\" style=\"width:268px;height:auto\" title=\"\" srcset=\"https:\/\/qloudhost.com\/blog\/wp-content\/uploads\/2025\/12\/Install-NextCloud-From-Command-Line.png 544w, https:\/\/qloudhost.com\/blog\/wp-content\/uploads\/2025\/12\/Install-NextCloud-From-Command-Line-300x259.png 300w\" sizes=\"auto, (max-width: 544px) 100vw, 544px\" \/><\/figure>\n<\/div>\n\n\n<nav\n    id=\"block_f02dac98ced9dcc235784dabb660d604\"\n    class=\"acf-toc acf-toc--smooth-scroll\"\n    aria-label=\"Table of Contents\"\n        >\n                        <p class=\"acf-toc__title\">\n                Table of Contents            <\/p>\n                <div class=\"acf-toc__content\">\n            <ul><li class=\"acf-toc__item acf-toc__item--depth-0\" data-level=\"2\"><a href=\"#what-youll-learn-here-and-what-you-need\" class=\"acf-toc__link\">What you\u2019ll Learn Here (and what you need)<\/a><\/li><li class=\"acf-toc__item acf-toc__item--depth-0\" data-level=\"2\"><a href=\"#quick-start-docker-one-liner-fastest-way\" class=\"acf-toc__link\">Quick Start: Docker One-Liner (fastest way)<\/a><\/li><li class=\"acf-toc__item acf-toc__item--depth-0\" data-level=\"2\"><a href=\"#production-grade-cli-install-ubuntu-debian-nginx-php-fpm-mariadb-redis\" class=\"acf-toc__link\">Production-grade CLI Install (Ubuntu\/Debian + Nginx + PHP-FPM + MariaDB + Redis)<\/a><\/li><li class=\"acf-toc__item acf-toc__item--depth-0\" data-level=\"2\"><a href=\"#alternative-install-nextcloud-with-snap-simplest-cli\" class=\"acf-toc__link\">Alternative: Install NextCloud with Snap (simplest CLI)<\/a><\/li><li class=\"acf-toc__item acf-toc__item--depth-0\" data-level=\"2\"><a href=\"#post-install-hardening-and-performance-tips\" class=\"acf-toc__link\">Post-install Hardening and Performance Tips<\/a><\/li><li class=\"acf-toc__item acf-toc__item--depth-0\" data-level=\"2\"><a href=\"#essential-nextcloud-cli-occ-commands\" class=\"acf-toc__link\">Essential NextCloud CLI (occ) Commands<\/a><\/li><li class=\"acf-toc__item acf-toc__item--depth-0\" data-level=\"2\"><a href=\"#troubleshooting-from-the-command-line\" class=\"acf-toc__link\">Troubleshooting From the Command Line<\/a><\/li><li class=\"acf-toc__item acf-toc__item--depth-0\" data-level=\"2\"><a href=\"#real-world-guidance-from-hosting-experience\" class=\"acf-toc__link\">Real-world Guidance From Hosting Experience<\/a><\/li><li class=\"acf-toc__item acf-toc__item--depth-0\" data-level=\"2\"><a href=\"#why-host-nextcloud-with-qloudhost\" class=\"acf-toc__link\">Why host NextCloud With QloudHost<\/a><\/li><li class=\"acf-toc__item acf-toc__item--depth-0\" data-level=\"2\"><a href=\"#faqs-install-nextcloud-from-command-line\" class=\"acf-toc__link\">FAQs: Install NextCloud From Command Line<\/a><\/li><li class=\"acf-toc__item acf-toc__item--depth-0\" data-level=\"2\"><a href=\"#conclusion\" class=\"acf-toc__link\">Conclusion<\/a><\/li><\/ul>        <\/div>\n    <\/nav>\n\n<script type=\"application\/ld+json\">{\"@context\":\"https:\/\/schema.org\",\"@type\":\"ItemList\",\"itemListElement\":[{\"@type\":\"SiteNavigationElement\",\"position\":1,\"name\":\"What you\u2019ll Learn Here (and what you need)\",\"url\":\"https:\/\/qloudhost.com\/blog\/how-to-install-nextcloud-from-command-line#what-youll-learn-here-and-what-you-need\"},{\"@type\":\"SiteNavigationElement\",\"position\":2,\"name\":\"Quick Start: Docker One-Liner (fastest way)\",\"url\":\"https:\/\/qloudhost.com\/blog\/how-to-install-nextcloud-from-command-line#quick-start-docker-one-liner-fastest-way\"},{\"@type\":\"SiteNavigationElement\",\"position\":3,\"name\":\"Production-grade CLI Install (Ubuntu\/Debian + Nginx + PHP-FPM + MariaDB + Redis)\",\"url\":\"https:\/\/qloudhost.com\/blog\/how-to-install-nextcloud-from-command-line#production-grade-cli-install-ubuntu-debian-nginx-php-fpm-mariadb-redis\"},{\"@type\":\"SiteNavigationElement\",\"position\":4,\"name\":\"Alternative: Install NextCloud with Snap (simplest CLI)\",\"url\":\"https:\/\/qloudhost.com\/blog\/how-to-install-nextcloud-from-command-line#alternative-install-nextcloud-with-snap-simplest-cli\"},{\"@type\":\"SiteNavigationElement\",\"position\":5,\"name\":\"Post-install Hardening and Performance Tips\",\"url\":\"https:\/\/qloudhost.com\/blog\/how-to-install-nextcloud-from-command-line#post-install-hardening-and-performance-tips\"},{\"@type\":\"SiteNavigationElement\",\"position\":6,\"name\":\"Essential NextCloud CLI (occ) Commands\",\"url\":\"https:\/\/qloudhost.com\/blog\/how-to-install-nextcloud-from-command-line#essential-nextcloud-cli-occ-commands\"},{\"@type\":\"SiteNavigationElement\",\"position\":7,\"name\":\"Troubleshooting From the Command Line\",\"url\":\"https:\/\/qloudhost.com\/blog\/how-to-install-nextcloud-from-command-line#troubleshooting-from-the-command-line\"},{\"@type\":\"SiteNavigationElement\",\"position\":8,\"name\":\"Real-world Guidance From Hosting Experience\",\"url\":\"https:\/\/qloudhost.com\/blog\/how-to-install-nextcloud-from-command-line#real-world-guidance-from-hosting-experience\"},{\"@type\":\"SiteNavigationElement\",\"position\":9,\"name\":\"Why host NextCloud With QloudHost\",\"url\":\"https:\/\/qloudhost.com\/blog\/how-to-install-nextcloud-from-command-line#why-host-nextcloud-with-qloudhost\"},{\"@type\":\"SiteNavigationElement\",\"position\":10,\"name\":\"FAQs: Install NextCloud From Command Line\",\"url\":\"https:\/\/qloudhost.com\/blog\/how-to-install-nextcloud-from-command-line#faqs-install-nextcloud-from-command-line\"},{\"@type\":\"SiteNavigationElement\",\"position\":11,\"name\":\"Conclusion\",\"url\":\"https:\/\/qloudhost.com\/blog\/how-to-install-nextcloud-from-command-line#conclusion\"}]}<\/script><style>html:has(.acf-toc--smooth-scroll){scroll-behavior:smooth}@media(prefers-reduced-motion:reduce){html:has(.acf-toc--smooth-scroll){scroll-behavior:auto}}<\/style>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 id=\"what-youll-learn-here-and-what-you-need\" class=\"wp-block-heading\"><strong>What you\u2019ll Learn Here (and what you need)<\/strong><\/h2>\n\n\n\n<p>This tutorial is designed for beginners and sysadmins alike. You\u2019ll learn repeatable commands to deploy, secure, and maintain Nextcloud. <a href=\"https:\/\/qloudhost.com\/blog\/how-to-install-nextcloud-on-ubuntu\/\">We\u2019ll use Ubuntu\/Debian<\/a> for examples (24.04\/22.04 and 12\/11), with notes for RHEL\/CentOS\/Rocky. You\u2019ll need:<\/p>\n\n\n\n<div id=\"affiliate-style-a0a30afb-a840-47c7-8a55-127493db2491\" class=\"wp-block-affiliate-booster-ab-icon-list affiliate-block-a0a30a affiliate-iconlist-wrapper\"><div class=\"affiliate-iconlist-inner aff-list-isshow-icon\"><div class=\"affiliate-block-advanced-list affiliate-icon-list affiliate-alignment-left\"><ul class=\"affiliate-list affiliate-list-type-unordered affiliate-list-bullet-arrow-alt-circle-right\"><li>A fresh VPS or dedicated server (2+ vCPU, 4 GB RAM recommended, SSD storage)<\/li><li>Root or sudo access<\/li><li>A domain pointing to your server (e.g., cloud.example.com)<\/li><li>Ports 80 and 443 open in firewall<\/li><\/ul><\/div><\/div><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 id=\"quick-start-docker-one-liner-fastest-way\" class=\"wp-block-heading\"><strong>Quick Start: Docker One-Liner (fastest way)<\/strong><\/h2>\n\n\n\n<p>Use Docker for a quick, reproducible CLI deployment. The command below starts Nextcloud with SQLite (great for testing). For production, pair Nextcloud with MariaDB\/PostgreSQL and Redis (compose file suggested).<\/p>\n\n\n\n<pre class=\"wp-block-code has-vce-bg-color has-vce-meta-background-color has-text-color has-background has-link-color wp-elements-7c54611fe31a36ad21ed2acd15e21c03\"><code># Install Docker if missing (Ubuntu\/Debian)\ncurl -fsSL https:\/\/get.docker.com | sudo sh\n\n# Quick test deployment (SQLite)\nsudo docker run -d --name nextcloud \\\n  -p 8080:80 \\\n  -v nextcloud:\/var\/www\/html \\\n  nextcloud:stable\n\n# Open http:\/\/SERVER_IP:8080 and complete the setup wizard\n# For production, prefer a compose stack with MariaDB + Redis. Example:\ncat &gt; docker-compose.yml &lt;&lt;'YAML'\nservices:\n  db:\n    image: mariadb:10.11\n    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW\n    restart: unless-stopped\n    environment:\n      - MARIADB_DATABASE=nextcloud\n      - MARIADB_USER=ncuser\n      - MARIADB_PASSWORD=StrongDBPass\n      - MARIADB_ROOT_PASSWORD=RootDBPass\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:stable\n    restart: unless-stopped\n    ports:\n      - \"80:80\"\n    environment:\n      - MYSQL_HOST=db\n      - MYSQL_DATABASE=nextcloud\n      - MYSQL_USER=ncuser\n      - MYSQL_PASSWORD=StrongDBPass\n      - REDIS_HOST=redis\n    depends_on:\n      - db\n      - redis\n    volumes:\n      - nextcloud:\/var\/www\/html\n\nvolumes:\n  db:\n  nextcloud:\nYAML\n\nsudo docker compose up -d<\/code><\/pre>\n\n\n\n<p>Add a reverse proxy and Let\u2019s Encrypt (e.g., Traefik or Nginx Proxy Manager) to serve your domain over HTTPS.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 id=\"production-grade-cli-install-ubuntu-debian-nginx-php-fpm-mariadb-redis\" class=\"wp-block-heading\"><strong>Production-grade CLI Install (Ubuntu\/Debian + Nginx + PHP-FPM + MariaDB + Redis)<\/strong><\/h2>\n\n\n\n<p>This is the most common, performance-friendly stack for Nextcloud. All steps are strictly via command line.<\/p>\n\n\n\n<h3 id=\"1-update-server-and-install-packages\" class=\"wp-block-heading\"><strong>1) Update server and install packages<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code has-vce-bg-color has-vce-meta-background-color has-text-color has-background has-link-color wp-elements-553795972a13911648ced49dac36d8fa\"><code>sudo apt update &amp;&amp; sudo apt -y upgrade\n\n# Install Nginx, MariaDB, Redis, PHP-FPM and needed extensions\nsudo apt -y install nginx mariadb-server redis-server \\\n  php php-fpm php-cli php-mysql php-xml php-curl php-gd php-zip php-mbstring php-intl php-bcmath php-gmp php-imagick php-apcu php-redis\n\n# Optional: ensure Redis listens on a Unix socket and allow web user\nsudo usermod -aG redis www-data\nsudo systemctl enable --now nginx mariadb redis-server php-fpm<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 id=\"2-create-database-and-user\" class=\"wp-block-heading\"><strong>2) Create database and user<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code has-vce-bg-color has-vce-meta-background-color has-text-color has-background has-link-color wp-elements-2df83705d0d3fd68f2d0ffb4ba9b6d24\"><code>sudo mysql -e \"CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;\"\nsudo mysql -e \"CREATE USER 'ncuser'@'localhost' IDENTIFIED BY 'StrongDBPass!';\"\nsudo mysql -e \"GRANT ALL PRIVILEGES ON nextcloud.* TO 'ncuser'@'localhost'; FLUSH PRIVILEGES;\"<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 id=\"3-download-nextcloud-and-set-permissions\" class=\"wp-block-heading\"><strong>3) Download NextCloud and set permissions<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code has-vce-bg-color has-vce-meta-background-color has-text-color has-background has-link-color wp-elements-6cf61533aad526426fd64d4b66e3dca9\"><code># Get latest stable\ncd \/tmp\ncurl -LO https:\/\/download.nextcloud.com\/server\/releases\/latest.tar.bz2\ncurl -LO https:\/\/download.nextcloud.com\/server\/releases\/latest.tar.bz2.sha256\nsha256sum -c latest.tar.bz2.sha256  # (Optional but recommended)\n\n# Extract and move into web root\ntar -xjf latest.tar.bz2\nsudo rsync -Aax nextcloud\/ \/var\/www\/nextcloud\/\n\n# Ownership for web server user\nsudo chown -R www-data:www-data \/var\/www\/nextcloud<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 id=\"4-configure-nginx-for-nextcloud\" class=\"wp-block-heading\"><strong>4) Configure Nginx for Nextcloud<\/strong><\/h3>\n\n\n\n<p>Replace cloud.example.com with your domain. This config targets PHP-FPM\u2019s default socket and includes best practices for caching and security.<\/p>\n\n\n\n<pre class=\"wp-block-code has-vce-bg-color has-vce-meta-background-color has-text-color has-background has-link-color wp-elements-170008315572d718215dd2ce5ab0aa16\"><code>sudo tee \/etc\/nginx\/sites-available\/nextcloud &gt;\/dev\/null &lt;&lt;'NGINX'\nserver {\n  listen 80;\n  listen &#91;::]:80;\n  server_name cloud.example.com;\n\n  root \/var\/www\/nextcloud;\n  index index.php index.html \/index.php$request_uri;\n\n  client_max_body_size 512M;\n  fastcgi_buffers 64 4K;\n\n  # HSTS disabled on HTTP; enabled after HTTPS is configured\n  add_header Referrer-Policy \"no-referrer\" always;\n  add_header X-Content-Type-Options \"nosniff\" always;\n  add_header X-Frame-Options \"SAMEORIGIN\" always;\n  add_header X-XSS-Protection \"1; mode=block\" always;\n\n  location = \/robots.txt { allow all; log_not_found off; access_log off; }\n  location = \/.well-known\/carddav { return 301 \/remote.php\/dav; }\n  location = \/.well-known\/caldav  { return 301 \/remote.php\/dav; }\n  location ^~ \/.well-known\/acme-challenge { root \/var\/www\/nextcloud; }\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\/php-fpm.sock;\n    fastcgi_intercept_errors on;\n    fastcgi_request_buffering off;\n  }\n\n  location ~ \\.(?:css|js|woff2?|svg|gif)$ {\n    try_files $uri \/index.php$request_uri;\n    add_header Cache-Control \"public, max-age=15778463\";\n    access_log off;     log_not_found off;\n  }\n\n  location ~ \\.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ {\n    try_files $uri \/index.php$request_uri;\n    access_log off;     log_not_found off;\n  }\n}\nNGINX\n\nsudo 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<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 id=\"5-get-a-free-ssl-certificate-lets-encrypt\" class=\"wp-block-heading\"><strong>5) Get a free SSL certificate (Let\u2019s Encrypt)<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code has-vce-bg-color has-vce-meta-background-color has-text-color has-background has-link-color wp-elements-fb1b6b2babf7b012507afc1203f98a0b\"><code>sudo apt -y install certbot python3-certbot-nginx\nsudo certbot --nginx -d cloud.example.com --redirect --agree-tos -m you@yourdomain.com -n\n\n# After HTTPS, you can enable HSTS:\nsudo sed -i '\/server_name cloud.example.com;\/a \\  add_header Strict-Transport-Security \"max-age=15552000; includeSubDomains\" always;' \/etc\/nginx\/sites-available\/nextcloud\nsudo nginx -t &amp;&amp; sudo systemctl reload nginx<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 id=\"6-run-the-nextcloud-cli-installer-occ\" class=\"wp-block-heading\"><strong>6) Run the NextCloud CLI installer (occ)<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code has-vce-bg-color has-vce-meta-background-color has-text-color has-background has-link-color wp-elements-6927dcbb5d886ef597af70b69391b67e\"><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 \"StrongDBPass!\" \\\n --admin-user \"admin\" \\\n --admin-pass \"AdminPass123!\" \\\n --data-dir \"\/var\/www\/nextcloud\/data\"\n\n# Set trusted domain\nsudo -u www-data php \/var\/www\/nextcloud\/occ config:system:set trusted_domains 1 --value=\"cloud.example.com\"<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 id=\"7-enable-redis-caching-and-cron\" class=\"wp-block-heading\"><strong>7) Enable Redis Caching and Cron<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code has-vce-bg-color has-vce-meta-background-color has-text-color has-background has-link-color wp-elements-ab9ced01226511c6d032943455950754\"><code># Configure Redis socket (Ubuntu default is typically \/var\/run\/redis\/redis-server.sock)\n# Ensure www-data belongs to 'redis' group (we did earlier)\n# Add to Nextcloud config.php\nsudo -u www-data php -r '\n$file=\"\/var\/www\/nextcloud\/config\/config.php\";\n$c = include $file;\n$c&#91;\"memcache.local\"] = \"\\OC\\Memcache\\APCu\";\n$c&#91;\"memcache.locking\"] = \"\\OC\\Memcache\\Redis\";\n$c&#91;\"redis\"] = &#91;\"host\" =&gt; \"\/var\/run\/redis\/redis-server.sock\",\"port\" =&gt; 0];\nfile_put_contents($file, \"&lt;?php\\nreturn \".var_export($c,true).\";\\n\");'\n\n# Set system cron to run every 5 minutes\nsudo -u www-data crontab -l 2&gt;\/dev\/null | { cat; echo \"*\/5 * * * * php -f \/var\/www\/nextcloud\/cron.php\"; } | sudo -u www-data crontab -<\/code><\/pre>\n\n\n\n<p>Visit https:\/\/cloud.example.com, log in as admin, and verify there are no critical warnings under Administration &gt; Overview.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 id=\"alternative-install-nextcloud-with-snap-simplest-cli\" class=\"wp-block-heading\"><strong>Alternative: Install NextCloud with Snap (simplest CLI)<\/strong><\/h2>\n\n\n\n<p>Snap bundles everything for you. It\u2019s easy to maintain, though less flexible than a manual or Docker setup.<\/p>\n\n\n\n<pre class=\"wp-block-code has-vce-bg-color has-vce-meta-background-color has-text-color has-background has-link-color wp-elements-a90192c81d67a5a5f092fc99151f686d\"><code>sudo apt update &amp;&amp; sudo apt -y install snapd\nsudo snap install nextcloud\n\n# Create admin user (prompted interactively)\nsudo nextcloud.manual-install admin AdminPass123!\n\n# Enable HTTPS (Let\u2019s Encrypt)\nsudo nextcloud.enable-https lets-encrypt\n\n# Set domain\nsudo nextcloud.occ config:system:set trusted_domains 1 --value=\"cloud.example.com\"<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 id=\"rhel-centos-rocky-linux-quick-notes-cli\" class=\"wp-block-heading\"><strong>RHEL\/CentOS\/Rocky Linux quick notes (CLI)<\/strong><\/h3>\n\n\n\n<p>Enable newer PHP via Remi or AppStream, then proceed similarly to Ubuntu. Example:<\/p>\n\n\n\n<pre class=\"wp-block-code has-vce-bg-color has-vce-meta-background-color has-text-color has-background has-link-color wp-elements-0b5297642cfdd328f41718024df8fb60\"><code>sudo dnf -y install epel-release\nsudo dnf -y install nginx mariadb-server redis\nsudo dnf -y module reset php\nsudo dnf -y module enable php:8.2\nsudo dnf -y install php php-fpm php-mysqlnd php-xml php-gd php-mbstring php-intl php-bcmath php-gmp php-pecl-zip php-pecl-redis php-pecl-apcu\n\nsudo systemctl enable --now nginx mariadb redis php-fpm\n\n# Then follow the same Nextcloud download, Nginx config, certbot, and occ steps.\n# If SELinux is enforcing, add proper contexts:\nsudo semanage fcontext -a -t httpd_sys_rw_content_t \"\/var\/www\/nextcloud(\/.*)?\"\nsudo restorecon -Rv \/var\/www\/nextcloud<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 id=\"post-install-hardening-and-performance-tips\" class=\"wp-block-heading\"><strong>Post-install Hardening and Performance Tips<\/strong><\/h2>\n\n\n\n<div id=\"affiliate-style-d131ee9a-ca89-475b-b085-ca0c0a946ad0\" class=\"wp-block-affiliate-booster-ab-icon-list affiliate-block-d131ee affiliate-iconlist-wrapper\"><div class=\"affiliate-iconlist-inner aff-list-isshow-icon\"><div class=\"affiliate-block-advanced-list affiliate-icon-list affiliate-alignment-left\"><ul class=\"affiliate-list affiliate-list-type-unordered affiliate-list-bullet-arrow-alt-circle-right\"><li>Increase PHP limits for large files: memory_limit=512M, upload_max_filesize=512M, post_max_size=512M, max_execution_time=360<\/li><li>Enable and tune OPcache (php.ini): opcache.enable=1, opcache.memory_consumption=256, opcache.interned_strings_buffer=16, opcache.max_accelerated_files=10000, opcache.save_comments=1<\/li><li>Force HTTPS and enable HSTS once validated<\/li><li>Put Nextcloud behind a CDN or reverse proxy if serving many users<\/li><li>Move data directory to a larger disk or block storage for scale<\/li><li>Enable previews with a cron job for better UX: occ preview:generate-all<\/li><\/ul><\/div><\/div><\/div>\n\n\n\n<h2 id=\"essential-nextcloud-cli-occ-commands\" class=\"wp-block-heading\"><strong>Essential NextCloud CLI (occ) Commands<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code has-vce-bg-color has-vce-meta-background-color has-text-color has-background has-link-color wp-elements-53c545c4fb236837421221aae79ec4de\"><code># Run as web user\nsudo -u www-data php \/var\/www\/nextcloud\/occ status\nsudo -u www-data php \/var\/www\/nextcloud\/occ user:add alice\nsudo -u www-data php \/var\/www\/nextcloud\/occ app:list\nsudo -u www-data php \/var\/www\/nextcloud\/occ app:install contacts calendar\nsudo -u www-data php \/var\/www\/nextcloud\/occ db:add-missing-indices\nsudo -u www-data php \/var\/www\/nextcloud\/occ db:convert-filecache-bigint\nsudo -u www-data php \/var\/www\/nextcloud\/occ maintenance:mode --on\nsudo -u www-data php \/var\/www\/nextcloud\/occ maintenance:mode --off<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 id=\"troubleshooting-from-the-command-line\" class=\"wp-block-heading\"><strong>Troubleshooting From the Command Line<\/strong><\/h2>\n\n\n\n<div id=\"affiliate-style-28407692-572d-4888-90c9-b554ee756e9b\" class=\"wp-block-affiliate-booster-ab-icon-list affiliate-block-284076 affiliate-iconlist-wrapper\"><div class=\"affiliate-iconlist-inner aff-list-isshow-icon\"><div class=\"affiliate-block-advanced-list affiliate-icon-list affiliate-alignment-left\"><ul class=\"affiliate-list affiliate-list-type-unordered affiliate-list-bullet-arrow-alt-circle-right\"><li>Permissions: Ensure \/var\/www\/nextcloud is owned by www-data (or your web user).<\/li><li>Logs: Check \/var\/www\/nextcloud\/data\/nextcloud.log, \/var\/log\/nginx\/error.log, and PHP-FPM logs.<\/li><li>Database connectivity: Verify credentials and socket\/host in config.php.<\/li><li>PHP modules: Confirm required extensions are installed and loaded.<\/li><li>SELinux (RHEL-based): Apply proper contexts and allow network connections for PHP-FPM if needed.<\/li><\/ul><\/div><\/div><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 id=\"real-world-guidance-from-hosting-experience\" class=\"wp-block-heading\"><strong>Real-world Guidance From Hosting Experience<\/strong><\/h2>\n\n\n\n<p>For teams and SMBs, reliability matters more than the novelty of the stack. Use Nginx + PHP-FPM with Redis, dedicate fast SSD storage, and keep nightly offsite backups. Monitor disk inode usage, database growth, and PHP-FPM pool saturation to prevent bottlenecks long before users notice slowdowns.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 id=\"why-host-nextcloud-with-qloudhost\" class=\"wp-block-heading\"><strong>Why host NextCloud With <\/strong>QloudHost<\/h2>\n\n\n\n<div class=\"wp-block-media-text has-media-on-the-right is-stacked-on-mobile\" style=\"grid-template-columns:auto 35%\"><div class=\"wp-block-media-text__content\">\n<p>If you\u2019d prefer to skip trial-and-error, <strong><a href=\"https:\/\/qloudhost.com\/offshore-vps-hosting\/\">QloudHost\u2019s SSD-powered VPS plans<\/a><\/strong> are optimized for PHP workloads and include dedicated resources, root access, and optional managed support. <\/p>\n<\/div><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"796\" height=\"619\" src=\"https:\/\/qloudhost.com\/blog\/wp-content\/uploads\/2025\/07\/Screenshot-2025-07-12-120807.png\" alt=\"Visit QloudHost\" class=\"wp-image-5631 size-full\" title=\"\" srcset=\"https:\/\/qloudhost.com\/blog\/wp-content\/uploads\/2025\/07\/Screenshot-2025-07-12-120807.png 796w, https:\/\/qloudhost.com\/blog\/wp-content\/uploads\/2025\/07\/Screenshot-2025-07-12-120807-300x233.png 300w, https:\/\/qloudhost.com\/blog\/wp-content\/uploads\/2025\/07\/Screenshot-2025-07-12-120807-768x597.png 768w\" sizes=\"auto, (max-width: 796px) 100vw, 796px\" \/><\/figure><\/div>\n\n\n\n<p>We can pre-harden your Nextcloud stack (Nginx, MariaDB, Redis, HTTPS) and help you scale confidently while you focus on your data, not server plumbing.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 id=\"faqs-install-nextcloud-from-command-line\" class=\"wp-block-heading\"><strong>FAQs: Install NextCloud From Command Line<\/strong><\/h2>\n\n\n<div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-question-1766463104740\" class=\"rank-math-list-item\">\n<h3 id=\"can-i-install-nextcloud-entirely-without-a-web-browser\" class=\"rank-math-question \"><strong>Can I install Nextcloud entirely without a web browser?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Yes. <a href=\"https:\/\/qloudhost.com\/blog\/install-nextcloud-on-web-panels-via-web-installer\/\">Use the occ CLI installer to create the admin account<\/a> and connect the database. With a proper Nginx\/Apache config and HTTPS in place, your instance will be ready. You can also manage users, apps, and maintenance tasks entirely via occ.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1766463109198\" class=\"rank-math-list-item\">\n<h3 id=\"whats-the-easiest-command-line-method-for-beginners\" class=\"rank-math-question \"><strong>What\u2019s the easiest command-line method for beginners?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Snap is the simplest option: snap install nextcloud, then nextcloud.manual-install and nextcloud.enable-https. Docker is the next easiest for reproducibility. The manual Nginx\/PHP stack offers the most control and performance for production.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1766463110836\" class=\"rank-math-list-item\">\n<h3 id=\"which-database-should-i-use-for-nextcloud\" class=\"rank-math-question \"><strong>Which database should I use for Nextcloud?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>MariaDB and PostgreSQL are both robust. MariaDB is popular and well-documented; PostgreSQL excels at concurrency. Avoid SQLite for multi-user production systems\u2014it\u2019s fine for light testing or personal use but not for scale.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1766463112558\" class=\"rank-math-list-item\">\n<h3 id=\"how-much-ram-and-cpu-does-nextcloud-need\" class=\"rank-math-question \"><strong>How much RAM and CPU does Nextcloud need?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>For small teams (up to ~20 users), 2 vCPU and 4 GB RAM is a practical baseline with Redis caching. Increase resources as user count, apps (Collabora\/ONLYOFFICE), and file preview workloads grow.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1766463114946\" class=\"rank-math-list-item\">\n<h3 id=\"how-do-i-enable-https-for-a-cli-only-deployment\" class=\"rank-math-question \"><strong>How do I enable HTTPS for a CLI-only deployment?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Use Certbot. On Ubuntu\/Debian with Nginx: certbot &#8211;nginx -d cloud.example.com &#8211;redirect. Ensure DNS points to your server and ports 80\/443 are open. For Snap installs, use nextcloud.enable-https lets-encrypt. For Docker, add a reverse proxy (Traefik or Nginx Proxy Manager) with automated certificates.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 id=\"conclusion\" class=\"wp-block-heading\">Conclusion <\/h2>\n\n\n\n<p>Installing Nextcloud from the command line might feel technical at first, but this guide proves that it is completely manageable for beginners and experienced sysadmins alike. Whether you choose the quick Docker one-liner, the beginner-friendly Snap method, or the full production-grade Nginx + PHP-FPM + MariaDB + Redis stack, every path leads to the same destination: a self-hosted, private cloud that you fully own and control.<\/p>\n\n\n\n<p>The key takeaway from this guide is that the method you choose should match your goal. Docker is perfect for testing and rapid deployment. Snap removes nearly all complexity for personal use. The manual stack gives you maximum performance, flexibility, and hardening options for teams and businesses. None of these methods requires a web browser at any step, which makes them ideal for headless servers and remote VPS environments.<\/p>\n\n\n\n<p>Beyond the installation itself, the real value lies in what you do afterward. Setting up Redis caching, configuring proper PHP limits, enabling HTTPS with Certbot, and scheduling cron jobs are not optional extras; they are what separates a slow, insecure Nextcloud setup from a fast and reliable one. The occ command-line tool makes ongoing maintenance just as streamlined as the initial setup, giving you complete control over users, apps, updates, and system health without ever opening a dashboard.<\/p>\n\n\n\n<p>For teams managing sensitive data or scaling beyond a handful of users, pairing your Nextcloud instance with a performance-focused VPS (with SSD storage, dedicated resources, and root access) makes a significant difference in day-to-day reliability. A well-tuned server running Nextcloud is not just a file sync tool; it becomes a central hub for collaboration, calendars, contacts, and document editing.<\/p>\n\n\n\n<p>The command line is not a barrier; it is an advantage. It gives you repeatability, speed, and full transparency over every part of your cloud infrastructure. Follow these steps, keep your server updated, and you will have a private cloud platform that rivals commercial alternatives without ongoing subscription costs or third-party data access.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To install NextCloud from the command line, prepare a LEMP\/LAMP stack, create a database, download the&#8230;<\/p>\n","protected":false},"author":1,"featured_media":8077,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[41,47],"tags":[932,931],"class_list":["post-7897","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blogging","category-knowledgebase","tag-how-to-install-nextcloud-from-command-line","tag-install-nextcloud-from-command-line"],"acf":[],"_links":{"self":[{"href":"https:\/\/qloudhost.com\/blog\/wp-json\/wp\/v2\/posts\/7897","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qloudhost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qloudhost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qloudhost.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qloudhost.com\/blog\/wp-json\/wp\/v2\/comments?post=7897"}],"version-history":[{"count":5,"href":"https:\/\/qloudhost.com\/blog\/wp-json\/wp\/v2\/posts\/7897\/revisions"}],"predecessor-version":[{"id":10357,"href":"https:\/\/qloudhost.com\/blog\/wp-json\/wp\/v2\/posts\/7897\/revisions\/10357"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/qloudhost.com\/blog\/wp-json\/wp\/v2\/media\/8077"}],"wp:attachment":[{"href":"https:\/\/qloudhost.com\/blog\/wp-json\/wp\/v2\/media?parent=7897"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qloudhost.com\/blog\/wp-json\/wp\/v2\/categories?post=7897"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qloudhost.com\/blog\/wp-json\/wp\/v2\/tags?post=7897"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}