How to Install Nextcloud
-
6. Download and Extract Nextcloud
Get the latest Nextcloud release from the official site and extract it under your web root:
cd /var/www/html && sudo curl -O https://download.nextcloud.com/server/releases/latest.tar.bz2 && sudo tar -xjf latest.tar.bz2 && sudo chown -R apache:apache nextcloud
-
7. Configure Apache Virtual Host
Create a new Apache configuration file for Nextcloud:
sudo tee /etc/httpd/conf.d/nextcloud.conf <<'EOF' <VirtualHost *:80> ServerName nextcloud.example.com DocumentRoot /var/www/html/nextcloud <Directory /var/www/html/nextcloud> AllowOverride All Require all granted </Directory> </VirtualHost> EOF
-
8. Adjust SELinux Contexts
Apply proper SELinux permissions to allow Apache to write to Nextcloud’s directories:
sudo semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud(/.*)?' && sudo restorecon -Rv /var/www/html/nextcloud
-
9. Allow HTTP/HTTPS Through Firewall
Open the firewall ports for web access:
sudo firewall-cmd --permanent --add-service=http && sudo firewall-cmd --permanent --add-service=https && sudo firewall-cmd --reload
-
10. Enable HTTPS with Certbot
Install Certbot and automatically configure HTTPS for Apache:
sudo dnf install certbot python3-certbot-apache -y && sudo certbot --apache
-
11. Configure PHP for Performance
Tune PHP settings for better performance and clustering compatibility:
sudo sed -i 's/memory_limit = .*/memory_limit = 512M/' /etc/php.ini && sudo systemctl restart php-fpm httpd
-
12. Setup LDAP Authentication
Enable enterprise-grade LDAP integration via the Nextcloud app (GUI) or command line:
sudo -u apache php /var/www/html/nextcloud/occ app:enable user_ldap
-
13. Enable Clustering Support
For high availability, enable Redis caching and configure session locking:
sudo dnf install redis php-redis -y && sudo systemctl enable --now redis && sudo -u apache php /var/www/html/nextcloud/occ config:system:set memcache.locking --value '\OC\Memcache\Redis'
-
14. Optional: Configure NGINX Instead of Apache
To use NGINX, disable Apache and install NGINX with a compatible PHP setup:
sudo systemctl disable --now httpd && sudo dnf install nginx php-fpm -y && sudo systemctl enable --now nginx php-fpm
-
15. Finalize Installation via Browser
Open your browser at
http://nextcloud.example.com
and complete the web installer by entering your database credentials and admin user.
Contents