How to install and configure Magento in CentOS server

  1. Install the necessary packages for Magento by running the following command:
yum install -y httpd mariadb mariadb-server php php-mysqlnd php-gd php-curl php-intl php-xsl php-mbstring php-zip
  1. Start the Apache and MariaDB services:
systemctl start httpd
systemctl start mariadb
  1. Set the Apache and MariaDB services to start automatically on system boot:
systemctl enable httpd
systemctl enable mariadb
  1. Create a new database for Magento by running the following commands:
mysql -u root


GRANT ALL PRIVILEGES ON magento.* TO 'magento'@'localhost' IDENTIFIED BY 'password';


  1. Create a new virtual host for Magento by creating a new file in the /etc/httpd/conf.d/ directory, for example magento.conf, and add the following configuration:
<VirtualHost *:80>
    DocumentRoot /var/www/html/magento
    <Directory /var/www/html/magento>
        Options -Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
  1. Download the latest version of Magento from the official website and extract it to the /var/www/html/magento directory.
  2. Set the correct permissions for the Magento files and directories by running the following commands:
chown -R apache:apache /var/www/html/magento

chmod -R 755 /var/www/html/magento
  1. Restart the Apache service for the changes to take effect:
systemctl restart httpd
  1. Open your web browser and navigate to your website to start the Magento installation wizard. Follow the instructions on the screen to complete the installation.
  2. After the installation is complete, log in to the Magento admin panel and configure the necessary settings, such as the database connection, security,