+
cargo
cassandra
surrealdb
tcl
nvim
pycharm
+
+
+
+
c#
+
lua
+
atom
stencil
bsd
+
+
symfony
helm
+
+
+
λ
+
π
+
|>
erlang
sails
+
+
go
+
pytest
+
+
+
+
+
ray
grpc
+
websocket
+
+
+
+
+
grpc
gcp
+
sails
+
+
dart
rubymine
quarkus
mysql
+
+
+
tls
bbedit
bbedit
+
+
node
pandas
wsl
+
+
suse
+
spring
+
+
cargo
+
+
+
xgboost
vim
azure
grafana
asm
Back to Blog
☁️ Building Your Own Nextcloud Private Cloud on AlmaLinux: Take Control of Your Data Like a Privacy Champion
AlmaLinux Nextcloud Cloud Storage

☁️ Building Your Own Nextcloud Private Cloud on AlmaLinux: Take Control of Your Data Like a Privacy Champion

Published Aug 29, 2025

Learn to install and configure Nextcloud on AlmaLinux for your personal cloud storage. Master file syncing, sharing, collaboration tools, and security features to create your own Google Drive alternative!

5 min read
0 views
Table of Contents

☁️ Building Your Own Nextcloud Private Cloud on AlmaLinux: Take Control of Your Data Like a Privacy Champion

Hey there, privacy warrior! 🛡️ Tired of big tech companies having access to all your files? Ever wished you could have your own Dropbox or Google Drive but with YOU in complete control? Well, buckle up because I’m about to show you how to build your very own private cloud with Nextcloud!

I’ll never forget the day I realized how much of my life was stored on other people’s servers… family photos, important documents, everything! 😰 Then I discovered Nextcloud, and suddenly I had my own personal cloud that was just as good (actually better!) than the big names. By the end of this guide, you’ll have your own private cloud running, and honestly, you’ll feel like a data freedom fighter! 💪

🤔 Why is Nextcloud Important?

Nextcloud is like having your own personal Google Workspace! 🌟 Let me show you why it’s revolutionary:

The Power of Nextcloud:

  • 🔐 Complete Data Privacy - Your files stay on YOUR server
  • 📱 Access Anywhere - Desktop, mobile, web - all synced perfectly
  • 👥 Collaboration Tools - Share files, calendars, contacts, and more
  • 📝 Office Suite Integration - Edit documents right in your browser
  • 🎥 Video Calls - Built-in Talk app for meetings
  • 📧 Email Integration - Manage emails alongside your files
  • 🔄 Automatic Sync - Keep all devices updated in real-time
  • 🌍 No Storage Limits - Only limited by your hard drive!

🎯 What You Need

Before we build your private cloud empire, let’s check our supplies! 🛠️ Here’s what you’ll need:

Prerequisites:

  • ✅ AlmaLinux 8 or 9 installed and running
  • ✅ Root or sudo access (we need admin powers!)
  • ✅ At least 4GB RAM (more is better for performance)
  • ✅ 20GB free disk space minimum (for OS and Nextcloud)
  • ✅ Additional storage for your files
  • ✅ Domain name (optional but recommended)
  • ✅ About 90 minutes of your time
  • ✅ Excitement to own your data! 🎉

📝 Step 1: Installing Required Components

Let’s set up the foundation for your cloud! 🏗️ We need a web server, database, and PHP.

Install LAMP Stack Components:

# Update your system first - always start fresh!
sudo dnf update -y

# Install Apache web server
sudo dnf install httpd -y

# Install MariaDB database server
sudo dnf install mariadb-server mariadb -y

# Install PHP 8 and required extensions for Nextcloud
sudo dnf install php php-curl php-gd php-mbstring php-intl \
    php-mysql php-opcache php-json php-xml php-zip \
    php-process php-bcmath php-gmp -y

# Install additional tools we'll need
sudo dnf install wget unzip policycoreutils-python-utils -y

# Start and enable services
sudo systemctl enable --now httpd
sudo systemctl enable --now mariadb

# Check services are running
sudo systemctl status httpd mariadb
# Both should show Active (running) ✅

Secure MariaDB Installation:

# Run security script
sudo mysql_secure_installation

