Menu
User

DropVPS Team

Writer: John hens

How to Install Magento 2 on Centos stream 9

How to Install Magento 2 on Centos stream 9

Publication Date

10/08/2025

Category

Articles

Reading Time

2 Min

Table of Contents

Magento 2 is one of the most reliable eCommerce platforms, and installing it on CentOS Stream 9 ensures stability, performance, and security for your online business.

Step 1: Update System

Before installing Magento, you should update CentOS Stream 9 to make sure your server has the latest security patches and avoids package errors:

sudo dnf update -y

Step 2: Install LAMP Stack

Magento cannot run without Apache, a database server, PHP, and Composer, so you need to install these core components first:

sudo dnf install httpd mariadb-server php php-mysqlnd php-cli php-xml php-mbstring php-intl php-bcmath unzip composer -y
sudo systemctl enable --now httpd mariadb

Step 3: Create Database

Magento requires a dedicated database to store all product information, customers, and orders, so creating one is essential for your store:

CREATE DATABASE magento;
CREATE USER 'magentouser'@'localhost' IDENTIFIED BY 'StrongPassword123';
GRANT ALL PRIVILEGES ON magento.* TO 'magentouser'@'localhost';
FLUSH PRIVILEGES;

Step 4: Download Magento 2

The best way to get Magento is through Composer, which downloads the latest version along with all required dependencies:

cd /var/www/html
sudo composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition magento2

Step 5: Configure Apache and Permissions

To make Magento run correctly, you must give Apache access to its files and set up a virtual host for your domain:

sudo chown -R apache:apache /var/www/html/magento2

Step 6: Complete Setup

After preparing the server and configuring Apache, you can complete Magento installation directly from the command line. This step sets up the database connection, admin account, and base URL for your store:

cd /var/www/html/magento2
bin/magento setup:install \
--base-url=http://yourdomain.com \
--db-host=localhost \
--db-name=magento \
--db-user=magentouser \
--db-password=StrongPassword123 \
--admin-firstname=Admin \
--admin-lastname=User \
[email protected] \
--admin-user=admin \
--admin-password=Admini Password 123 \
--language=en_US \
--currency=USD \
--timezone=America/New_York \
--use-rewrites=1
Linux VPS
U
Loading...

Related Posts