0%
While operating an online store on the powerful Magento e-commerce platform offers a user-friendly retailing experience, installing Magento 2 can be challenging. There are several options for Magento installation. You can use Composer or a Web Setup Wizard, or do it manually using the CLI in your operating system. Using Composer offers some important advantages that can make Magento installation simpler and quicker.
If you are a web developer figuring out how to install Magento manually, you may find dealing with the programming code libraries and all the dependencies too complicated. Below is the general series of tasks, each with smaller steps for installing Magento using Composer. Following that, we have also included the process for the alternative manual Magento installation method.
Advantages of Installing Magento 2 via Composer
The Composer tool is designed to manage components and dependencies within Magento 2. This significantly simplifies the setup and allows programmers to complete the process with fewer issues with the CLI (command line interface), a primary necessity in the Magento 2 install. Other advantages to Composer for Magento 2 installation include, for example:
- Minimizing compatibility issues and other complications by working in architecture structured with components supported by strong management of dependencies.
- More seamless conformance to PHP Framework Interoperability Group (FIG) standards.
- Employing reusable third-party code libraries without having to bundle them with source code already inherent in Magento 2.
- Smoother repackaging of Magento 2 code with external components.
- More seamless performance of Magento 2 in the production environment.
Below, we’ll look at a generalized step-by-step guide through Magento 2 installation with Composer.
Prerequisites for Installing Magento
You will need to set up your server and ensure that you have satisfied all the prerequisites for Magento installation before you begin to install the platform software.
A. Meet all server requirements
- Have PHP (v. 7.4 or more recent) installed.
- Have MySQL (v. 5.6 or more recent) installed.
- Have Apache/Nginx installed.
- Have Composer installed.
- Use Elasticsearch (v. 7 or more recent).
- Obtain authentication keys for Magento Composer Repository.
B. Meet hosting requirements
To run Magento reliably through the coming years of your e-commerce enterprise, you will need to choose a quality web hosting provider. Of course, to meet the hosting requirements for Magento installation, you will first need to satisfy essential web server requirements. For example, you will need:
- Choose an Apache or Nginx server.
- Check your PHP version.
- Connect with MySQL.
C. Install Composer
Since you will need Composer to use Method 1 for setting up Magento, here’s a quick step-by-step view of the process for installing Composer. (Check for variations between Windows and Mac):
- Install PHP on your computer. (For the simplest approach, consider using open-source XAMPP for this kind of web server solution for Windows or Mac).
- Download the most recent version of Composer.
- Run the Composer install process.
- Set up Proxy Settings and Save.
- Complete running the installation.
- Test your Composer installation to ensure it is complete.
Additionally, before you begin the project, familiarize yourself with e-commerce industry site-building guidelines and best practices for Magento platform installation and further development.
METHOD 1: Install Magento 2 Using Composer
Composer is linked to code in Magento for the development of the platform components. It acts as a manager of dependencies in Magento 2 installation, helping to ensure the maintenance and upgrade of components as necessary. The installation tool reads the file Composer.json in the Magento root directory and performs downloads of dependencies from it. Follow this process to use Composer for Magento 2 installation.
STEP 1: Create a Magento project using Composer
Make sure you have written permission in Magento’s file system. Log in on the Magneto server as its owner. Then, access the directory in which you want to install Magento.
Enter these strands of code to enable yourself to run Magento commands from any directory:
public_html OR <magento_root>/bin and export PATH=$PATH:/var/www/html/magento2/bin
OR
cd <magento_root>/bin and run them as ./magento <command name>
STEP 2: Set up the database
Create a new database for your Magento platform software installation. Use an empty database file with MySQL (or its successor, MariaDB). Use the command:
echo “CREATE DATABASE magento2” | mysql -u[mysqluser] -p
STEP 3: Download Magento 2
Select your profile in the Magento Marketplace and follow the quick process to set up the public and private access keys required to use the Magento repository. You can either download Magento 2 from the Magento website or run the installation command: repository url https repo.magento.com via Composer.
Run the command this way to specify the Magento version you want and create project repository URL coding:
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition <install-directory-name>
STEP 4: Set up the required file permissions
To avoid security obstacles in installing and running Magento, you need the correct folder and file permissions. You should obtain use directories with 775 permissions to read, write and execute actions, and files with 664 permissions to read and write, but not to execute. Be sure to set up the level of access you need to essential directories like pub/static, var, app/etc, and pub/media.
- The site owner requires unlimited access to all files.
- The internet server needs to write permission on these essential directories:
app/etc, var, and pub directory
- Execute permission of the bin/magento CLI script.
STEP 5: Complete the Magento 2 installation
If you use the CLI approach, vs. the wizard, run the “Install Magento” command:
php bin/magento setup:install --base-url=http://phpstack-....com/
The command must also include this series of basic information entries to ensure that the base URL, application URL, host, server IP address, name, user, password, and other parameters are all accurately encoded:
--db-host=“…” --db-name=magento2 --db-user=“…” --db-password=“…” --admin-firstname=“…” --admin-lastname=“…” --admin-email=“…”.com --admin-user=“…” --admin-password=“…” --use-rewrites=“…” --backend-frontname=“…” --db-prefix=“…” |
LEGEND: The three dots “…” indicate your particular information to be used to replace these unknowns, such as your first name, last name, email address, etc.
You have completed your installation of Magento 2 using Composer. You’re ready to begin configurations, run your readiness test, and launch your Magento store site.
Get in touch
with our expert
Discuss your project requirements and get a free estimate.
Get in touch
with our expert
Discuss your project requirements and get a free estimate.
METHOD 2: Install Magento 2 Manually (Without Composer)
It is not too difficult for many people with sufficient web skills to install Magento manually, without using Composer or relying on professional web development assistance.
Much of the process is automatically completed by the Magento application without intervention. If the database is set up correctly, the ZIP files can be unpacked without issues, and you can soon start selling at your online store.
STEP 1: Download the Magento package
- Go to the Magento website and select “Download Now.” Examine the array of program options available to you. Some are paid platforms. The “Community Edition” is the Magento open-source platform.
- You will be presented with a prompt that leads to information on the “Enterprise” version. Select “Continue with Community Edition.”
- On the next page that opens, scroll down. See the files under “Full Release.” Select your desired format, then select the “ZIP Only” file.
- Select “Download.” This will render the most recently updated version of Magento without sample data.
NOTE: If you wish, you can install the sample to see how Magento looks, but you’ll then have to delete the sample products and adjust various settings to make it usable for your online store.
STEP 2: Create an account and upload files to your server
Next, create an account to execute the download and complete the manual installation. It’s a free account. You may only need to use it for customer support or to access other help from Magento.
Validate your email address to enable downloading of the ZIP file.
Save the file to your computer’s desktop or wherever you want to access it in your folders.
STEP 3: Set up the database
Magento needs a database to operate. Go to your cPanel dashboard. Select the “MySQL Database Wizard” tool. Follow the required steps to connect a database.
To create a name for your database, select “Next Step.” Name your database.
Create a username and password for your database, and select “Create User.”
As a new Magento Database User, select “All Privileges,” and select “Next Step.” Your Magento database is now ready to receive data input from your Magento activities.
STEP 4: Upload Magento
Next, you will need to upload Magento to your web host. You can use the cPanel File Manager to upload the ZIP file and open it to manage its contents. (This approach may be faster than using FTP programs to transfer these files.)
Next, you need to upload the contents of the ZIP into your Magento root directory. To do this, from cPanel, select “File Manager.” Go to your website’s root folder. It is often the “public_html” folder. Make sure you are in the directory in which you want to install your Magento platform.
While in your website’s root folder, select “Upload” from the File Manager toolbar to upload Magento.
Next, select “Select File.” Then, select the ZIP file you downloaded. The automatic upload will begin.
After the file is entirely uploaded, select “Go Back to…” to return to your website.
To complete the manual installation of Magento, you need to upload the Magento ZIP Extract to bring all the ZIP files into your existing directory. To do this, right-click on the ZIP from your PC or CMD from your Mac. This makes all the ZIP files appear in the directory.
After you use Extract ZIP Files to complete the manual installation of Magento, delete it to free up space.
STEP 5: Configure and run the installation via the setup wizard
The Magento 2 Setup Wizard is accessible directly in the Magento installation process after you have installed the software on your web server. An independent URL does not exist for the wizard to be accessed on the web at large, so a Google search will not locate it. You can only access the wizard from within your domain by initiating the Magento 2 setup process.
After you install Magento on your web server, use your web browser to access your domain and the setup wizard. (If that does not bring up the wizard, make sure you’re working in production mode, not development mode. Also, make sure your Magento 2 installation is configured properly.)
Go to Magento documentation for thorough instructions on how to find and use the setup wizard.
Execute all the required commands presented in the auto prompts of the Magento Setup Wizard throughout the automated interactive setup process.
STEP 6: Complete Magento installation
Access the Magento installer app by entering your domain in your browser, and click “Agree and Setup Magento.” This completes your Magento installation. You can now open the Magento Admin page via Magento Admin Launch. You have now finished manually installing Magento and can begin operating your new e-commerce site. Nice work!
Common Post-Installation Magento 2 Configurations
Of course, after you complete your Magento 2 installation, there are additional configurations to be completed. For example:
Set Basics in Magento
Customize your online store’s essential functions, such as setting the time zone, date, language, currency type, and other basics for transactions, order tracking, accounting, etc.
Set Up Cron Jobs
Maximize your use of cron jobs to automate database backups, software updates, systems monitoring, and many other regular tasks. These are major time savers and efficiency boosters.
Enable Caching and Indexing
Ensure a properly configured cache to bolster efficiency and prevent poor use of server resources for excessively cumbersome tasks that prolong load times and frustrate site users.
Configure Security Settings
Adhere to the e-commerce industry best practices in managing your Magento website security systems and protocols. For example, implement these measures as part of your site security:
Magento Security Scan. Use the scan tool for security updates and solutions.
SSL Certificate. Encrypt the data between your browser and your server.
Routine Data Backup. Backup your site frequently to protect against data loss.
Routine Security Audits. Frequently validate your network security systems.
Security Protocols. Use two-factor authentication, authentication keys, and others.
Limit Admin Accessibility. Prevent unnecessary access to your site’s admin panel.
Magento Security Code. In addition to relying on built-in features, fortify your sales site.
Optimize Magento 2 Functionality
Magento site owners with adequate tech skills for the task can employ abundant customizations, extra features, third-party software components, and other high-data-consuming add-ons and still expect high performance from the platform.
If there is a decline in speed, one or more factors may be contributing to the slow-down. To optimize Magento speed and overall site performance, ensure that you have appropriate technology and that all these essentials are in place:
|
|
Troubleshooting Magento 2 Install Using Composer
Here are a few typical problems that can arise during Magento 2 installation and some suggested potential solutions:
- ERROR MESSAGE: “Could not open input file: composer.phar.” – If you are not running the command from the directory containing the ‘composer.phar’ file, download it from the Composer site and move it into the right directory.
- ERROR MESSAGE: “Fatal error: Allowed memory size of … exhausted.” – The PHP memory limit may be set too low. Try raising the limit in the php.ini file by adding this line: memory_limit = 2G. Or, run this line: -d memory_limit=-1 /usr/local/bin/composer install.
- ERROR MESSAGE: “Class ‘Locale’ not found.” – The PHP extension for the ‘intl’ package may not be installed. Try running the following command in the CLI: “sudo apt-get install php-intl.”
- ERROR MESSAGE: “The requested PHP extension ext-iconv is missing…” – The PHP extension for the ‘iconv’ package may not be installed. Run this command in the CLI: “sudo apt-get install php-iconv.”
- ERROR MESSAGE: “The requested PHP extension ext-mbstring is missing…” – The PHP extension for the ‘mbstring’ package may not be installed. Run this command in the CLI: “sudo apt-get install php-mbstring.”
Frequently Asked Questions
Here are a few of the most frequently asked questions about the Magento e-commerce software platform:
Can I install Magento on shared hosting?
Yes. However, it is recommended that you use a dedicated server or VPS for maximal performance. Magento utilizes resources intensively, so a shared server may not be sufficient for the robust delivery of resources necessary for optimal Magento functioning.
What is the difference between installing Magento 2 via Composer and manually?
Composer auto manages dependencies, which ensures compatibility and simpler installation. Manually installing means manually downloading and managing all needed files and dependencies, which is a more cumbersome process that lends to conflicts, incompatibility, etc.
How long does it take to install Magento 2?
Installing Magento 2 can be expected to take around 10 minutes if the server environment for it is correctly configured. Installation time varies by server speed and sample data adds.
What permissions should I set for files and folders?
Set directories to a permission of “775” (to read, write, and execute for the user, group, and others). Set most files to “664” (to read and write for the user and group, and read-only for others).
How do I troubleshoot Magento installation errors?
Check permissions, PHP extensions, and error logs. Clear the cache and the compiled code. Update Magento. Increase memory limit. Check the admin URL. Replace the htaccess file in the root folder if necessary.
Is the free Magento project community edition enough?
The free, open-source, self-hosted Magento Community Edition delivers the flexibility, rich features, and scalability of paid versions of the Magento e-commerce platform. It offers a smart option for small businesses to customize an online store to meet particular needs and optimize performance. With proper setup, your CE site can function as smoothly as the top Magento websites in the competitive marketplace of the World Wide Web.
Preparing to Launch Your Magento 2 Online Store
If you have followed the above steps, well done! Now you can operate your Magento 2 online store with superior functional efficiency, security, and competitive features that make an e-commerce site stand out from the crowd.
Magento’s powerful platform can help you scale your online business. Now you can customize your store site and add new revenue lines. Or, if you’re currently preparing to install Magento2 using the Composer or manual method, you’re on your way to creating a world-class e-commerce website.
Keep in mind that following all the steps for Magento 2 installation correctly is fundamental to avoiding coding errors, incompatibilities, and failure to obtain permissions, satisfy dependencies, or meet other requirements for successful installation of Magento 2.
The Transform Agency provides full-scope web development services for Magento 2 installation, performance optimization, and ongoing user support.
Written with the assistance of Sergey G.
Adobe Commerce Business Practitioner | Certified PSM & PSPO at TA
Sergey ensures project success by validating business cases, defining success metrics, and identifying sustainable benefits. His proactive approach leverages existing systems, processes, and data to deliver additional value. Serge excels in planning, executing, monitoring, and controlling all aspects of the project lifecycle, ensuring meticulous attention to detail and strategic oversight.
Sergey ensures project success by validating business cases, defining success metrics, and identifying sustainable benefits. His proactive approach leverages existing systems, processes, and data to deliver additional value. Serge excels in planning, executing, monitoring, and controlling all aspects of the project lifecycle, ensuring meticulous attention to detail and strategic oversight.