The following is a guide to successfully using the Magento command line tools on our latest Magento 2 compatible VPS & Managed Dedicated servers. This guide is intermediate, and assumes that you’re comfortable using an SSH client to connect to your webspace and input the mentioned commands as specified.

Your first step is to enable shell access to your domain. In order to do this, carry out the following steps:

Enabling shell access to your domain

1) Log in to your Plesk 12.5 hosting control panel

2) Click on ‘Domains’ in the left-hand menu to bring up your domain list.

3) Click the domain you have Magento 2 installed on to bring up its Plesk Dashboard, and click on ‘FTP Access’ to view your FTP user(s).

4) Now click on your FTP user, so that we can enable SSH access to your domain for that user.

5) Now set ‘Access to the server over SSH‘ to ‘/bin/bash‘. Lastly, if you’ve forgotten your FTP username and password for your domain (which is the same as your SSH username and password) then reset it in here now, and make a note of it as you’ll need it next. Please make sure your password is a strong password before moving on to the next step here in the guide.

6) Click ‘OK’ and SSH access is now enabled for your domain.

7) Lastly you need to allow SSH access through your Plesk Firewall, which is disabled by default. Click ‘Tools & Settings in the left-hand menu of your Plesk Panel.

8) Click ‘Modify Plesk Firewall Rules’ at the top of the page, then scroll down and click on SSH (secure shell) server.

9) You will now be presented with the action options ‘Allow’, ‘Deny’ and ‘Allow from selected sources, deny from others’. We always recommend ‘Allow from selected sources, deny from others’ and then adding just your IP address.

You can find the IP you need to add by visiting https://www.whatismyip.com/ . Please note that if you don’t have business broadband, there is a likelihood that your broadband IP will change if your router is disconnected. In that event, you may need to follow this process again.

Once you’ve found and added your IP as above, you should now be able to connect to your domain over SSH with no problems.

Using The Magento 2 Command Line Tools

1) If you haven’t already got it get Putty and open the download (Windows),or if you are using Mac OS x/Linux then open your terminal app (Open Spotlight, start typing “Termin…” and it should come up).

2) Now do the following:
Windows users (Putty)
Input the ‘Host Name’ as yourdomain.com (being the domain you wish to connect to). Then leave everything else and click open. If everything above is correct you’ll be asked for a username and then password. Use your ftp username and password from step e) above to login.
OS x/Linux users (Terminal)

Type:

 

If everything in the setup stage was correct you’ll be asked for your password. Input your ftp password from step e).
NB If your domain isn’t currently pointing at your server yet you’ll need to login to your Plesk control panel and go to your domain dashboard and use the ip mentioned there as your hostname.

3) You should now be logged into the shell, we now need to make sure that Magento 2.0 uses the correct version of PHP when running the Magento 2 Command Line Tools. Run the following command to go to the users home directory:

4) Now you’re definitely in the users home directory run the following:

5) Lastly check the php version being used by the shell is the correct version by typing:

6) If the version is correct it the output should contain reference to PHP 5.6.x as below

7) Now that is all set all you need to is go to the /bin directory in your Magento 2 install as follows:

8) You are now ready to run Magento command line tools for example to reindex your products you would run the following:

More Magento Command Line tools can be found in the Magento 2 documentation http://devdocs.magento.com/. Hope this helps. Please let us know your experiences with the tools below.

Subscribe to RSSShare on Google+Share on LinkedInShare on StumbleUponShare on TumblrShare on FacebookTweet about this on Twitter