How To Install Nextcloud on Rocky Linux 10
Setting up your own cloud storage solution has never been more important. Nextcloud offers a robust, open-source alternative to commercial cloud services like Google Drive or Dropbox. When combined with Rocky Linux 10, you get enterprise-grade reliability and security for your personal or business data storage needs.
This comprehensive guide walks you through installing Nextcloud on Rocky Linux 10 from start to finish. You’ll learn how to configure the LAMP stack, secure your installation with SSL certificates, and optimize performance for production use. Whether you’re a system administrator or an enthusiast looking to take control of your data, this tutorial provides everything needed to deploy a fully functional cloud storage platform.
Rocky Linux 10 serves as an ideal foundation for Nextcloud installations due to its stability, long-term support, and enterprise-focused security features. The combination delivers a powerful, self-hosted cloud solution that puts you in complete control of your data privacy and security.
Understanding System Requirements and Prerequisites
Hardware Requirements
Before beginning the installation process, ensure your server meets the minimum hardware specifications. Your Rocky Linux 10 system requires at least a 64-bit processor to run Nextcloud effectively. Memory allocation plays a crucial role in performance, with 2GB RAM serving as the absolute minimum for basic functionality.
For production environments or multi-user installations, 4GB of RAM provides better performance and stability. Storage requirements start at 10GB for the base installation, but consider your data storage needs when planning disk space. Network connectivity remains essential, whether through a dedicated IP address or proper domain name configuration.
Software Prerequisites
Successful Nextcloud deployment on Rocky Linux 10 depends on several software prerequisites. Root access or sudo privileges are mandatory for installing packages and configuring system services. Verify your Rocky Linux 10 installation is current and properly configured before proceeding.
Domain name configuration or static IP address assignment ensures reliable access to your Nextcloud instance. Consider DNS propagation times if using a new domain name. Firewall and SELinux configurations require attention, as these security measures can block necessary network traffic and file access permissions.
Document your current system configuration before making changes. This practice enables quick rollback if issues arise during installation.
Pre-installation System Updates
Updating your Rocky Linux 10 system before installing Nextcloud ensures compatibility and security. Execute system updates using the DNF package manager to install the latest security patches and bug fixes.
sudo dnf update -y
sudo dnf upgrade -y
Repository configuration verification prevents package installation issues. Rocky Linux 10 includes standard repositories, but additional repositories like EPEL (Extra Packages for Enterprise Linux) provide access to more software packages.
sudo dnf install epel-release -y
Reboot your system after major kernel updates to ensure all changes take effect properly.
Installing and Configuring LAMP Stack Components
Apache Web Server Installation
Apache HTTP Server forms the foundation of your Nextcloud installation on Rocky Linux 10. The web server handles all HTTP requests and serves Nextcloud’s web interface to users. Installing Apache requires the httpd package from Rocky Linux repositories.
sudo dnf install httpd -y
Starting and enabling the Apache service ensures it runs automatically after system reboots. The systemctl command manages service states in Rocky Linux 10.
sudo systemctl start httpd
sudo systemctl enable httpd
Verify Apache installation by checking the service status and testing basic functionality. The default Apache welcome page should be accessible through your server’s IP address.
sudo systemctl status httpd
Apache modules required for Nextcloud include mod_rewrite for URL rewriting, mod_ssl for HTTPS support, and mod_headers for HTTP header manipulation. Most necessary modules are enabled by default in Rocky Linux 10’s Apache configuration.
Basic firewall configuration allows HTTP traffic through port 80. This step enables initial access to your web server during configuration.
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload
MariaDB Database Server Setup
Nextcloud requires a database backend to store user accounts, file metadata, and application settings. MariaDB provides excellent performance and compatibility with Nextcloud on Rocky Linux 10.
Installing MariaDB involves both server and client packages. The server package provides the database engine, while the client package offers command-line administration tools.
sudo dnf install mariadb-server mariadb -y
Starting and enabling MariaDB ensures database availability for your Nextcloud installation. Database servers typically require longer startup times than web servers.
sudo systemctl start mariadb
sudo systemctl enable mariadb
Securing your MariaDB installation protects against unauthorized access and removes development-time security weaknesses. The mysql_secure_installation script guides you through essential security configurations.
sudo mysql_secure_installation
During the security setup, set a strong root password, remove anonymous users, disable remote root access, and delete test databases. These steps significantly improve database security.
Creating a dedicated database and user account for Nextcloud follows security best practices. Avoid using the root database account for application connections.
sudo mysql -u root -p
Execute these SQL commands to create the Nextcloud database and user:
CREATE DATABASE nextcloud;
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'SecurePassword123!';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Choose a strong password for the database user account. Document these credentials securely as they’re required during Nextcloud’s web-based setup process.
PHP Installation and Configuration
PHP powers Nextcloud’s server-side functionality, handling file operations, user authentication, and database interactions. Rocky Linux 10 includes PHP packages, but installing from the Remi repository provides access to newer PHP versions optimized for Nextcloud.
Installing the Remi repository enables access to PHP 8.3, which offers improved performance and security features compared to older versions.
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm -y
sudo dnf module reset php -y
sudo dnf module enable php:remi-8.3 -y
Essential PHP modules for Nextcloud functionality include numerous extensions that handle different aspects of the application. Install all required modules in a single command to avoid dependency issues.
sudo dnf install php php-cli php-common php-curl php-gd php-intl php-json php-ldap php-mbstring php-mysqlnd php-xml php-zip php-opcache php-process php-sodium php-bcmath php-gmp -y
PHP configuration optimization improves Nextcloud performance and enables proper file handling. Edit the PHP configuration file to adjust memory limits, upload sizes, and execution timeouts.
sudo nano /etc/php.ini
Modify these key PHP settings for optimal Nextcloud operation:
memory_limit = 512M
upload_max_filesize = 200M
post_max_size = 200M
max_execution_time = 3600
max_input_time = 3600
Restart Apache after PHP configuration changes to apply the new settings.
sudo systemctl restart httpd
Verify PHP installation and configuration by creating a test file in Apache’s document root directory.
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php
Downloading and Installing Nextcloud
Obtaining Nextcloud Source Code
Downloading Nextcloud from official sources ensures you receive authentic, unmodified software. The Nextcloud website provides direct download links for the latest stable releases. Always verify download integrity using provided checksums.
Navigate to your temporary directory and download the latest Nextcloud release:
cd /tmp
wget https://download.nextcloud.com/server/releases/latest.tar.bz2
Download verification prevents corrupted or tampered installations. Nextcloud provides SHA256 checksums for all releases, available on their download page.
wget https://download.nextcloud.com/server/releases/latest.tar.bz2.sha256
sha256sum -c latest.tar.bz2.sha256
Alternative download methods include Git repository cloning for development versions or using package managers where available. Stable releases provide the best reliability for production deployments.
File System Preparation
Extracting Nextcloud to the appropriate web directory ensures proper Apache access and permissions. Rocky Linux 10’s default Apache document root is /var/www/html
, but many administrators prefer dedicated virtual host configurations.
Extract the Nextcloud archive and move it to your chosen web directory:
tar -xjf latest.tar.bz2
sudo mv nextcloud /var/www/html/
Creating a dedicated data directory outside the web root improves security by preventing direct web access to user files. This configuration follows Nextcloud’s recommended security practices.
sudo mkdir -p /var/nextcloud/data
File ownership and permission configuration prevents security vulnerabilities and ensures proper application functionality. The Apache user (typically apache
on Rocky Linux) must own Nextcloud files and directories.
sudo chown -R apache:apache /var/www/html/nextcloud
sudo chown -R apache:apache /var/nextcloud/data
Directory permissions should allow reading and execution for the web server while preventing unauthorized access from other users.
sudo chmod -R 755 /var/www/html/nextcloud
sudo chmod -R 750 /var/nextcloud/data
SELinux context configuration ensures the security framework allows necessary file access without compromising system security. Rocky Linux 10’s SELinux policies require specific contexts for web content.
sudo setsebool -P httpd_unified 1
sudo setsebool -P httpd_execmem 1
sudo restorecon -Rv /var/www/html/nextcloud
sudo restorecon -Rv /var/nextcloud/data
Web Server Configuration
Apache virtual host configuration provides dedicated settings for your Nextcloud installation. Virtual hosts enable multiple websites on a single server and offer better security isolation compared to directory-based installations.
Create a new virtual host configuration file for Nextcloud:
sudo nano /etc/httpd/conf.d/nextcloud.conf
Configure the virtual host with essential Apache directives:
<VirtualHost *:80>
ServerName your-domain.com
DocumentRoot /var/www/html/nextcloud
<Directory /var/www/html/nextcloud>
AllowOverride All
Options -Indexes +FollowSymLinks
DirectoryIndex index.php
Require all granted
</Directory>
ErrorLog /var/log/httpd/nextcloud_error.log
CustomLog /var/log/httpd/nextcloud_access.log combined
</VirtualHost>
Replace your-domain.com
with your actual domain name or server IP address. The AllowOverride directive enables Nextcloud’s .htaccess file functionality, which is essential for proper operation.
Restart Apache to activate the new virtual host configuration:
sudo systemctl restart httpd
Initial Nextcloud Configuration and Setup
Firewall Configuration
Proper firewall configuration balances security with accessibility. Rocky Linux 10’s firewall blocks most incoming connections by default, requiring explicit rules for web traffic.
Configure firewall rules to allow HTTP access during initial setup:
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload
Verify firewall configuration to ensure rules are active:
sudo firewall-cmd --list-services
Consider temporarily disabling SELinux during initial configuration if you encounter permission issues. Remember to re-enable it after successful installation.
sudo setenforce 0
Web-Based Installation Process
Nextcloud’s web-based installation wizard simplifies the initial configuration process. Access the installation interface through your web browser using your server’s domain name or IP address.
Navigate to your Nextcloud installation in a web browser:
http://your-domain.com/
The installation wizard prompts for administrator account creation. Choose a strong username and password for the admin account, as this account has full system privileges.
Database connection configuration requires the credentials created during MariaDB setup. Select MySQL/MariaDB as the database type and enter your connection details:
- Database user:
nextclouduser
- Database password:
SecurePassword123!
- Database name:
nextcloud
- Database host:
localhost
Data directory configuration specifies where Nextcloud stores user files. Use the dedicated directory created earlier (/var/nextcloud/data
) for improved security.
Complete the installation wizard by clicking the “Finish setup” button. The process may take several minutes depending on your server’s performance.
Post-Installation Verification
Testing your Nextcloud installation ensures all components function correctly. Log in using the administrator credentials created during setup to access the web interface.
Verify file upload capabilities by creating a test folder and uploading a small file. This test confirms proper file system permissions and PHP configuration.
Check the administration settings panel for system warnings or configuration issues. Nextcloud performs automatic system checks and provides recommendations for optimization.
Review log files for errors or warnings that might indicate configuration problems:
sudo tail -f /var/www/html/nextcloud/data/nextcloud.log
SSL/TLS Security Implementation
SSL Certificate Acquisition
Securing your Nextcloud installation with SSL/TLS encryption protects data in transit and improves user trust. Let’s Encrypt provides free SSL certificates that work excellently with Nextcloud installations.
Installing Certbot enables automatic SSL certificate management on Rocky Linux 10. The EPEL repository includes Certbot packages for Apache integration.
sudo dnf install certbot python3-certbot-apache -y
Generate SSL certificates for your domain using Certbot’s Apache plugin. This process automatically configures Apache for SSL and creates renewal configurations.
sudo certbot --apache -d your-domain.com
Certbot prompts for email address registration and agreement to terms of service. The automated process handles certificate generation, Apache configuration, and SSL virtual host creation.
Automated certificate renewal ensures continuous SSL protection. Certbot includes systemd timers for automatic renewal before certificates expire.
sudo systemctl enable certbot-renew.timer
sudo systemctl start certbot-renew.timer
HTTPS Configuration
SSL certificate installation automatically creates HTTPS virtual host configurations. Review the generated SSL configuration to ensure proper security settings.
sudo nano /etc/httpd/conf.d/nextcloud-le-ssl.conf
The SSL virtual host should include security headers and proper certificate references. Certbot typically generates secure configurations automatically.
HTTP to HTTPS redirection ensures all traffic uses encrypted connections. Add redirection rules to your HTTP virtual host configuration:
<VirtualHost *:80>
ServerName your-domain.com
Redirect permanent / https://your-domain.com/
</VirtualHost>
Test SSL configuration using online tools like SSL Labs’ SSL Server Test to identify potential security issues or configuration improvements.
Update firewall rules to allow HTTPS traffic:
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
Security Headers and Hardening
Implementing additional security headers improves protection against common web vulnerabilities. Add security headers to your Apache SSL configuration:
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
Header always set X-Content-Type-Options nosniff
Header always set X-Frame-Options SAMEORIGIN
Header always set Referrer-Policy "strict-origin-when-cross-origin"
HSTS (HTTP Strict Transport Security) configuration forces browsers to use HTTPS for all future connections, preventing downgrade attacks.
Restart Apache to apply security header configurations:
sudo systemctl restart httpd
Performance Optimization and Tuning
PHP Performance Optimization
OPCache configuration significantly improves PHP performance by caching compiled bytecode in memory. Enable and configure OPCache for optimal Nextcloud performance.
Edit the OPCache configuration in your PHP settings:
sudo nano /etc/php.d/10-opcache.ini
Optimize OPCache settings for Nextcloud:
opcache.enable=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.revalidate_freq=1
opcache.save_comments=1
APCu caching provides local memory caching for Nextcloud’s internal operations. Install and configure APCu for improved performance:
sudo dnf install php-pecl-apcu -y
Memory limit optimization depends on your expected usage patterns. Larger installations require higher memory limits to handle concurrent users and file operations effectively.
Database Performance Tuning
MariaDB configuration optimization improves database query performance and response times. Create a custom MariaDB configuration file for Nextcloud-specific optimizations.
sudo nano /etc/my.cnf.d/nextcloud.cnf
Add performance-oriented MariaDB settings:
[mysqld]
innodb_buffer_pool_size = 256M
innodb_log_file_size = 64M
query_cache_type = 1
query_cache_size = 32M
tmp_table_size = 64M
max_heap_table_size = 64M
Restart MariaDB to apply new configuration settings:
sudo systemctl restart mariadb
Database maintenance procedures include regular optimization and repair operations to maintain peak performance over time.
Caching and Background Jobs
Redis installation provides advanced caching capabilities for Nextcloud installations with multiple users or high traffic volumes.
sudo dnf install redis -y
sudo systemctl start redis
sudo systemctl enable redis
Configure Nextcloud to use Redis for caching by editing the configuration file:
sudo nano /var/www/html/nextcloud/config/config.php
Add Redis configuration to Nextcloud:
'memcache.local' => '\OC\Memcache\APCu',
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => 'localhost',
'port' => 6379,
),
Background job configuration improves system responsiveness by processing maintenance tasks asynchronously. Configure cron-based background jobs for better performance:
sudo crontab -u apache -e
Add the Nextcloud cron job:
*/5 * * * * php -f /var/www/html/nextcloud/cron.php
Troubleshooting Common Issues
Installation Problems
Permission-related errors commonly occur during Nextcloud installations on Rocky Linux 10. These issues typically result from incorrect file ownership or insufficient directory permissions.
Verify file ownership throughout the Nextcloud directory:
sudo find /var/www/html/nextcloud -type f -exec ls -la {} \; | head -20
Database connection troubleshooting involves verifying credentials, network connectivity, and MariaDB service status. Test database connections manually:
mysql -u nextclouduser -p nextcloud
PHP module dependency issues prevent proper Nextcloud functionality. Verify all required PHP modules are installed and loaded:
php -m | grep -E "curl|gd|intl|json|ldap|mbstring|mysql|xml|zip|opcache"
SELinux context problems can block file access even with correct permissions. Check SELinux denials in audit logs:
sudo ausearch -m avc -ts recent
Performance Issues
Slow loading pages often indicate PHP configuration problems or insufficient server resources. Monitor system resources during typical usage:
top
free -h
df -h
Memory exhaustion problems require PHP memory limit adjustments or server hardware upgrades. Check PHP error logs for memory-related errors:
sudo tail -f /var/log/httpd/error_log
Database performance bottlenecks may require query optimization or increased database buffer sizes. Monitor MariaDB performance:
sudo mysqladmin -u root -p processlist
sudo mysqladmin -u root -p status
File upload size limitations stem from PHP configuration restrictions. Verify upload-related PHP settings match your requirements.
Security Warnings
Nextcloud’s administration panel displays security warnings for common configuration issues. Address these warnings promptly to maintain security best practices.
Missing security headers can be resolved by adding appropriate Apache configuration directives. Review your SSL virtual host configuration for required headers.
Database configuration warnings often indicate suboptimal settings for production use. Review MariaDB configuration and optimize based on Nextcloud recommendations.
File permission security issues require careful balance between functionality and security. Follow Nextcloud’s official permission guidelines for your installation type.
Maintenance and Updates
Regular Maintenance Tasks
System maintenance ensures continued reliability and security of your Nextcloud installation. Establish regular maintenance schedules for critical tasks.
Package updates should be applied regularly to maintain security patches and bug fixes:
sudo dnf update -y
Database maintenance includes optimization and integrity checks to prevent corruption and maintain performance:
sudo mysqlcheck -u root -p --optimize --all-databases
Log file management prevents disk space exhaustion from growing log files. Configure log rotation for Apache and Nextcloud logs:
sudo logrotate -f /etc/logrotate.d/httpd
Backup strategies should include both database and file system backups. Create automated backup scripts for regular data protection:
#!/bin/bash
mysqldump -u root -p nextcloud > /backup/nextcloud-db-$(date +%Y%m%d).sql
tar -czf /backup/nextcloud-files-$(date +%Y%m%d).tar.gz /var/www/html/nextcloud /var/nextcloud/data
Nextcloud Updates
Updating Nextcloud requires careful planning and testing to avoid data loss or service disruption. Always backup your installation before attempting updates.
Enable maintenance mode before beginning update procedures:
sudo -u apache php /var/www/html/nextcloud/occ maintenance:mode --on
Download and install Nextcloud updates using the built-in updater or manual update procedures. Test updates thoroughly in staging environments before applying to production systems.
Update procedures vary depending on your installation method and current version. Follow official Nextcloud documentation for your specific update path.
Rollback procedures provide recovery options if updates cause problems. Maintain recent backups and document rollback steps before attempting updates.
Congratulations! You have successfully installed Nextcloud. Thanks for using this tutorial for installing Nextcloud open-source self-hosted on your Rocky Linux 10 system. For additional help or useful information, we recommend you check the official NextCloud website.