How to Install Magento eCommerce Software for Your Business

What is Magento?

No, not the metal-manipulating Super Villain from the X-Men comics. Magento is one of the most popular open-source eCommerce platforms for businesses on the internet. Built on the Zend Framework and written in PHP, Magento is the “world’s leading platform for open commerce innovation.” Magento Partners include a diverse portfolio of small, medium, and large businesses across the globe for B2B and B2C clients.

According to kinsta.com, Magento accounts for approximately 0.8% of all websites built on the internet, making it the 9th most popular CMS in the world, and comprising more than 187,500 live websites. If you’re a small business or burgeoning eCommerce solution requiring scalable shopping cart software that supports multiple payment gateway options, Magento may be the platform for your needs. Let’s get started!

Preparing Your Server to Install Magento

First things first, you will need a hosting environment to install Magento in. You can choose a cPanel Partner for hosting or select a hyperscaler to build a virtual environment to host your Magento website. For the installation method, we’re discussing today, root access (which includes WHM) will be required.

You will need to make sure cPanel & WHM is installed on your server. Many hosts automatically set this up when you create your virtual server with them. If they don’t, you can read our step-by-step documentation for installing cPanel onto your server.

This image shows the EasyApache 4 interface

Configuring EasyApache 4 with Magento

Our next step will be to make sure EasyApache 4 is compatible with Magento in order to prepare your hosting environment properly. Follow these steps to ensure the process is successful.

  1. From WHM, choose the option, “EasyApache 4.” (Home » Software » EasyApache 4).
  2. Once there, click on “Customize” next to “Currently Installed Packages”.
  3. Next, click on “Apache Modules” and search mod_version and as well mod_env and enable these options, then click “Next”.
  4. The next section is titled “PHP Versions,” and no action is required here. Click “Next”.
  5. In “PHP Extensions,” we will need to enable a number of options. Using the search feature, please find and enable the following PHP Extensions (please note, you are only required to use the extensions for PHP 7.2):
    1. intl
    2. soap
    3. zip
  6. After you have enabled the extension for each of the above, click on “Next.”
  7. “Ruby via Passenger” is the next page, and no changes are required here so you can proceed ahead.
  8. Next, we will review the final changes before making the update.
  9. If everything seems correct, click on “Provision” at the bottom of the page. Please note: these changes are rather substantial, so be aware this will take a few minutes.
  10. Once this is done, click on “Done” at the bottom of the page.

Creating Your First cPanel Account in WHM

Now that EasyApache is appropriately configured, let’s create a cPanel account to set up a Magento installation.

This image shows the EasyApache 4 interface

