How to install Magento

How to Install Magento

Preparation

Download Magento2 Community Version

First and foremost, you need to register with Magento to use their community version of Magento. Sign up to Magento here and they will send you the verification email. Do not forget to verify it. Now go to community version download page and download the Magento version that you want. For this tutorial, we will be using Magento 2.1.3. Download the tar.gz or tar.bz2 version of Magento for smaller file size.

Transfer Downloaded File to Server

You can use multiple ways to transfer your Magento files to your server. You can upload the Magento files using :
* scp command.
* FileZilla via SFTP.

It depends on you whether you want to decompress the file first or not. For us, it is easier to upload a single file and do the decompression inside our server. Incase anything goes wrong, we will still have our original Magento.

To upload the file using scp command, simply use the command below:

scp Magento-CE-2_1_3_tar_gz-2016-12-13-09-08-39.tar.gz runcloud@<ip address>:~/

Change the <ip address> to your server’s IP address or you can also use the server hostname. The Magento-CE-2_1_3_tar_gz-2016-12-13-09-08-39.tar.gz is the file that we have downloaded.It’s advisable to understand what does the command do rather than only copy & paste it.

Creating The Web Application

Now login to your RunCloud Panel and create new Web Application. Fill the fields required as shown below.

For the domain name, if you don’t have any, just put any domain name with .dev extension. For example, you can use magento.dev or mymagento.dev. And then set your web application as default web application inside RunCloud. So that you can access your Magento using server’s IP Address.

If you have a domain name, point your A record to your server’s IP Address. Make sure that you are using php 7.0 since Magento did not support php 7.1 yet.

Summary :

Field Name Description
Web Application Name Give your web application a name. E.g., magento
Domain Name We will use direct IP for now so just any domain. E.g., magento.dev
User Choose runcloud (default)
Public Path Leave it as it is
PHP Version Choose PHP version that you like, in our case PHP 7.0

Add SSL/TLS to Magento Web Application (optional)

You can also add SSL/TLS to your Magento web application. You can follow the tutorial here. Do not enable the HSTS yet.

Creating The Database

Head to database section inside RunCloud panel and create new database for the Magento. I am using magento for both database and database username. Don’t forget to use password generator as the best password is the password that your don’t remember.

Decompress Your Magento

Now login to your server using SSH and move your Magento .tar file inside your web application that you have just created and untar the file.

ssh runcloud@<ip address>
cp Magento-CE-2_1_3_tar_gz-2016-12-13-09-08-39.tar.gz webapps/magento
cd webapps/magento
tar -zxvf Magento-CE-2_1_3_tar_gz-2016-12-13-09-08-39.tar.gz

Now you can open the Magento web application inside your browser with the domain name that you have added or using server’s IP Address (if you already set it as default web application).

Installation

Magento by default will try to use TLS. When you click on the the start readiness check, you will see a bunch of error messages. Don’t worry because we will fix that.

Fixing Magento Error

Now you need to edit the composer.json inside your Magento using Vi or Nano. nano composer.json and find the line with “config”: { and add the disable-tls”: true under the configucation as shown below:

"config": {
    "use-include-path": true,
    "disable-tls": true
},

Save the composer.json file and start the readiness check again. Now you will see the check is now pass.

Setting Up Database

In the database section inside Magento installation, use 127.0.0.1 as the database host like the image shown below. Basically, during this step, you just need to use the information that you filled when you create the database in previous step.

Field Name Description
Database Name Give name to your database. E.g., magento
Database User Give name to user that will access to the database. E.g., magento
Password Insert database password here. However, it’s recommended to use password generator to create a strong password
Verify Password Insert the same password you have placed in the previous field

Web Configuration

The web configuration inside Magento installer should look like the image below. You also can enable the HTTPS for storefront and admin section if you have added the SSL/TLS to your web application.

After that, just click next and everything is pretty straight forward. Now, run the installation and wait for it to complete.

Fixing The Assets

When you login into Magento admin, the crap happen again. Yeah, the image and javascript doesn’t load at all like the image below.

Well, not a problem because it is an easy fix. Make sure you are still inside the Magento web application directory inside the SSH. If not, change the directory to the Magento web application. Now run the command below:

php bin/magento setup:static-content:deploy

Please wait a few moments while the Magento is fixing the assets. After the command is completed, you can refresh your browser and your Magento admin is now fixed.

Setup Magento Cron

We are not done yet. This is the last part of the Magento installation. If you see at the top right corner of the Magento Admin, there is a message for you to run the cron for the Magento. There are three cron jobs that should be running to use Magento.

* * * * * <path to php binary> <magento install dir>/bin/magento cron:run | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log
* * * * * <path to php binary> <magento install dir>/update/cron.php >> <magento install dir>/var/log/update.cron.log
* * * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run >> <magento install dir>/var/log/setup.cron.log

Now you have to replace the <magento install dir> with your magento installation folder. If you are following this tutorial closely, the installation folder should be /home/runcloud/webapps/magento. If you are using other web application name or other user, you can go to web application summary inside RunCloud and your <magento install dir is your root path.

The cron job command should look like this:

* * * * * <path to php binary> /home/runcloud/webapps/magento/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /home/runcloud/webapps/magento/var/log/magento.cron.log
* * * * * <path to php binary> /home/runcloud/webapps/magento/update/cron.php >> /home/runcloud/webapps/magento/var/log/update.cron.log
* * * * * <path to php binary> /home/runcloud/webapps/magento/bin/magento setup:cron:run >> /home/runcloud/webapps/magento/var/log/setup.cron.log

Now it is time to add the cron job to RunCloud. Go to cron job inside the RunCloud panel and add it one by one. This time, please omit the <path to php binary>. After you have filled the cron job fields, it should look like this.

Then, the cron job listing should look like this inside the RunCloud after you have fill in all three cron commands.

Please wait for one minute then refresh your Magento Admin dashboard and you should see the system message is gone. That’s all. Now you can start tweaking your Magento or you may start selling right away.

Share This On
Share on facebook
Share on twitter
Share on linkedin
Share on reddit

1 thought on “How to install Magento”

Leave a Comment

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

You May Also Like