Magento is the best enterprise class eCommerce software and solution. It is powered with open, flexible and next-gen architecture. The application developed with Magento will provide best and engaging shopping experience users. It performance is best than other eCommerce applications available. The Magento 2 is the latest release available. This version have a number of improvements changes and optimizations over previous Magento version.

This tutorial will help you to configure Magento application on your Fedora system.

Step 1 – Install LAMP

First of all, you need to setup LAMP environment on the Fedora system. You can use the following commands to install Apache web server and PHP from default repositories.

sudo dnf update
sudo dnf install httpd

Then install PHP and other required PHP modules.

sudo dnf install php libapache2-mod-php php-mysql php-dom php-simplexml 
sudo dnf install php-curl php-intl php-xsl php-mbstring php-zip php-xml

Step 2 – Install MySQL Server

You can use MySQL or MariaDB as the database server for the Magento application. To install MySQL server run the following command.

sudo dnf install mysql-server

The default MariaDB database server will be installed. Now start service and complete initial setup for database server.

sudo systemctl enable mariadb
sudo systemctl start mariadb

Now run below command to complete Mariadb setup:

sudo mysql_secure_installation

Follow the onscreen instructions. Below is the input required from user:

  • Enter current password for root (enter for none): [PRESS ENTER]
  • Set root password? [Y/n] y
  • New password: [ENTER YOUR PASSWORD]
  • Re-enter new password: [ENTER PASSWORD AGAIN]
  • Remove anonymous users? [Y/n] y
  • Disallow root login remotely? [Y/n] y
  • Remove test database and access to it? [Y/n] y
  • Reload privilege tables now? [Y/n] y

Step 3 – Install PHP Composer

This tutorial required PHP composer to complete the installation. To install the PHP composer on your system execute following commands:

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer    
chmod  x /usr/local/bin/composer   

Step 4 – Download Magento 2

You can download the Magento source code from the official Github repository or website. After finishing the download After downloading the archive file, extract it under the website document root. So we can access directly from the web browser.

wget https://github.com/magento/magento2/archive/2.3.zip
mv magento2-2.3 /var/www/magento2

After placing Magento files to the proper location, use composer to install required libraries

cd /var/www/magento2
composer install

The composer installation will take some time. Once composer finished installation, set the recommended permissions on the files to run with Apache web server.

sudo chown -R www-data.www-data /var/www/magento2
sudo chmod -R 755 /var/www/magento2
sudo chmod -R 777 /var/www/magento2/{pub,var}

Step 5 – Create MySQL User and Database

We already have Maraidb running on system and generated root password in previous steps. But its good idea to use a seperate account for the Magento configuration. Login to the database server with root user and create a database and user for the new Magento 2 installation.

mysql -u root -p

mysql> CREATE DATABASE magento2_db;
mysql> CREATE USER [email protected]'localhost' IDENTIFIED BY 'pa$$word';
mysql> GRANT ALL ON magento2_db.* TO [email protected]'localhost';
mysql> FLUSH PRIVILEGES;
mysql> quit

Step 6 – Setup Apache VirtualHost

Now create an Apache virtual host for your domain.

sudo vim /etc/httpd/conf.d/webhost.tecadmin.net.conf

<VirtualHost *:80>

    ServerAdmin admin@example.com

    ServerName webhost.tecadmin.net

    DocumentRoot /var/www/magento2

    <Directory /var/www/magento2>

        Allowoveride all

    </Directory>

</VirtualHost>

Save and close the file. Restart Apache service to reload the configuration.

sudo systemctl restart httpd.service

Step 7 – Run Web Installer

Let’s begin the installation of Magento2 using a web installer. Access your Magento 2 directory on the web browser like below. It will redirect you to the installation start page.

 http://webhost.tecadmin.net

7.1. Agree the License agreement and click on “Agree and Setup Magento”

How to Install Magento2 on Fedora 31/30/29 eCommerce Fedora Magento

7.2. Now click on the “Start Readiness Test”. Magento will check for system requirements here. On successful completion, you will see the screen like below then Just click Next. Fix issues if shows on this screen and click Try again.

How to Install Magento2 on Fedora 31/30/29 eCommerce Fedora Magento

7.3. Enter your database details here created in step 4.

How to Install Magento2 on Fedora 31/30/29 eCommerce Fedora Magento

7.4. The installer will show you the store address (Same as we address). It also generates a random URL for the Admin interface. You can change it as per your requirements. For security reasons, it will not take the URL as admin.

How to Install Magento2 on Fedora 31/30/29 eCommerce Fedora Magento

7.5. Create an Admin user with a secure password for your Magento application.

How to Install Magento2 on Fedora 31/30/29 eCommerce Fedora Magento

7.6. At this step, Magento is ready for installation. Click on the Install Now button to begin installation and wait for its completion.

How to Install Magento2 on Fedora 31/30/29 eCommerce Fedora Magento

7.7. At this step, the Magento installation is completed.

How to Install Magento2 on Fedora 31/30/29 eCommerce Fedora Magento

7.8. Finally, it will open the Admin Login screen. Use admin credentials created during wizard. It will open the Admin panel after successful authentication.

How to Install Magento2 on Fedora 31/30/29 eCommerce Fedora Magento

Congratulation! You have successfully configured Magento2 on your Fedora system.

Step 8 – Schedule Cronjobs

Finally, schedule the background cronjobs for your magento2 installation. These cronjobs do some activities like re-indexing, Newsletters, Update of currency rates, sending automatic emails and generating sitemaps, etc. To schedule, these jobs edit the crontab file

crontab -e

and add following cronjobs at the end of the file and save it.

* * * * * php /var/www/magento2/bin/magento cron:run
* * * * * php /var/www/magento2/update/cron.php
* * * * * php /var/www/magento2/bin/magento setup:cron:run