Installing Magento 2 on MageStack

During an AMA on Reddit, I was asked for some thoughts on Magento 2 - which did get me curious about just exactly what was required for Magento 2 to run on MageStack.

Historically, its worked out of the box, with nothing special required, so its interesting to see what the latest release requires.

Changing MageStack to Magento 2 mode

The only change required is that the stack defaults are changed from M1 to M2, so I quickly edited the vhost template to reflect the new release (customers should ask for this change),

...
DOMAIN_1[MAGENTO_VERSION]="2"

Then that's it. The stack is now M2 ready, so on to the installation.

Installing Magento 2

As www-data, change directory to the vhost for install,

cd /microcloud/domains/example/domains/example.com/http

Using mda we can grab the version we want to install with ease,

wget -O mda.phar --no-check-certificate https://raw.githubusercontent.com/sonassi/magento-download-archive/master/bin/mda.phar
php mda.phar

Select option 0,

[0]:    Ce-full

Then pick your release, I'm installing 2.1.7, option 38,

[38]:   2.1.7

Then finally I'm selecting the build with sample data,

[4]:    Magento Community Edition 2.1.7 with Sample Data.tar.gz

Once the archive has downloaded, extract it,

mv downloads/Magento-CE* .
tar xvfz Magento-CE*

Magento 2 will throw an error message if /tmp/session is missing, so create this,

mkdir /tmp/session

Then start the installer via command line (I've already created a DB and user),

php-7.0 bin/magento setup:install \
  --db-host=db1.i \
  --db-name=example_m2 \
  --db-user=example_m2 \
  --db-password=x \
  --admin-user=admin \
  --admin-password=x \
  --admin-email=info@example.com \
  --admin-firstname=Sonassi \
  --admin-lastname=Sonassi \
  --base-url=https://www.example.com/

After a few seconds, Magento is installed and that's pretty much it.