Install Magento 2 via command line

Sometimes (especially on shared hosting) Magento 2 web install just isn’t work – there is a plenty of reasons, but this post will not cover this topic, it’s about how to install Magento 2 via command line. So here is a simple shell script and hints to add some tuning to your install.


First of all you need to set correct file permissions. Per Magento recommendation change directory to you magento2 install root, then change ownership and file permissions:

Hint: also check Vinai’s gist


Now it’s time to install magento:

Tune your installation

If you’re using xdebug there is a known issue, so you want to change installer first line just like this:

If you have any special chars in db password – make sure to escape them:

If you want to use secure URL on backend – just add next option:

If you using a sample data just add this:

Full list of install options could be found in Magento 2 devdocs. Hope that helps.


Install Magento 2 via command line
5 (100%) 3 vote[s]

What do you think?

Required fields are marked *