magent 2 lokal installieren titelbild

Magento is a powerful e-commerce platform used by many online retailers worldwide. Installing Magento on a local server is the best way to get to know and test the platform without needing an Internet connection. However, if you have never installed an e-commerce platform before, it can seem a little intimidating. Don’t worry, we have created a step-by-step guide to help you install Magento on your local server! In this blog article, we will introduce you to the necessary steps and provide helpful tips and tricks to help you successfully install Magento.

Setting up the Magento development environment:

 

  1. Download XAMPP (.exe) for the server environment.
  2. XAMPP Download

     

  3. Download the Magento ZIP file.
  4. Magento ZIP File Download

     

  5. Extract the Magento ZIP file into the DeinXamppOrdner/htdocs folder.
  6.  

  7. Download Composer.exe. Create a directory named "composer" in the "htdocs" folder.
  8. Composer.exe Download

     

    Modify and save the following files:

     

  9. C:/DeinXamppOrdner/php/php.ini

    Uncomment the following files by removing the semicolon (;)

    extension=soap
    extension=xsl
    extension=sodium
    extensions=sockets 
  10.  

  11. Add a virtual host: C:\NamedeinesXamppOrdners\apache\conf\extra\httpd-vhosts.conf

    
    <virtualhost :80="">
    DocumentRoot C:\NamexamppOrdner\htdocs\ProjektOrdner
    ServerName PorjektOrdner.localhost
    DirectoryIndex index.html index.php
                                <Directory "C:\NamexamppOrdner\htdocs\ProjektOrdner">
    Options Indexes FollowSymLinks Includes ExecCGI
    Order allow,deny
    Allow from all
    AllowOverride All
    
    
  12.  

     

    virtual host

  13. C:/DeinXamppOrdner/apache/conf/extra/httpd-xampp.conf Add LoadFile "C:/namexampordner/php/libsodium.dll" here.

    #
    # PHP-Module setup
    #
    LoadFile "C:/xampp7.33/php/php7ts.dll"
    LoadFile "C:/xampp7.33/php/libpq.dll"
    LoadFile "C:/xampp7.33/php/libsodium.dll"
    LoadModule php7_module "/xampp7.33/php/php7apache2_4.dll"
  14.  

  15. C:/DeinXamppOrdner/apache/conf/extra/hosts

     

    Enter a localhost here. Add ExampleName.localhost localhost.

     

    
    # localhost name resolution is handled within DNS itself.
    #	127.0.0.1       localhost
    #	::1             localhost
    ExampleName.localhost      localhost
  16.  

  17. Open the Command Prompt (CMD) and enter the following in the command line:


  18. C:\DeinXamppOrdner\htdocs\ProjektOrdner C:\namexamppordner\php\php.exe composer.phar update


     

    composer update error message

    If this error message appears, open php.ini and remove the semicolon (;) from extension intl. Then run the update again.

  19.  

    composer update successful
  20. C:\DeinXamppOrdnerphp\php.exe bin/magento setup:di:compile
  21.  

    setup compile
  22. C:\DeinXamppOrdner\php\php.exe bin/magento setup:upgrade
  23.  

    setup upgrade

    Clear the caches.


  24. Enter the following command via CMD: Adapt this command to your own folder structure and data. It is important that Elasticsearch is hosted or rented. You need to create the access credentials and enter them here.
  25.  

    C:\DeinXamppOrdner\php\php.exe bin\magento setup:install --base-url=EnterLocalhostURL --db-host=localhost --db-name=DatabaseName --db-user=root --db-password= --admin-firstname=AdminFirstName --admin-lastname=AdminLastName --admin-email=Email --admin-user=AdminUsername--admin-password=EnterPasswordHere --language=en_US --currency=EUR --timezone=Europe/Berlin --use-rewrites=1 --search-engine=elasticsearch7 --elasticsearch-host=EnterHostHere --elasticsearch-port=EnterPortNumber --elasticsearch-enable-auth=1 --elasticsearch-index-prefix=EnterPrefixHere --elasticsearch-username=elastic --elasticsearch-password=EnterPasswordHere--elasticsearch-timeout=15


  26. After receiving an error message, modify the following files:
  27.  

    • \Validator.php line 141 (C:\xampp7.3.33\htdocs\projektordner\vendor\magento\framework\View\Element\Template\File)

      
      $realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path));

       

       

    • Open \StaticResource.php. Path: C:\DeinXamppOrdner\htdocs\ProjektOrdner\vendor\magento\framework\App
      
      Replace DIRECTORY_SEPARATOR with "/"
    • \PluginListGenerator.php on line 158: Replace $cacheId = implode('|', $this->scopePriorityScheme) . "|" . $this->cacheId; with
      
      $cacheId = implode('-', $this->scopePriorityScheme) . "-" . $this->cacheId;
    • Open \Gd2.php (C:\DeinXamppOrdner\htdocs\ProjektOrdner\vendor\magento\framework\Image\Adapter) and replace if ($url && isset($url['scheme']) && !in_array($url['scheme'], $allowed_schemes)) { with
      
      if ($url && isset($url['scheme']) && !in_array($url['scheme'], $allowed_schemes) && !file_exists($filename)) {
    • In Di.xml on line 756, replace Symlink with
      
      "Copy"

     

  28. In Httpd.conf on line 183, uncomment LoadModule version_module modules/mod_version.so.

  29.  

    
    #LoadModule substitute_module modules/mod_substitute.so
    #LoadModule unique_id_module modules/mod_unique_id.so
    #LoadModule userdir_module modules/mod_userdir.so
    LoadModule version_module modules/mod_version.so
    #LoadModule vhost_alias_module modules/mod_vhost_alias.so
    #LoadModule watchdog_module modules/mod_watchdog.so
    #LoadModule xml2enc_module modules/mod_xml2enc.so

     

     

  30. Run setup:upgrade again to clear all caches.
  31.  

    setup upgrade clear caches
  32. Disable the TwoFactorAuth module.
  33.  

    disable TwoFactorAuth module

    - C:\DeinXamppOrdner\htdocs\DeinProjektOrdner>C:\DeinXamppOrdner\php\php.exe bin\magento module:disable Magento_TwoFactorAuth
    - Then run setup upgrade again to clear the cache.

     


  34. The backend should now be accessible.

 

We hope this article has helped you with installing Magento locally and that you can now successfully create your own Magento website. However, if you need support or have questions about how to get the most out of your online shop, our team at econcess Internet Agency will be happy to assist you. We are experts in creating Magento shops and are happy to support you from the initial planning through to the finished website. Visit our website or contact us directly for more information. We look forward to hearing from you.