# Answer the prompts:
# Enter current password: [Press Enter - none yet]
# Switch to unix_socket authentication? [Y/n]: n
# Set root password? [Y/n]: Y
# New password: [Enter strong password like: NextCloud2024!]
# Remove anonymous users? [Y/n]: Y
# Disallow root login remotely? [Y/n]: Y  
# Remove test database? [Y/n]: Y
# Reload privilege tables? [Y/n]: Y

echo "Database secured! 🔐"

🔧 Step 2: Creating Nextcloud Database

Time to create a home for your cloud data! 💾 This is where everything gets stored.

Set Up Database:

# Connect to MariaDB
sudo mysql -u root -p
# Enter the root password you just set

# In the MariaDB prompt, run these commands:
CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'SecurePass123!';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

echo "Database created successfully! 📊"

Configure PHP for Nextcloud:

# Edit PHP configuration for better performance
sudo nano /etc/php.ini

# Find and modify these values (use Ctrl+W to search):
memory_limit = 512M
upload_max_filesize = 1024M
post_max_size = 1024M
max_execution_time = 300
date.timezone = America/New_York

# Save and exit (Ctrl+X, Y, Enter)

# Create PHP info file to verify
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php

# Restart Apache to apply PHP changes
sudo systemctl restart httpd

🌟 Step 3: Installing Nextcloud

Now for the main event - installing Nextcloud! ☁️ This is where your cloud comes to life.

Download and Install Nextcloud:

# Download latest Nextcloud (check nextcloud.com for latest version)
cd /tmp
wget https://download.nextcloud.com/server/releases/latest.zip

# Extract Nextcloud
sudo unzip latest.zip -d /var/www/html/

# Set proper ownership
sudo chown -R apache:apache /var/www/html/nextcloud/

# Set proper permissions
sudo find /var/www/html/nextcloud/ -type d -exec chmod 750 {} \;
sudo find /var/www/html/nextcloud/ -type f -exec chmod 640 {} \;

# Create data directory outside web root (more secure!)
sudo mkdir -p /var/nextcloud/data
sudo chown apache:apache /var/nextcloud/data
sudo chmod 750 /var/nextcloud/data

Configure Apache for Nextcloud:

# Create Apache configuration for Nextcloud
sudo tee /etc/httpd/conf.d/nextcloud.conf << 'EOF'
<VirtualHost *:80>
    ServerName cloud.yourdomain.com
    DocumentRoot /var/www/html/nextcloud
    
    <Directory /var/www/html/nextcloud>
        Require all granted
        AllowOverride All
        Options FollowSymLinks MultiViews
        
        <IfModule mod_dav.c>
            Dav off
        </IfModule>
        
        SetEnv HOME /var/www/html/nextcloud
        SetEnv HTTP_HOME /var/www/html/nextcloud
    </Directory>
    
    ErrorLog /var/log/httpd/nextcloud_error.log
    CustomLog /var/log/httpd/nextcloud_access.log combined
</VirtualHost>
EOF

# Enable required Apache modules
sudo dnf install mod_ssl -y

# Restart Apache
sudo systemctl restart httpd

Configure SELinux for Nextcloud:

# Set proper SELinux contexts
sudo semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/data(/.*)?'
sudo semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/config(/.*)?'
sudo semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/apps(/.*)?'
sudo semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/.htaccess'
sudo semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/.user.ini'
sudo semanage fcontext -a -t httpd_sys_rw_content_t '/var/nextcloud/data(/.*)?'

# Apply the contexts
sudo restorecon -Rv /var/www/html/nextcloud/
sudo restorecon -Rv /var/nextcloud/

# Allow Apache to connect to network (for external storage)
sudo setsebool -P httpd_can_network_connect on

# Allow Apache to send mail
sudo setsebool -P httpd_can_sendmail on

✅ Step 4: Web-Based Setup

Time to complete the setup through your browser! 🌐 This is the exciting part!

Access Nextcloud Web Installer:

# Get your server IP
ip addr show | grep "inet "
# Note your IP address (e.g., 192.168.1.100)

# Open firewall for web access
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload

echo "Now open your browser and go to:"
echo "http://YOUR_SERVER_IP/nextcloud"