As we mentioned before, Magento requires PHP 7.2 or 7.3, and the PHP version must be set manually after the cPanel user is created if your server is running a version older than 7.2 or 7.3 (to see what version of PHP your server is running, you can run php -v from the command line on your server, or create a phpinfo page. To change a user’s PHP version, go to (WHM » Home » Software » MultiPHP Manager) and search for your user from the list of users and domains. After the cPanel user account is created, you can access the account by adding ‘/cpanel’ to the end of the domain (i.e., testingsite.com/cpanel).

Now, sign in to the account using the username and password credentials you just created. Then, click “MySQL® Database Wizard.” where we will create a MySQL database that Magento requires to work properly.

This image shows the MySQL Database Wizard
  1. Enter a name for your database. For this tutorial, we’ll use the database name “magento.” Make a note of the prefix (the name that appears to the left of where you enter your database name, typically this is the cPanel username)
  2. Next is to create the username (we’re using “magento” as the username)
  3. Provide a password for this user and save it in a secure location. You are required to enter this information for our Magento installation.
  4. Check the box to enable “ALL PRIVILEGES.”
  5. Click on next and finally return home.

Our next step is to download the Magento software. For the sake of this walkthrough, we are going to be using Magento version 2.3.4. You should be able to find this version on Magento’s download page. Please download the file in a standard zip format (the first option).

We need to transfer our Magento zip file to our server. We are going to do this using cPanel’s File Manager. Return to your cPanel account and go to the “File Manager.”

How to Install Magento eCommerce Software for Your Business

Once there, double click on “public_html” and then click on “Upload” from the top toolbar. Select the Magento 2.0 zip file you downloaded.

Please note that in this example, we are installing directly in public_html (primary domain). If you prefer to install this onto a subdomain, you can do this by adding the subdomain inside of your cPanel account and then uploading the Magento Zip file to that subdomain’s folder in your file manager.

Once the upload is complete, open your terminal. For this next section, you’re going to need to SSH as the root user to your server and operate as the cPanel user your Magento installation is located at:

bash-4.2$ ssh root@your.server.IP.here
root@127.0.0.1's password:
Last login: Tue Jan 28 09:44:53 2020 from *.*.*.*
root@testingmagento# su cptechs
[cptechs@testingmagento centos]$

Now, change to the directory that you have the Magento zip file. For example, as my Magento zip file is in my ‘public_html’ directory, I used the command:

cd /home/cptechs/public_html/

Run the command “ls” to confirm the Magento file is in this directory. For example:

[patrickstar@testing-magento public_html]$ ls
cgi-bin  Magento-CE-2.3.4-2020-01-16-11-19-26.zip

Now, we are going to unzip the file. Enter the command ‘unzip,’ then enter ‘M’ and press the tab key. This should complete the line, and it should appear as below:

[patrickstar@testing-magento public_html]$ unzip Magento-CE-2.0.18-2018-02-23-02-07-53.zip

The file will unzip. When this finishes, please run these 3 commands in the order that I have presented for you:

find var generated vendor pub/static pub/media app/etc -type f -exec chmod u+w {} +

find var generated vendor pub/static pub/media app/etc -type d -exec chmod u+w {} +

chmod u+x bin/magento

Magento’s developers wrote this command, and it corrects the necessary permissions to use the files created. Lastly, we have one final terminal change to make. Please run the command ‘exit’ to return to the root user. For example:

[cptechs@testingmagento centos]$ exit
exit
[root@testing-magento ~]#

Next, please run the command:

vi /opt/cpanel/ea-php72/root/etc/php.ini

Now that you are using vi (a Linux text editor), type the following: /always_populate and press enter. You are taken to this line:

This image is a text editor showing contents of php.ini

Under this line, we need to add a new rule. To do this, press ‘i’ on your keyboard to edit “INSERT” mode. Please add this line of text.

always_populate_raw_post_data = -1

The new configuration should look like this:

This image is a text editor showing contents of more of the php.ini file

Now to exit ‘vi,’ please enter the following, hit the Esc, type :wq , and then press enter to exit the text editor, then check your website (If you used a different subdomain, you would go to yourwebsite.com/subdomain/setup)! We should now be greeted with the Magento Setup Wizard. Please proceed as necessary.

This image shows the Magento Installer readiness check

1.) Readiness Check – You should be greeted with all Greens!
2.) Enter your database details as you did inside of cPanel. (Please keep in mind, you must also enter the ‘prefix’ for your username. For example username_magento)

This image shows the "add a database" step of the Magento installer

3.) You can leave this as default. (Make sure you copy and keep your Magento Admin Address for later use)
4.) Enter your store details, such as the time zone and currency used.
5.) Create your admin account for the Magento plugin. Make sure you keep these credentials in a safe and secure location and keep them handy.
6.) Install Now: Stand by and let the installer finish its course:

This image is the Magento installer showing a successful installation.

When finished, click on “Launch Magento Admin” to sign in to the Magento Admin User. Your website is ready for eCommerce!

Installing Magento onto a cPanel server can be a bit tedious, but very worth it for the eCommerce infrastructure that it provides. The next step on your journey is building out your brand new eCommerce site! The Magento Community has a wealth of resources for the new and expert user alike. If you would like to reference the Magento documentation, you may do so here. Finally, if you have any questions, or would like to continue discussing this topic, please make sure to join us on our official Discord channel, our cPanel Subreddit, or our official Forums!

Previous Post
Business Email Hosting – Using cPanel Webmail for Your Email Accounts
Next Post
Creating Connections in Quarantine

Get Online Today!

  

Your perfect domain name is waiting!

Search our huge portfolio for more domain name extensions and pricing below
domain name extensions

Classic Domain Names

.COM | .AU | .CO | .NET | .BIZ | .ME | .EU | .ASIA | .TV | .MOBI | .NAME | .INFO | .ORG | .US | .NL| .FM | .HK | .ES | .CO.NZ | .DE | .CO.UK | .RU | .IM | .PM | .TW | .FR | .CN | .CA | .CH | .VN | .PL | .IL | .JP | .KR |