Magento, also known as Adobe Commerce and developed by Adobe, is one of the most powerful and flexible e-commerce platforms available. Magento gives you full control over how your store looks, operates, and scales as you build, manage, and grow whether you’re just starting out or running a large-scale operation,
You can customize everything from your product pages to your checkout experience, giving you the flexibility to create exactly the kind of shopping experience you want for your customers. Plus, it has a huge library of extensions and themes, so you can add new features and improve functionality whenever you need.
In this guide, we’ll show how to install Magento on your own server. We’ll walk you through the system requirements and installation process. You can also check out the installation review from the official docs here.
System Requirements
Before diving into the installation process, let’s quickly make sure your system meets the necessary prerequisites.
Generally, your server should be running a Linux distribution such as Ubuntu, CentOS, or Debian, and have some basic software installed. Here’s what you’ll need:
- Operating System: Any of the common Linux distributions, including RedHat, CentOS, Ubuntu, or Debian.
- Software: Most systems should already have tools like bash, gzip, lsof, tar, and sed. However, make sure you have MySQL or MariaDB installed as well, as you’ll need this for your database.
- PHP: Magento recommends PHP 7.3 or above. If you’re not sure which version you have, you can check by running: php -v in your terminal.
- RAM: 2GB is the minimum recommended for Magento. If your system has less than that, consider adding a swap file to handle temporary memory requirements, especially during upgrades.
If you’re unsure whether your system already has these, don’t worry—most of them are pre-installed on common Linux distributions. However, you’ll want to confirm that Composer is installed, as it’s necessary for managing dependencies.
Step 1: Get Your Authentication Keys
Before installing Magento, you’ll need to set up access keys in the Magento Commerce Marketplace. These keys allow you to securely access and download the Magento metapackage. Here’s how to get them:
Create an Account: If you don’t already have one, head to the Magento Commerce Marketplace and register an account.
Access Keys: Once logged in, go to your profile (top-right) and click Access Keys in the Marketplace tab.
Generate Keys: Click Create a New Access Key and give it a name (e.g., “Developer’s Key”). After that, your public and private keys will appear.
Use the public key as your username.
Use the private key as your password.
Once you have your keys, keep them handy. You’ll need them for the next steps!
Step 2: Set Up Magento with Composer
With your keys ready, you can now install Magento using Composer, a tool that will download and install Magento along with its dependencies.
Log in to your server: Make sure you’re logged in as the user that will own the Magento files (e.g., www-data or your-user).
Navigate to the Web Server Directory: Change to your server’s document root directory or the directory you’ve set as the virtual host docroot.
Then, use Composer to download the Magento package. If you’re installing Magento Open Source, run:
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition
For Adobe Commerce (the enterprise version), run:
composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition
When prompted, enter your public and private keys that you generated earlier. If you’ve configured your authentication keys in your auth.json file or environment variables, you won’t be asked for them.
Tip: You can specify a specific version of Magento by appending it to the command. For example, to install Magento 2.4.6, use:
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.6
Step 3: Set File Permissions
Magento needs the right file permissions to run properly. You’ll want to make sure the web server can read, write, and execute files in the Magento directories.
Run the following commands to set the necessary permissions:
cd /var/www/html/
find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
# For Ubuntu, replace www-data with your web server's user group
chown -R :www-data .
chmod u+x bin/magento
These commands ensure that your server has the appropriate permissions for the files it needs to execute and modify.
Step 4: Install Magento
Now, you’re ready to install Magento itself. Use the bin/magento setup:install command to begin the installation process.
Here’s an example:
bash
Copy
Edit
bin/magento setup:install \
–base-url=http://localhost/magento2ee \
–db-host=localhost \
–db-name=magento \
–db-user=magento \
–db-password=magento \
–admin-firstname=admin \
–admin-lastname=admin \
–[email protected] \
–admin-user=admin \
–admin-password=admin123 \
–language=en_US \
–currency=USD \
–timezone=America/Chicago \
–use-rewrites=1
base-url: Set the base URL for your site (e.g., http://localhost/magento2ee).
db-host: This should be set to localhost if you’re using a local MySQL server.
db-name, db-user, db-password: Provide your database details.
admin-user and admin-password: Set the credentials for your admin panel.
Tip: You can customize the Admin URI by adding the –backend-frontname option, but it’s recommended to leave this out for extra security. Magento will automatically generate a random admin URI, which is harder for attackers to guess.
Step 5: Final Touches
Once the installation completes, Magento will give you your Admin URI, which you can use to access the admin panel. After that, you can start configuring your store!
You can use the bin/magento command line tool to enable or disable cache, check system health, or update configurations. To get a list of available commands, use:
bin/magento list
If you ever need help with a specific command, use:
bin/magento help
For example:
bin/magento help setup:install
That’s it! You’ve successfully installed Magento Open Source on your server. From here, you can customize your store, install themes and extensions, and start adding products. Magento is highly customizable, so with a bit of development, you can make your store exactly what you need it to be. Learn more on the official documentation website.
Leave a Reply