Complete Web Setup:

# In the web installer, you'll need to provide:

# 1. Admin Account:
#    Username: admin
#    Password: [Choose strong password]

# 2. Data Folder:
#    /var/nextcloud/data

# 3. Database Configuration:
#    Database user: nextclouduser
#    Database password: SecurePass123!
#    Database name: nextcloud
#    Database host: localhost

# Click "Install" and wait for completion! 🎉

Post-Installation Security:

# Set up cron job for background tasks
sudo -u apache crontab -e

# Add this line:
*/5 * * * * php -f /var/www/html/nextcloud/cron.php

# Configure memory caching for better performance
sudo dnf install redis php-pecl-redis -y
sudo systemctl enable --now redis

# Add Redis configuration to Nextcloud
sudo -u apache php /var/www/html/nextcloud/occ config:system:set \
    memcache.local --value='\OC\Memcache\Redis'

sudo -u apache php /var/www/html/nextcloud/occ config:system:set \
    memcache.locking --value='\OC\Memcache\Redis'

sudo -u apache php /var/www/html/nextcloud/occ config:system:set \
    redis host --value=localhost

sudo -u apache php /var/www/html/nextcloud/occ config:system:set \
    redis port --value=6379

🎮 Quick Examples

Let’s explore Nextcloud’s amazing features! 🚀

Example 1: Enable External Storage

# Enable external storage app
sudo -u apache php /var/www/html/nextcloud/occ app:enable files_external

# Mount local directory
sudo mkdir /mnt/external-storage
sudo chown apache:apache /mnt/external-storage

# Configure in Nextcloud admin panel:
# Settings → External Storage → Add Storage
# - Folder name: External Drive
# - External storage: Local
# - Configuration: /mnt/external-storage

echo "External storage configured! 💾"

Example 2: Install Nextcloud Office (Collabora)

# Install Docker for Collabora
sudo dnf install docker -y
sudo systemctl enable --now docker

# Run Collabora container
sudo docker run -d \
    -p 9980:9980 \
    -e "domain=YOUR_NEXTCLOUD_DOMAIN" \
    -e "username=admin" \
    -e "password=SecureOfficePass!" \
    --restart always \
    --name collabora \
    collabora/code

# Install Nextcloud Office app
sudo -u apache php /var/www/html/nextcloud/occ app:enable richdocuments

# Configure in Nextcloud:
# Settings → Nextcloud Office → Use your own server
# URL: https://office.yourdomain.com:9980

echo "Office suite installed! 📝"

Example 3: Set Up Talk for Video Calls

# Install Talk app
sudo -u apache php /var/www/html/nextcloud/occ app:enable spreed

# Install and configure TURN server for better connectivity
sudo dnf install coturn -y

# Configure coturn
sudo tee /etc/turnserver.conf << 'EOF'
listening-port=3478
fingerprint
use-auth-secret
static-auth-secret=YourSecretKey123!
realm=yourdomain.com
total-quota=100
bps-capacity=0
stale-nonce
no-multicast-peers
EOF

# Start TURN server
sudo systemctl enable --now coturn

# Configure in Nextcloud admin settings
echo "Video calling ready! 🎥"

🚨 Fix Common Problems

Don’t worry if something doesn’t work perfectly! Here are solutions:

Problem 1: “Can’t write to config directory” Error

# Fix permissions
sudo chown -R apache:apache /var/www/html/nextcloud/
sudo chmod 750 /var/www/html/nextcloud/config

# Fix SELinux context
sudo semanage fcontext -a -t httpd_sys_rw_content_t \
    '/var/www/html/nextcloud/config(/.*)?'
sudo restorecon -Rv /var/www/html/nextcloud/config

# Verify fix
sudo -u apache touch /var/www/html/nextcloud/config/test
sudo rm /var/www/html/nextcloud/config/test

Problem 2: Slow Performance

# Enable PHP OPcache
sudo nano /etc/php.d/10-opcache.ini

# Add these settings:
opcache.enable=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=10000
opcache.revalidate_freq=1
opcache.save_comments=1

# Restart Apache
sudo systemctl restart httpd

# Enable APCu cache
sudo dnf install php-pecl-apcu -y
sudo systemctl restart httpd

