How to install Magento on AlmaLinux 10

How to Install Magento on AlmaLinux 10

Magento is a leading enterprise-grade e-commerce platform built on open-source technology, combining advanced features, flexibility, and a user-friendly interface. With features like integrated checkout, payment, and shipping, as well as catalog management and customer accounts, it makes the platform the choice for most online merchants. In this tutorial, we will show you how to install Magento on AlmaLinux 10.

Prerequisites

  • An AlmaLinux 10 VPS with at least 4GB of RAM.
  • SSH root access, or a user with sudo privileges.

Conventions

# – given commands should be executed with root privileges either directly as a root user or by use of sudo command
$ – given commands should be executed as a regular user

Step 1. Add System User

Magento will be run under a system user. Let’s create a new system user.

# useradd -md /opt/magento -Urs /bin/bash magento

Then, let’s give the new user a password.

# passwd magento

You will be prompted to type the password for user ‘magento’ twice; the password will not be shown on your screen. Then, let’s add this user as a sudoer.

# usermod -aG wheel magento

Step 2. Install PHP

AlmaLinux 10 ships with PHP 8.4, and we will use this PHP version. However, we will also need PHP sodium, which is not available in the repository. We need to install the EPEL release to proceed with this.

# dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-10.noarch.rpm
# dnf update
# dnf install php-{bcmath,common,curl,fpm,gd,intl,mbstring,mysqlnd,pear,soap,sodium,xml,zip,cli} libsodium libsodium-devel

Next, we need to modify the following settings in the php.ini file:

Increase memory_limit to 512M
Set short_open_tag to On
Set upload_max_filesize to 128M
Increase max_execution_time to 3600

Let’s make the changes by executing these commands

# su - magento
$ sudo sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php.ini
$ sudo sed -i "s/upload_max_filesize = .*/upload_max_filesize = 128M/" /etc/php.ini
$ sudo sed -i "s/short_open_tag = .*/short_open_tag = On/" /etc/php.ini
$ sudo sed -i "s/max_execution_time = .*/max_execution_time = 3600/" /etc/php.ini

Then, let’s create a PHP-FOM pool.

# sudo nano /etc/php-fpm.d/magento.conf

We need to insert the following into the file.

user = magento
group = magento

listen = /run/php-fpm/magento.sock
listen.owner = magento
listen.group = magento
pm = ondemand
pm.max_children = 50
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 10

To apply the changes, we can restart PHP FPM.

$ sudo systemctl restart php-fpm

Step 3. Install Nginx

In this step, we are going to install and configure nginx as the web server, not Apache. Run this command to install it.

$ sudo dnf install nginx -y

Start nginx and enable it on boot.

$ sudo systemctl enable --now nginx

Let’s create an nginx server block.

$ sudo nano /etc/nginx/conf.d/magento.conf

Insert the following into the file.

upstream fastcgi_backend {
server unix:/run/php-fpm/magento.sock;
}

server {
server_name yourdomain.com;
listen 80;
set $MAGE_ROOT /opt/magento/website;
set $MAGE_MODE production;

access_log /var/log/nginx/magento-access.log;
error_log /var/log/nginx/magento-error.log;

include /opt/magento/website/nginx.conf.sample;
}

Now, restart nginx to apply the changes.

$ sudo systemctl restart nginx

Step 4. Install Opensearch

As an alternative to Elasticsearch, Magento now supports OpenSearch. In this step, we will install OpenSearch and then modify its settings. Let’s execute the commands below to proceed.

curl -SL https://artifacts.opensearch.org/releases/bundle/opensearch/3.x/opensearch-3.x.repo -o /etc/yum.repos.d/opensearch-3.x.repo
$ sudo rpm --import https://artifacts.opensearch.org/publickeys/opensearch-release.pgp
$ sudo dnf update
$ sudo env OPENSEARCH_INITIAL_ADMIN_PASSWORD=M0d1fyth15$ dnf install opensearch

Once installed, we need to do this:

By default, OpenSearch uses SSL, but Magento doesn’t use it. So we need to disable the SSL plugin in OpenSearch for a successful Magento installation:

$ sudo nano /etc/opensearch/opensearch.yml

And add this to the end of the yml file:

plugins.security.disabled: true

Save the file, then exit. Finally, we can enable the service and start it now. Please note that you cannot skip the step above, or else you will see the following error message when installing Magento:

“Could not validate a connection to the OpenSearch. No alive nodes found in your cluster.”

That’s it, we can start the service now.

$ sudo systemctl enable --now opensearch

Now, run the command below to check the connection to OpenSearch.

$ sudo curl -X GET https://localhost:9200 -u 'admin:M0d1fyth15$' --insecure

Make sure to replace the password in the command above with yours, and it should match the one you used to install OpenSearch.

The command will return an output like this:

