Magento is the best enterprise-class eCommerce software and solution. It is powered by open, flexible, and next-gen architecture. The application developed with Magento will provide the best and engaging shopping experience for users. Its performance is best than other eCommerce applications available. The Magento 2 is the latest release available. This version has a number of improvement changes and optimizations over the previous Magento version.
This tutorial will help you to configure the Magento application on your Fedora system.
Step 1 – Install LAMP
First of all, you need to set up a 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 the MySQL server run the following command.
sudo dnf install mysql-server
The default MariaDB database server will be installed. Now start service and complete the initial setup for the 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 it 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 in the proper location, use composer to install required libraries
cd /var/www/magento2 composer install
The composer installation will take some time. Once the composer finished installation, set the recommended permissions on the files to run with the Apache webserver.
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 MariaDB running on the system and generated the root passwords in previous steps. It’s a good idea to use a separate account for the Magento configuration. Log in to the database server with the 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 magento2_usr@'localhost' IDENTIFIED BY 'pa$$word'; mysql> GRANT ALL ON magento2_db.* TO magento2_usr@'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
1 2 3 4 5 6 7 8 | <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”
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.
7.3. Enter your database details here created in step 4.
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.
7.5. Create an Admin user with a secure password for your Magento application.
7.6. At this step, Magento is ready for installation. Click on the Install Now button to begin installation and wait for its completion.
7.7. At this step, the Magento installation is completed.
7.8. Finally, it will open the Admin Login screen. Use admin credentials created during the wizard. It will open the Admin panel after successful authentication.
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 currency rates, sending automatic emails and generating sitemaps, etc. To schedule, these jobs edit the crontab file
crontab -e
and add the 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
Conclusion
This tutorial helped you with step by step installation of the Magento2 application on a Fedora Linux system.