# Configure in Nextcloud
sudo -u apache php /var/www/html/nextcloud/occ config:system:set \
    memcache.local --value='\OC\Memcache\APCu'

Problem 3: Large File Upload Issues

# Increase PHP limits
sudo nano /etc/php.ini

# Modify these values:
upload_max_filesize = 16G
post_max_size = 16G
max_input_time = 3600
max_execution_time = 3600

# For Apache, also add to .htaccess
sudo nano /var/www/html/nextcloud/.htaccess

# Add these lines:
php_value upload_max_filesize 16G
php_value post_max_size 16G

# Restart services
sudo systemctl restart httpd

📋 Simple Commands Summary

Your Nextcloud command toolkit! 📚 Keep this handy:

TaskCommandWhat It Does
Check Statussudo -u apache php occ statusSystem status 🔍
List Appssudo -u apache php occ app:listShow apps 📱
Enable Appsudo -u apache php occ app:enable APPInstall app ➕
Scan Filessudo -u apache php occ files:scan --allRescan files 🔄
Add Usersudo -u apache php occ user:add USERNAMECreate user 👤
Reset Passwordsudo -u apache php occ user:resetpassword USERReset pass 🔐
Maintenance Modesudo -u apache php occ maintenance:mode --onEnable 🛠️
Upgradesudo -u apache php occ upgradeUpdate Nextcloud ⬆️
Clean Logssudo -u apache php occ log:clearClear logs 🧹
Check Configsudo -u apache php occ config:list systemView config 📋
DB Repairsudo -u apache php occ maintenance:repairFix database 🔧
Background Jobssudo -u apache php occ background:cronSet to cron ⏰

💡 Tips for Success

Here are my pro tips for Nextcloud excellence! 🎯

Security Best Practices:

  • 🔐 Enable 2FA - Two-factor authentication for all users
  • 🔒 Use HTTPS - Install Let’s Encrypt SSL certificate
  • 📝 Regular backups - Automate daily backups
  • 🛡️ Fail2ban integration - Protect against brute force
  • 🔍 Audit logs - Monitor access and changes
  • 🚫 Disable unused apps - Reduce attack surface
  • 🔑 Strong passwords - Enforce password policies
  • 🌐 VPN access - Consider VPN-only access

Performance Optimization:

  • Use Redis caching - Dramatic speed improvement
  • 🚀 Enable HTTP/2 - Modern protocol benefits
  • 📊 Monitor resources - Watch CPU and RAM usage
  • 🎯 Optimize database - Regular maintenance
  • 💾 Use SSD storage - Faster file access
  • 🔧 Tune PHP-FPM - Better resource management

🏆 What You Learned

Incredible achievement! Look at what you’ve built! 🎊

Your Achievements:

  • ✅ Installed complete LAMP stack
  • ✅ Configured Nextcloud successfully
  • ✅ Set up secure database
  • ✅ Configured SELinux properly
  • ✅ Enabled caching for performance
  • ✅ Set up file synchronization
  • ✅ Configured external storage
  • ✅ Learned troubleshooting techniques
  • ✅ Built your own private cloud
  • ✅ Took control of your data!

🎯 Why This Matters

Your Nextcloud server isn’t just storage - it’s your digital independence! 🌟

With your private cloud, you can now:

  • 🔐 Own your data - No corporation controls your files
  • 📱 Sync everything - All devices, perfectly synchronized
  • 👥 Collaborate privately - Share without surveillance
  • 💰 Save money - No monthly subscription fees
  • 🌍 Access anywhere - Your cloud, your rules
  • 📝 Work productively - Office suite included
  • 🎥 Video conference - Private meetings on your server
  • 🚀 Scale infinitely - Add storage as needed

Remember when you worried about privacy policies and data breaches? Now YOU control everything! You’ve transformed from a cloud service consumer to a cloud service provider. That’s absolutely revolutionary! 🌟

Keep building, keep sharing (privately!), and most importantly, enjoy your data freedom! 🗽

Happy cloud hosting, and welcome to the world of data sovereignty! 🙌


P.S. - Don’t forget to invite friends and family to your private cloud. They’ll love the privacy! ⭐