{
"name" : "almalinux.rosehosting.com",
"cluster_name" : "opensearch",
"cluster_uuid" : "n798ronRTna-nbCkkxaqwg",
"version" : {
"distribution" : "opensearch",
"number" : "3.0.0",
"build_type" : "rpm",
"build_hash" : "dc4efa821904cc2d7ea7ef61c0f577d3fc0d8be9",
"build_date" : "2025-05-03T06:23:53.552902827Z",
"build_snapshot" : false,
"lucene_version" : "10.1.0",
"minimum_wire_compatibility_version" : "2.19.0",
"minimum_index_compatibility_version" : "2.0.0"
},
"tagline" : "The OpenSearch Project: https://opensearch.org/"
}
$ exit

Step 5. Install MySQL Server

Magento supports MySQL 8.4 or MariaDB 10.6. AlmaLinux 10 ships with MySQL 8.4 and MariaDB 10.11. So, in this step, we will install MySQL server 8.4.

# dnf install mysql-server

Once installed, we can run this command to enable it upon server reboot and start the service now.

# systemctl enable --now mysqld

Step 6. Create a Database

After installing the MySQL server in the previous step, we can proceed with creating a new database and a user for our Nextcloud website.

# mysql
mysql> CREATE DATABASE magento;

mysql> CREATE USER 'magento'@'localhost' IDENTIFIED BY "m0d1fyth15";

mysql> GRANT ALL PRIVILEGES ON magento.* TO 'magento'@'localhost';

mysql> FLUSH PRIVILEGES;

mysql> SET GLOBAL log_bin_trust_function_creators = 1;

mysql> \q

Remember to replace ‘m0d1fyth15’ with a stronger password.

Step 7. Install Composer

Composer is a package manager for the PHP programming language that can be used for managing dependencies of PHP software and required libraries.

The installation of Composer is straightforward and relatively easy. Simply download and install Composer with these commands:

# curl -sS https://getcomposer.org/installer -o composer-setup.php
# php composer-setup.php --install-dir=/usr/local/bin --filename=composer

That’s it. You have successfully installed Composer on your AlmaLinux server. Next, verify the installed version of Composer with the following command:

# composer --version

or

# composer -V

The command will print this message:

Composer version 2.8.9 2025-05-13 14:01:37
PHP version 8.3.10 (/usr/bin/php)
Run the "diagnose" command to get more detailed diagnostics output.

Step 8. Download and Install Magento

Go to https://commercemarketplace.adobe.com/ and create an account or log in if you already have an account. After logging in, navigate to the Adobe Commerce Marketplace and create the key pair. You will need the key pair when executing the command below.

# su - magento
$ composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.8 /opt/magento/website

When prompted for a username, you need to use the ‘PUBLIC KEY’ for the username and ‘PRIVATE KEY’ for the password. It would be self-explanatory from here. Wait until the download finishes.

After all required files are downloaded, we can proceed with the installation by running the command below.

$ cd /opt/magento/website
$ bin/magento setup:install \
--base-url=http://yourdomain.com \
--db-host=localhost \
--db-name=magento \
--db-user=magento \
--db-password=m0d1fyth15 \
--admin-firstname=Magento \
--admin-lastname=Admin \
--admin-email=admin@yourdomain.com \
--admin-user=admin \
--admin-password=m0d1fyth15 \
--language=en_US \
--currency=USD \
--timezone=America/Chicago \
--use-rewrites=1 \
--search-engine=opensearch

At the end of the installation, you will see an output similar to this:

[SUCCESS]: Magento installation complete.
[SUCCESS]: Magento Admin URI: /admin_f2ua7sp
Nothing to import.

Before logging in to the backend, we can disable Two-Factor Authentication first and enable it again later. We need to run these commands to disable the 2FA modules.

$ php bin/magento module:disable Magento_AdminAdobeImsTwoFactorAuth
$ php bin/magento module:disable Magento_TwoFactorAuth
$ php bin/magento setup:di:compile
$ php bin/magento cache:clean

At this point, Magento is installed, and we can navigate to the backend at http://yourdomain.com/admin_f2ua7sp using our favourite web browser. Please note that you will need to use your own link to access the backend.

Step 9. Set up Cron jobs

Magento requires its cron jobs to run to automate its essential system functions. Let’s execute the command below to create Magento cron jobs under the user magento.

$ php bin/magento cron:install

Congratulation! You have successfully installed Magento on AlmaLinux 10.

Of course, you don’t have to install Magento on AlmaLinux 10 if you have a Magento server with us, in which case you can simply ask our expert Linux hosting admins to set all of this up for you, quickly and easily. Our admins will install Magento on AlmaLinux 10 for you immediately without any additional fee, along with many useful optimizations that we can do for you. Managing a Magento based website is not just about the installation, we can help you with optimizing your Magento installation if you have an active service with us. Our admins will also help you with more complex Magento installations, like using Varnish, and other customizations.

If you liked this post, please share it with your friends or leave a comment in the comments section. Thanks!

Leave a Comment