How to install and configure Magento in CentOS server
- 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
- Start the Apache and MariaDB services:
systemctl start httpd
systemctl start mariadb
- Set the Apache and MariaDB services to start automatically on system boot:
systemctl enable httpd
systemctl enable mariadb
- Create a new database for Magento by running the following commands:
mysql -u root
CREATE DATABASE magento;
GRANT ALL PRIVILEGES ON magento.* TO 'magento'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
exit;
- 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>
ServerName www.magento.com
DocumentRoot /var/www/html/magento
<Directory /var/www/html/magento>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
- Download the latest version of Magento from the official website and extract it to the /var/www/html/magento directory.
- 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
- Restart the Apache service for the changes to take effect:
systemctl restart httpd
- 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.
- After the installation is complete, log in to the Magento admin panel and configure the necessary settings, such as the database connection, security,