VOOZH about

URL: https://thenewstack.io/how-to-deploy-the-nextcloud-cloud-server-on-almalinux/

⇱ How to Deploy the Nextcloud Cloud Server on AlmaLinux - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2024-07-23 11:43:07
How to Deploy the Nextcloud Cloud Server on AlmaLinux
Cloud Services / Linux

How to Deploy the Nextcloud Cloud Server on AlmaLinux

Nextcloud is an open source cloud server that gives users more security and control than similar clouds do. This tutorial shows how to get started.
Jul 23rd, 2024 11:43am by Jack Wallen
👁 Featued image for: How to Deploy the Nextcloud Cloud Server on AlmaLinux
Cloud services are all over the place. For most people, the usual options (such as Google, iCloud, etc.) are fine. For others who demand more security and control, there are additional options, such as Nextcloud. Nextcloud is an open source platform that includes all the features you’ve grown accustomed to (such as files, editors, chat, version control and much more) and can be deployed to hardware on your network. Because of that, you don’t have to worry about third parties having access to your data. That’s a win for any security/privacy-minded individuals or companies. I want to show you how to deploy Nextcloud to the open source AlmaLinux operating system. Unlike deploying to Ubuntu Server, there are a few more steps required, which can often trip people up. Let me help you avoid those pitfalls. Ready?

What You’ll Need

The only things you’ll need for this basic installment are a running instance of AlmaLinux 9 and a user with sudo privileges. Of course, if you want to point a domain name to the instance, you’ll need an FQDN and secure it with SSL. Since I’m only deploying this to an internal network, I’m not going to worry about those things at the moment. With those things at the ready, let’s install them.

Installing the Requirements

There are a few dependencies we have to take care of.

Apache

The first thing we’ll do is install the Apache web server. Log into AlmaLinux and issue the command:
sudo dnf install httpd -y
When the installation is completed, start and enable Apache with:
sudo systemctl enable --now httpd
After you take care of this, you’ll need to open the firewall with the following two commands:

PHP

Next, we’ll install the necessary PHP release. First, enable the EPEL release with:
sudo dnf install epel-release -y
Install the REMI repository (which will get us access to PHP 8.1) with:
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm -y
Reset the current PHP config with:
sudo dnf module reset php -y
Enable REMI repository module with:
sudo dnf module enable php:remi-8.1 -y
Install all of the necessary PHP software with the following command:

Configure PHP

We now need to configure PHP. Open the configuration file with:
sudo nano /etc/php.ini
You’ll need to locate and make sure to set the following: Where YOUR_TIMEZONE is the timezone in which your server is located. You can make a short-shrift of locating the above entries by using the nano search tool (which is called up with the Ctrl+w keyboard shortcut). Save and close the file. Next, open the PHP OPCache configuration file with:
sudo nano /etc/php.d/10-opcache.ini
In this file, you want to make sure to uncomment and change (if necessary) the following lines: Save and close the file. Restart Apache and PHP with the following:

Install the Database

The next step is the installation of the MariaDB database. To do that, we must create a repository file with the command:
sudo nano /etc/yum.repos.d/MariaDB.repo
In that file, paste the following: Save and close the file. Install MariaDB with:
sudo dnf install MariaDB-server MariaDB-client -y
Start and enable the database with:
sudo systemctl enable --now mariadb
Secure the database installation with the command:
sudo mariadb-secure-installation
Hit Enter when prompted for the admin password, type `n` for unix_socket, type and verify a new admin password, and answer y to the remaining questions. With the MariaDB installed, it’s time to create our database. Access the MariaDB console with:
sudo mariadb -u root -p
Create the database with:
CREATE DATABASE netxcloud_db;
Create a new database user with:
CREATE USER nextuser@localhost IDENTIFIED BY 'PASSWORD';
Where PASSWORD is a strong and unique password. Grant the required permissions with:
GRANT ALL PRIVILEGES ON netxcloud_db.* TO nextuser@localhost;
Flush the privileges and exit the console with:

Download Nextcloud

Before you download Nextcloud, you’ll need to install a few more bits with:
sudo dnf install unzip wget setroubleshoot-server setools-console -y
Change into the Apache document root with:
cd /var/www/
Download the Nextcloud source with:
sudo wget https://download.nextcloud.com/server/releases/latest.zip
Unzip the file with:
sudo unzip latest.zip
Give the newly-created Nextcloud directory the required ownership with:
sudo chown -R apache:apache /var/www/nextcloud

SELinux

Unless we configure SELinux properly, Nextcloud will not function. The first thing to do is to properly label all of the Nextcloud files and folders with the following commands: Next, you must allow the webserver to connect to the network with the following commands: We have to create a new policy module to ensure PHP-FPM can connect to the MariaDB socket. First, create a new file with the command:
sudo nano my-phpfm.te
Paste the following into that file: Save and close the file. Convert the file to an SELinux policy module with the command:
sudo checkmodule -M -m -o my-phpfpm.mod my-phpfpm.te
Compile the policy with:
sudo semodule_package -o my-phpfpm.pp -m my-phpfpm.mod
Apply the new policy module with:
sudo semodule -i my-phpfpm.pp

Virtual Host

We now have to create a virtual host file with the command:
sudo nano /etc/httpd/conf.d/nextcloud.conf
In that file, paste the following, making sure to edit as needed for your situation: Save and close the file. Restart Apache with:
sudo systemctl restart httpd

Finishing Up the Installation

You should now be able to point a web browser to http://SERVER (where SERVER is the IP address of the hosting server) and be greeted by the Nextcloud web-based installer, where you can create an admin user and finish up the process with a few clicks. If you find there’s an error connecting to the database and writing to the data directory, temporarily disable SELinux (until the next reboot) with: After the installation completes, reboot the machine and SELinux is back to keeping tabs on the system and Nextcloud is up and running. And that, my friends, is how you deploy Nextcloud to AlmaLinux.
TRENDING STORIES
Jack Wallen is what happens when a Gen Xer mind-melds with present-day snark. Jack is a seeker of truth and a writer of words with a quantum mechanical pencil and a disjointed beat of sound and soul. Although he resides...
Read more from Jack Wallen
SHARE THIS STORY
TRENDING STORIES
Google Cloud is a sponsor of The New Stack.
TNS owner Insight Partners is an investor in: Enable.
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.