MilestoneFEATURED IN LIVEMINT 40 UNDER 40 • RECOGNIZED BY FORBES INDIA • ISO 27001:2022 CERTIFIED
Magento 2

Step-by-Step Guide to Installing Magento 2

Kraftors TeamPublished July 2, 2024Updated September 21, 20262 views
Step-by-Step Guide to Installing Magento 2

 Installing Magento 2

The Magento 2 platform offers a wide range of features and flexibility that are essential for online stores to succeed. In my last article I talked about why Magento 2 is the best platform to create an e-commerce website.

However, some users may find it challenging to install Magento 2 because it has a long list of technical requirements.

From understanding the system requirements to following end-to-end steps with the right approach can make it easy to install Magento 2 and bring your brings back to track with promising features. 

Here we have put together a step-by-step guide to install Magento 2.

System Requirements to Install Magento 2

The system requirements include the following: 

      • Operation System: Ubuntu, Debian, or CentOS are among the suggested Linux distributions.

      • Web server: Nginx 1. x or Apache 2.4.

      • Database: 10.x MariaDB or MySQL 5.6+.

      • PHP: Version 7.3 or 7.4, with the following extensions enabled:

      • bc-math

      • ctype

      • curl

      • dom

      • gd, ImageMagick 6.3.7+ (2.0.34+)

      • intl

      • mbstring

      • OpenSSL

      • PDO/MySQL

      • SimpleXML

      • soap

      • XM

      • xsl

      • zip

      • JSON

    Step-by-Step Magento 2 Installation Process

    The Magento 2 installation process brings along a range of steps that you must take to ensure a seamless Magento 2 installation process. Here are step-by-step process for Magento 2 installation:

    Step 1: Install & Configure Apache2 Server & PHP Extensions

    Apache is an open-source web server that is used in Ubuntu for hosting the website and for this purpose you will have to install Magento 2.

    Run the following commands to install Apache in Ubuntu

    12sudo apt updatesudo apt install apache2

    To auto-run Apache2 during system startup, use the following command:

    1sudo systemctl enable apache2.service

    Create a magento2. conf file using the following command to declare Magento 2 site configuration for Apache2

    1sudo nano /etc/apache2/sites-available/magento2.

    Now, open the created file confident to see that it has the heading contents as desired. Copy and paste the following configuration into it

    2345678ServerAdmin webmaster@localhostDocumentRoot /var/www/htmlErrorLog ${APACHE_LOG_DIR}/error.logCustomLog ${APACHE_LOG_DIR}/access.log combined      ServerName your-magento-2-store-url.com    DocumentRoot /var/www/html/magento2/pub

    Please do not forget to replace the server address with your real Magento 2 store link, which is written as “your-magento-2-store-url. com”

    If installing Magento 2 is done on Ubuntu locally, you may change it to localhost. com. You will also have to make some changes to the /etc/hosts file as well.

    <div><br>127.0.0.1 your-magento-2-store-URL.com</div>

    1127.0.0.1 your-magento-2-store-url.com

    Run the following command to enable mod rewrite:

    12sudo a2ensite magento2.confsudo a2enmod rewrite

    Step 2: Install Database Server

    Since Magento 2 and Adobe Commerce, MariaDB is one of the most popular database servers. To install MariaDB server and client in Ubuntu, run the following command:

    1sudo apt-get install mariadb-server mariadb-client

    To auto-start the database server on system startup, run the following command:

    12sudo systemctl restart mariadb.servicesudo systemctl enable mariadb.service

    Now, run the following command to set up a MariaDB server in Ubuntu:

    1sudo mysql_secure_installation

    Select the following options when prompted:

        • 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: Please enter your password

        • Remove anonymous users? [Y/n]: Y

        • Disallow root login remotely? [Y/n]: Y

        • Delete the test database and open it. [Y/n]: Y

        • Reload privilege tables now? [Y/n]: Y

      Step 3: Select MySQL User

      Magento 2 can not be installed directly under the root user in the operation system by default. That means you will have to create a new user for the database.

      Run the following command to log into MariDB:

      sudo mysql -u root -p

      Now, run the following command to create a new database

      CREATE DATABASE magento2

      Create a new user called ‘XYZ’ using the following command

      CREATE USER 'XYZ'@'localhost' IDENTIFIED BY 'YOUR_PASSWORD';

      Grant user to magento2 database:

      1GRANT ALL ON magento2.* TO 'XYZ'@'localhost' IDENTIFIED BY 'YOUR_PASSWORD' WITH GRANT OPTION;

      Finally, flush the privileges and exit.

      12FLUSH PRIVILEGES;EXIT

      Step 4: Install Composer

      Composer is a must for Magento 2 for managing the dependencies. You can either download and install Composer in Ubuntu manually or run the following command to do that:

      1curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

      To check if the Composer has been successfully installed, run the following version check command:

      1composer -v

      Step 5: Download & Install Magento 2 in Ubuntu

      Go to one of these resources and download the zip file of the latest Magento 2 version:

          1. Magento 2 Releases on GitHub
            Now, extract the zip file to the /var/www/html/ folder.

            1. Download through composer
              You can download the latest version of Magento by using Composer as it handles dependencies and updates more efficiently.n

              There are two main ways to install Magento 2 using Composer for Magento, Open Source and Adobe Commerce. Choose the method that suits your needs.

          Magento Open Source

          composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition Magento 2 

          Adobe Commerce

          composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition Magento 2

                                  Run the following command to set the permissions:

          12sudo chown -R www-data:www-data /var/www/html/magento2/sudo chmod -R 755 /var/www/html/magento2/

          Install Magento 2 on Ubuntu

          Open the /var/www/html/magento2 folder and run the following command:

          php bin/magento setup:install –base-url=https://magento2.com/ –db-host=127.0.0.1 –db-name=magento2 –db-user –db-password=password –admin-firstname=admin –admin-lastname=admin –admin-email=admin@admin.com –admin-user=admin –admin-password=admin123 –languag e=en_US –currency=USD –timezone=America/Chicago –use-rewrites=1 –backend-frontname=”admin” –search-engine=elasticsearch7

          The above command installs Magento 2 on Ubuntu with the preset configuration setting. Below, you can find the necessary parameters which you can modify to install Magento 2 as required: For e. g., there is an ability to change the login username and password.

          Once the command has been executed successfully, one is able to access the Magento 2 in the local server.

              • Frontend URL: https://magento2.com/

              • Admin Login URL: https://magento2.com/admin

              • Admin Username: admin

              • Admin Password: admin123

            That’s it! Well done; congratulations for successfully installing the Magento 2 store on your Ubuntu server.

            Conclusion

            Though it may seem difficult, installing Magento 2 can be done effectively by following this detailed tutorial. To safeguard and maximize your business, don't forget to set up your server environment, properly complete each installation process, and take care of post-installation chores. Magento 2 gives your clients a rich and customized shopping experience on a strong platform that can grow with your company.


            For more insights on enhancing your e-commerce platform, check out our previous blog on  why choose Magento 2 for your E-
            commerce Business. This can help you understand how to improve customer interactions and support.

            Please follow and like us

            Share this article with your network and stay updated with Kraftors insights.

            K

            Written by Kraftors Team

            Discussion & Comments (10)

            Join the conversation and share your feedback

            H
            https://Vavadaonline.Mystrikingly.com/Sep 25, 2024

            wonderful submit, very informative. I wonder why rnthe other specialists of this sector do not realize this.rnYou muszt proceed your writing. I'm confident, you've rna huge readers' baee already!rnrnMy website; <a href="https://Vavadaonline.Mystrikingly.com/" rel="nofollow ugc">https://Vavadaonline.Mystrikingly.com/</a>

            K
            Kraftors TeamSep 25, 2024

            Thank you so much for your kind words! We truly appreciate your feedback and support. we are glad that you found the information helpful, and we ’ll continue to share more insights. Stay tuned!

            O
            oople.ComNov 1, 2024

            I log often and I truly thank you for your information. rnThe article has really peaked my interest. I am going to take a note rnof your site and keep checking for new informmation about once a week.rnI opted in for your Feed too.rnrnmy webpage ... <a href="http://oople.com/forums/member.php?u=233008" rel="nofollow ugc">oople.Com</a>

            H
            http://forum.d-Dub.com/member.php?837409-SvetlfwsNov 1, 2024

            Hello there! Thiis is kind oof off topic but I need some advce from rnan established blog. Is it tough to set up your oown blog?rnI'm not very techincal but I can figure things out pretty quick.rnrnI'm thinking about making my own but I'm not surfe where too rnstart. Do you have any ideas or suggestions? Thanksrnrnmy web-site :: <a href="http://forum.d-Dub.com/member.php?837409-Svetlfws" rel="nofollow ugc">http://forum.d-Dub.com/member.php?837409-Svetlfws</a>

            H
            http://Www.Jeepin.com/forum/member.php?u=114949Nov 2, 2024

            I must thank you forr the efforts you've put iin pnning this rnwebsite. I am hoping to check out the same high-grade content from you later on as well.rnIn truth, your creative writing abilities has motivated me tto get my very own blog now ;)rnrnmy blog <a href="http://Www.Jeepin.com/forum/member.php?u=114949" rel="nofollow ugc">http://Www.Jeepin.com/forum/member.php?u=114949</a>

            H
            http://forums.outdoorreview.comNov 3, 2024

            What i do not understood is in reality how you are now not really much rnmore neatly-appreciated than you might be now. You're very intelligent.rnrnYou understand thus considerably iin relation to this subject, made me individually consider it rnfrom a lot of various angles. Its like men and women are rnnot involved eccept it's one thing to do with Woman gaga!Your own stuffs nice.rnAt all times deal with it up!rnrnFeel free to viisit my webpage :: <a href="http://forums.outdoorreview.com/member.php?327370-Svetlewk" rel="nofollow ugc">http://forums.outdoorreview.com</a>

            H
            http://www.Ogloszeniaezoteryczne.Pl/author/svetlkem/Nov 3, 2024

            Hi friends, giod paragraph and nice urging commented at this place, rnI am really enjoyying by these.rnrnFeel free to visit my blog post :: <a href="http://www.Ogloszeniaezoteryczne.pl/author/svetlkem/" rel="nofollow ugc">http://www.Ogloszeniaezoteryczne.Pl/author/svetlkem/</a>

            H
            http://WWW.Fiat130.it/phpbb3/viewtopic.php?f=5&amp;t=263780Nov 3, 2024

            Thanks for a marvelous posting! I seriously enjoyed reading it, you aare a great author.I will ensure that I bookmark your blog and will rncome back at some point. I wqnt to encourage you to ultimately continue rnyour great work, have a nice weekend!rnrnAlso viszit my web blog: <a href="http://WWW.Fiat130.it/phpbb3/viewtopic.php?f=5&amp;t=263780" rel="nofollow ugc">http://WWW.Fiat130.it/phpbb3/viewtopic.php?f=5&amp;t=263780</a>

            H
            http://Services-Sector.ru/clubpointeresam/memberlist.php?mode=viewprofile&amp;u=103918Nov 4, 2024

            An impressive share! I've just forwarded this onto a colkeague who had rnbeen doing a little homework on this. And hee actually ordered me dinner because I stumbled upon it for him...rnlol. So let me reword this.... Thank YOU for the meal!!rnBut yeah, thanks for spending some time to discuss this rntopic here on your internet site.rnrnMy weeb page: <a href="http://Services-Sector.ru/clubpointeresam/memberlist.php?mode=viewprofile&amp;u=103918" rel="nofollow ugc">http://Services-Sector.ru/clubpointeresam/memberlist.php?mode=viewprofile&amp;u=103918</a>

            H
            http://forum.d-dub.com/member.php?835114-SvetljuuNov 4, 2024

            I read this post fully on the topic of the difference rnof most recent and previous technologies, it's awesome article.rnrnrnCheck out my webpage :: <a href="http://forum.d-dub.com/member.php?835114-Svetljuu" rel="nofollow ugc">http://forum.d-dub.com/member.php?835114-Svetljuu</a>

            Leave a Reply

            Your email address will not be published. Required fields are marked *