Step-by-Step Guide to Installing Magento 2

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

    12 sudo apt updatesudo apt install apache2

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

    1 sudo systemctl enable apache2.service

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

    1 sudo 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

    2345678 ServerAdmin 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>

    1 127.0.0.1 your-magento-2-store-url.com

    Run the following command to enable mod rewrite:

    12 sudo 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:

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

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

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

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

    1 sudo 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:

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

      Finally, flush the privileges and exit.

      12 FLUSH 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:

      1 curl -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:

      1 composer -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.

              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:

          12 sudo 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:

            20 Comments

              • 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!

            1. I log often and I truly thank you for your information.
              The article has really peaked my interest. I am going to take a note
              of your site and keep checking for new informmation about once a week.
              I opted in for your Feed too.

              my webpage … oople.Com

              • Thanks so much for the kind words! We are happy you found the guide helpful. Stay tuned for more updates, and feel free to share any topics you’d like to see. Happy learning!

              • Hey there! Thanks for reaching out! Setting up a blog can feel a bit overwhelming at first, but it’s absolutely doable—even if you’re not super technical. Platforms like WordPress or Medium are beginner-friendly and offer lots of tutorials to help you get started. Our advice: start small, focus on topics you’re passionate about, and the rest will come with practice. Feel free to ask if you have any questions along the way. Good luck!

              • Thank you so much for the encouragement! we are really glad to hear you enjoyed the content, and it’s awesome to know it’s inspired you to start your own blog. Best of luck with it—enjoy the journey!

            2. What i do not understood is in reality how you are now not really much
              more neatly-appreciated than you might be now. You’re very intelligent.

              You understand thus considerably iin relation to this subject, made me individually consider it
              from a lot of various angles. Its like men and women are
              not involved eccept it’s one thing to do with Woman gaga!Your own stuffs nice.
              At all times deal with it up!

              Feel free to viisit my webpage :: http://forums.outdoorreview.com

              • Thank you so much for the thoughtful comment! We are really glad the content resonated with you from different angles—it’s great to hear feedback like this. We’ll definitely keep sharing insights, and thanks for your support!

              • Thanks so much! We are glad you enjoyed it. we appreciate you taking the time to read and share your thoughts here!

              • Thank you so much for the kind words! We are really glad you enjoyed the post, and we appreciate you bookmarking the blog. we’ll definitely keep the content coming—hope you have a wonderful weekend too!

            3. An impressive share! I’ve just forwarded this onto a colkeague who had
              been doing a little homework on this. And hee actually ordered me dinner because I stumbled upon it for him…
              lol. So let me reword this…. Thank YOU for the meal!!
              But yeah, thanks for spending some time to discuss this
              topic here on your internet site.

              My weeb page: http://Services-Sector.ru/clubpointeresam/memberlist.php?mode=viewprofile&u=103918

              • Haha, glad to hear that our post led to a free meal! 😄 Thanks for sharing it with your colleague, and we are really happy you found the topic useful. Hope you both enjoyed the read!

              • Thank you for the feedback! we are really glad you enjoyed the article and found it helpful in exploring recent tech developments. Appreciate you stopping by!

              • Thank you so much for your kind words! We are really glad to hear you find the information helpful. We appreciate your support!

            Leave a Reply

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