How to Install Nextcloud on AlmaLinux 10 using LAMP Stack
Nextcloud is a powerful, open-source self-hosted cloud storage solution that allows you to securely store, share, and sync your files, contacts, calendars, and more — similar to services like Dropbox or Google Drive but with full control over your data.
This guide will walk you through installing Nextcloud on AlmaLinux 10 using a minimal LAMP stack (Linux, Apache, MariaDB, PHP 8.4).
Prerequisites
-
A fresh AlmaLinux 10 server.
-
Root or sudo access.
-
A domain name (optional but recommended).
- Basic familiarity with the command line.
Update Your System
Ensures all system packages are up-to-date, reducing conflicts during installations.
dnf update -y
Install Apache Web Server
dnf install httpd -y
Apache serves as the Nextcloud web interface for users. It's a stable and widely used web server.
systemctl enable --now httpd
Starts and Enable Apache immediately and ensures it starts on every boot.
systemctl enable httpd
systemctl start httpd
systemctl status httpd
Output:
[root@vps ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; preset: disabled)
Drop-In: /etc/systemd/system/httpd.service.d
└─php-fpm.conf
Active: active (running) since Mon 2025-06-02 18:36:42 UTC; 27min ago
Invocation: aa1cb4460aba40d69cfd7171a4243db6
Docs: man:httpd.service(8)
Main PID: 4247 (httpd)
Status: "Total requests: 261; Idle/Busy workers 100/0;Requests/sec: 0.157; Bytes served/sec: 25KB/sec"
Tasks: 230 (limit: 23188)
Memory: 23.6M (peak: 27.1M)
CPU: 1.228s
CGroup: /system.slice/httpd.service
├─4247 /usr/sbin/httpd -DFOREGROUND
├─4250 /usr/sbin/httpd -DFOREGROUND
├─4251 /usr/sbin/httpd -DFOREGROUND
├─4252 /usr/sbin/httpd -DFOREGROUND
├─4253 /usr/sbin/httpd -DFOREGROUND
└─4499 /usr/sbin/httpd -DFOREGROUND
Install and Configure MariaDB (MySQL Server)
MariaDB is used to store Nextcloud's data like user accounts, file metadata, and settings.
dnf install mariadb-server -y
Starts MariaDB and enables it to launch on boot.
systemctl enable --now mariadb
Once the installation is complete, enable MariaDB (to start automatically upon system boot), start MariaDB, and verify the status using the commands below.
systemctl enable mariadb
systemctl start mariadb
systemctl status mariadb
Output:
[root@vps ~]# systemctl status mariadb
● mariadb.service - MariaDB 10.11 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; preset: disabled)
Active: active (running) since Mon 2025-06-02 18:25:10 UTC; 43min ago
Invocation: 47233bcbf0724b90b550204e087a30dd
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Main PID: 2731 (mariadbd)
Status: "Taking your SQL requests now..."
Tasks: 15 (limit: 23188)
Memory: 221.8M (peak: 233.6M)
CPU: 4.029s
CGroup: /system.slice/mariadb.service
└─2731 /usr/libexec/mariadbd --basedir=/usr
Create a Database for Nextcloud
mysql -u root -p
This below sets up a dedicated database and user for Nextcloud with necessary privileges.
CREATE DATABASE nextcloud;
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'strongpassword';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Install PHP 8.4 on AlmaLinux 10
This will help you to install PHP 8.4 on AlmaLinux 10 using EPEL and Remi repositories.
Enables CodeReady Builder, which provides extra libraries required by some third-party packages.
dnf config-manager --set-enabled crb
Adds the EPEL repository, which provides many useful packages not found in the default AlmaLinux repos.
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-10.noarch.rpm
Adds Remi’s repository, which maintains up-to-date PHP versions.
dnf install https://rpms.remirepo.net/enterprise/remi-release-10.rpm
Switches the system’s PHP module to Remi’s PHP 8.4 stream.
dnf module switch-to php:remi-8.4
Installs PHP 8.4 and its basic dependencies.
dnf module install php:remi-8.4
Verifies that PHP 8.4 is installed correctly.
php -v
Output:
[root@server ~]# php -v
PHP 8.4.7 (cli) (built: May 6 2025 12:31:58) (NTS gcc x86_64)
Copyright (c) The PHP Group
Install Required PHP Extensions for Nextcloud
These extensions are required by Nextcloud for file handling, database connections, ZIP support, image processing, and more.
dnf install php php-cli php-common php-mysqlnd php-gd php-xml php-mbstring php-curl php-zip php-intl php-bcmath php-opcache php-imagick -y
Download and Configure Nextcloud
Move into the web root directory.
cd /var/www/
Downloads the latest stable version of Nextcloud.
curl -LO https://download.nextcloud.com/server/releases/latest.zip
Installs unzip
and extracts
the Nextcloud files.
dnf install unzip -y
unzip latest.zip
Gives ownership to Apache so it can serve and manage the files.
chown -R apache:apache /var/www/nextcloud
Ensures proper permissions for execution and access.
chmod -R 755 /var/www/nextcloud
Configure Apache for Nextcloud
Create a configuration file:
nano /etc/httpd/conf.d/nextcloud.conf
Replace the contents with:
<VirtualHost *:80>
ServerName your_server_ip
DocumentRoot /var/www/nextcloud/
<Directory /var/www/nextcloud/>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
</Directory>
ErrorLog /var/log/httpd/nextcloud_error.log
CustomLog /var/log/httpd/nextcloud_access.log combined
</VirtualHost>
Note: Replace the
your_server_ip
with actual IP Address
Then restart Apache:
systemctl restart httpd
Configure SELinux and Firewall
Allows Apache to work with databases and access necessary files in SELinux mode.
setsebool -P httpd_unified 1
setsebool -P httpd_can_network_connect_db 1
Opens the necessary firewall ports for HTTP and HTTPS access.
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
Access Nextcloud in Your Browser
Visit http://your_server_ip
in a web browser to complete the installation via the web interface.
Note: Replace
your_server_ip
with actual IP Address
You’ll be asked to:
-
Create an admin account
-
Provide the database credentials you created earlier
- Set a data folder location (default is fine)
Done!
You now have a fully working Nextcloud instance on AlmaLinux 10 using a secure, optimized LAMP stack with PHP 8.4.
CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME
for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS