Magento 2 installation guide

Magento 2 installation guide
Posted in: Magento 2 Guides

A long-waited Dev Beta of Magento 2 (0.42.0-beta1) appeared on Magento repository today. Of course we couldn’t sit still and installed Magento 2 on our server. And described the installation process for you, including the Magento 2 installation errors we dealt with and how we fixed them.

Precheck

The first steps lead us to the installation guide page. It is highly important to check whether your server suits minimal Magento 2 requirements: Apache: 2.2 or 2.4 PHP: 5.5.x or 5.6.x MySQL: 5.6.x Composer As Amasty servers work on Debian Wheezy, we installed Percona Server 5.6 so the server suits minimal database requirements, and we already have a server with PHP 5.5.x support. Also you’ll need Git and Composer, install it if you haven’t done it before. Use these commands for Debian Wheezy with root user permissions: [php]apt-get update apt-get install git wget wget -O /usr/local/bin/composer http://getcomposer.org/composer.phar chmod +x /usr/local/bin/composer[/php]

Magento 2 download

Now it’s time to clone Magento 2 code from GitHub repository. http://magento2.local/ is the URL of our website, and the document root is /var/www/magento2. Use these commands if you don't plan to install Sample data for Magento 2: [php]cd /var/www git clone https://github.com/magento/magento2.git cd /var/www/magento2 composer install[/php] If you plan to install Sample data - refer to this link for details. As for now Magento 2 is still under development, the best variant is to read the latest documentation at Magento docs.  [Progress: 269 / 272] Installing sample data: [MagentoFrameworkExceptionLocalizedException] Area code is already set Thus, we advise to monitor known Magento 2 issues and submit bugs if you notice any.

File permissions

'Admin' user is the owner of all magento files on our server, and Apache web server runs on behalf of 'www-data' user. Magento 2 documentation describes the access permission settings for files and directories on the principle that the web server runs on behalf of the user which is the owner of all Magento files. Our opinion is: it’s not the best decision, as it can lead to security issues (as the web server has permissions to write and run the code) as well as issues with setting access permissions for third party developers (as you’re not logging in as www-data user). We normally use the following access permissions: [php]chown -R admin:www-data /var/www/magento2 find /var/www/magento2 -type f -print0 | xargs -r0 chmod 640 find /var/www/magento2 -type d -print0 | xargs -r0 chmod 750 chmod -R g+w /var/www/magento2/{pub,var}[/php] If you’re going to install Magento from the web interface, then add write permissions for app/etc/ and vendor/: [php]chmod -R g+w /var/www/magento2/{app/etc,vendor}[/php]

Database

We created an empty database on our new Percona Server 5.6 (mysql56.local), and most probably you’ll need to replace the values with your own ones: [php]echo 'CREATE DATABASE `magento2` DEFAULT CHARSET utf8 COLLATE utf8_general_ci; GRANT ALL PRIVILEGES ON `magento2`.* to `magento2`@`%` IDENTIFIED BY "magento2";' | mysql -h mysql56.local -u root -p[/php]

Magento2 installation

The first time we tried to install Magento 2 using the web interface, but the process froze on 93%. The second installation was conducted from CLI, and we got an error: [php]PHP Fatal error: Maximum function nesting level of '100' reached, aborting! in /var/www/magento2/vendor/zendframework/zend-code/Zend/Code/Scanner/DocBlockScanner.php on line 201[/php] This is a known issue, and it is connected with xdebug PHP extension, which is installed on our server. To fix this mistake we set xdebug.max_nesting_level = 500. The result was Magento 2 installation with no problems using the following command: [php]cd /var/www/magento2 php -d xdebug.max_nesting_level=500 -f bin/magento setup:install --base_url=http://magento2.local/ --backend_frontname=admin --db_host=mysql56.local --db_name=magento2 --db_user=magento2 --db_pass=magento2 --admin_firstname=Local --admin_lastname=Admin --admin_email=admin@example.com --admin_username=admin --admin_password=adminpswd --language=en_US --currency=USD --timezone=America/Chicago[/php] If you use xdebug as we do, add the following lines to the /var/www/magento2/.htaccess file: [php] php_value xdebug.max_nesting_level 500 [/php] If everything is correct, you will be able to log in the Magento 2 backend at http://magento2.local/admin/. UPD We're updating the article as we dig into installation of Magento 2 and Sample data. UPD 2 Please mind that this article is outdated as there's a new and easier process of installing Magento 2.

Thinking of how to start with Magento? Talk to our expert, book a free consultation or/and hire our developers to install Magento.

December 18, 2014
January 12, 2015
December 17, 2014
Comments
Olga
December 18, 2014
You're so fast! It was released just yesterday and you have so great report already. Thanks! It helps to find out what issues other people face with comparing to Magento team, which works with these tools every day. I just have small note. "chown -R admin:www-data /var/www/magento2" It means that you make user "admin" and group "www-data" owners of the files. "www-data" is not a user in this context, so it will work as far as your Apache user is in "www-data" group. It's little bit different than you describe in the explanation. In Magento documentation it's described as "Magento files and directories should be owned by the web server user". Maybe it can be rephrased somehow, the intent was to say that Apache user should have access to the files - "write" for some of them and "read" for all others. In your case Apache user owns the files because he is in "www-data" group, while it's not a real owner. And a question: you say "add write permissions for app/etc/ and vendor/". Could you, please, tell why did you need write permissions to "vendor" directory? Does installation fail, if "vendor" is not writable? Thanks
Reply
Andrey Tataranovich
December 19, 2014
Hi, and thanks for such a great comment! Regarding the user group question – you’re right, and thanks for pointing this out, I’m sure it will be helpful for all those people who’ll come and read the article. As for the second question – I couldn’t find an appropriate description of the directory to give write permissions for and took the information from one of the tickets here https://github.com/magento/magento2/issues/791#issuecomment-66433673 As the release is very fresh the documentation is still far from ideal and many descriptions need details – but the Magento guys pointed out that they will do their best on keeping the documentation up-to-date and precise in the future.
Richard Ireland
December 22, 2014
It's good to know Amasty are on top of Magento 2.0. Any official news on upgrade costs/procedures for existing Amasty customers? I am a big fan of your extensions, and was planning to recommend to a client they purchase some more in the next few weeks. However if they will need to purchase again after a migration to Magento 2.0 I may tell them hold off for a while.
Reply
Ksenia Dobreva
December 22, 2014
Hi, thanks for the question and the kind words! Unfortunately, it is still Developer Beta and we’re in the process of digging in Magento 2. It is still too early to speak about transition to Magento 2 for merchants. According to Elena Leonova from the Magento team (you can see more at https://amasty.com/blog/magento-2-news/) Magento 2 Merchant release is planned in the 4th quarter of 2015, so it’s at least a year before merchants will be able to use the new version to its fullest. Taking these facts into account, I doubt it's worth waiting a year or even more. (If your clients need new features right now or in the nearest future, don’t forget to send them the coupon code – it’s valid till December 28, details here https://amasty.com/blog/merry-christmas-20-off-on-all-extensions/). We updated our terms on Magento 2 support: https://amasty.com/terms-and-conditions.html «Updates for Magento of 2.X.X versions will not be provided for free even if the period of free updates and support will still be running. (…) Magento 2 will be a completely different solution in terms of architecture and will be incompatible with all extensions developed for Magento of 1.X.X versions, including the ones provided by Amasty. Due to this extensions for Magento 2 will need to be developed from scratch and will be treated as completely new extensions, not as new versions of extensions developed for Magento of 1.X.X versions.» Hope that helps. Will be happy to add anything in case you have any other questions.
Vincent ANDRE
January 20, 2016
is that still too early to talk about those upgrade costs and procedures?
yogi
December 25, 2014
have you installed the magento2 successfully? how i can run magento2 under ubuntu with index.php?
Reply
Ksenia Dobreva
December 29, 2014
Hi Yogi! Yes, we have installed Magento 2 successfully. Our instruction is adapted for Debian - so it should work with Ubuntu.
Dennis
April 28, 2015
I've tried it several times but when I want to install the sample-data-patch I always get this error: patch -p1 < magento2-require-sample-data.patch patching file composer.json Hunk #1 succeeded at 7 with fuzz 2. patch unexpectedly ends in middle of line Hunk #2 FAILED at 36. 1 out of 2 hunks FAILED -- saving rejects to file composer.json.rej I've been trying this with Magento 0.74.0-beta6 Any ideas?
Reply
Ksenia Dobreva
April 29, 2015
Hi Dennis, sorry for that, but looks like our instructions became irrelevant with time - things have changes since December. We will consider writing a new post.
Tony
May 13, 2015
Hi, I have installed magento version 2.0 successfully but when go to admin I don't click on any thing Can you help you ? Thank a lots! Regards Tony
Reply
Ksenia Dobreva
May 14, 2015
Hey Tony, thanks for asking. Unfortunately, we couldn't reproduce your bug... Please make sure that your server is equipped according to minimal Magento 2 requirements (pay special attention to the PHP version). If everything is okay with it, and the installation process went without mistakes, but the interface is not working, it can be a good idea to try to install Magento once more, and if the same problem appears, to submit a bug to Magento 2. Hope that helps.
Shawn Adams
August 6, 2015
If we use docker this image clearly help us install magento 2 https://hub.docker.com/r/ilampirai/docker-magento2/ share your thoughts ?
Reply
Ksenia Dobreva
August 12, 2015
Hi Shawn, I've consulted with my colleagues on that question, and they say for now this is more a playground than a way that could be used for staging/production usage. Hope that helps!
sam
August 20, 2015
can you help me how to install magento 2 under ubuntu machine. ? 1. In which directory i need to download composer ? Thanks
Reply
Ksenia Dobreva
August 20, 2015
Hi Sam, thanks for asking. sudo wget -O /usr/local/bin/composer http://getcomposer.org/composer.phar sudo chmod 0755 /usr/local/bin/composer Hope that helps!
Duc
October 29, 2015
Hi, I follow your link to install sample data : but when i finish and reload my page, it don't have anything, just same before i intall sample data. When i am wrong? Can you show me how can install sample data after install magento 2. I installed but nothing.
Reply
Ksenia Dobreva
October 29, 2015
Hey Duc, thanks for asking. Unfortunately, we can't help you right now because things change every time Magento rolls out a small update of version 2, and any instructions can't be stable at all. I think we will be ready to give some steady recommendations when the second version is officially out, but now any instructions usually expire very fast. I think now the best place to ask your question is this topic on Magento forums: https://community.magento.com/t5/Installing-Magento-2/bd-p/installing-magento-2 Hope that helps!
faran
November 25, 2015
Hi, I am facing the problem in ubantu that when I goto directory cd /var/www/magento2 and run composer install, it gives me the following error: [Composer\Downloader\TransportException] Invalid credentials for 'https://repo.magento.com/archives/magento/composer /magento-composer-1.0.2.0.zip', aborting. Kindly let me know which credentials to use and how to resolve this. Will be really helpfull. Thanks
Reply
Ksenia Dobreva
November 25, 2015
Hi Faran, thanks for asking. It's a pretty old instruction, now you can download Magento as an archive from here https://www.magentocommerce.com/download and install it much easier. Our instruction was valid before the official release. Hope that helps!
Jaime
November 30, 2015
I have followed instructions in your page, however, installation always get stuck and different percentages, for example, I have just tried again, it was stuck at 71%. I am using Web Interface. I tried composer and this was shown: Problem 1 - magento/framework 100.0.2 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system. - magento/framework 100.0.2 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system. - Installation request for magento/framework 100.0.2 -> satisfiable by magento/framework[100.0.2]. I tried even this command: php -d xdebug.max_nesting_level=500 -f bin/magento setup:install --base_url=http://commerce.gestionx.cl/ --backend_frontname=admin --db_host=localhost --db_name=gestionx_commerce --db_user=gestionx_comuser --db_pass=C0MM3rc3Db --admin_firstname=Administrador --admin_lastname=Local --admin_email=webmaster@commerce.gestionx.cl --admin_username=administrador --admin_password=4dm1nM4g3nt0 --language=es_CL --currency=CLP --timezone=America/Santiago But this does simply nothing. Command returns immediately with no error. I cannot use any installation method. Can you please tell me what might be happening here? Thanks Jaime
Reply
Ksenia Dobreva
November 30, 2015
Hey Jaime, this instruction is a bit outdated, it was valid before Magento 2 general availability release. Try installing php5-mcrypt and installing the package from Magento website https://www.magentocommerce.com/download Hope that helps!
Paolo
March 16, 2021
The article is unreadable! You must somehow structure the information in the article!
Reply
Vladimir Derachits
March 16, 2021
Sorry for having a problem with this article. It's quite outdated and we'll see what we can do to avoid confusion about this article in the future.
Leave your comment

Your email address will not be published

This blog was created with Amasty Blog Pro

This blog was created with Amasty Blog Pro

© 2009-2022 Amasty. All Rights Reserved.