FedoraLinuxTutorials

How To Install Magento on Fedora 35

Install Magento on Fedora 35

In this tutorial, we will show you how to install Magento on Fedora 35. For those of you who didn’t know, Magento is an open-source e-commerce platform written in PHP that uses multiple PHP frameworks. Magento provides e-commerce merchants a shopping cart system, and control over the look, feel, and functionality of their site. Magento also offers marketing, SEO (search engine optimization), and catalog-management tools to site administrators. The Magento 2 is the latest release available. This version has a number of improvement changes and optimizations over the previous Magento version.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Magento eCommerce Marketing Platform on a Fedora 35.

Prerequisites

  • A server running one of the following operating systems: Fedora 35.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Magento on Fedora 35

Step 1. Before proceeding, update your Fedora operating system to make sure all existing packages are up to date. Use this command to update the server packages:

sudo dnf upgrade
sudo dnf update

Step 2. Installing LAMP stack.

You need to set up a LAMP environment on the Fedora system. If you do not have LAMP installed, you can follow our guide here.

Step 3. Installing PHP Composer.

Run the following command to install composer. Composer is a dependency management tool for use with PHP projects:

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

Verify the Composer installation using the following command:

composer -V

Step 4. Installing Magento on Fedora 35.

By default, Magento is available on Fedora 35 base repository. Now run the following command below to download the latest Magento installer from the GitHub page:

wget https://github.com/magento/magento2/archive/refs/tags/2.4.7-p1.zip

Next, Unzip the Magento archive to the document root directory on your server:

unzip 2.4.7-p1.zip
mv 2.4.7-p1 /var/www/magento2

Then, change the directory to magento2 and use composer to install the required libraries:

cd /var/www/magento2
composer install

After 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. Configuring MariaDB.

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script. you should read below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:

mysql_secure_installation

Configure it like this:

- Set root password? [Y/n] y
- 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

Next, we will need to log in to the MariaDB console and create a database for Magento. Run the following command:

mysql -u root -p

This will prompt you for a password, so enter your MariaDB root password and hit Enter. Once you are logged in to your database server you need to create a database for Magento installation:

MariaDB [(none)]> CREATE DATABASE magento2_db;
MariaDB [(none)]> CREATE USER magento2_usr@'localhost' IDENTIFIED BY 'your-strong-password';
MariaDB [(none)]> GRANT ALL ON magento2_db.* TO magento2_usr@'localhost';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> quit

Step 6. Configuring Apache.

Now create an Apache virtual host configuration file for Magento:

sudo nano /etc/httpd/conf.d/magento.conf

Add the following files:

<VirtualHost *:80>
    ServerAdmin admin@your-domain.com
    ServerName your-domain.com
    DocumentRoot /var/www/magento2
    <Directory /var/www/magento2>
        Allowoveride all
    </Directory>
</VirtualHost>

Save and close the file, then restart the Apache service for the changes to take effect:

sudo systemctl restart httpd

Step 7. Accessing Magento Web Interface.

Once successfully installed, open your web browser and access the Magento web interface using the URL http://your-domian.com. You should see the Magento installation start page:

Install Magento on Fedora 35

Congratulations! You have successfully installed Magento. Thanks for using this tutorial for installing the Magento eCommerce Marketing Platform on your Fedora 35 system. For additional help or useful information, we recommend you check the official Magento website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button