How to Install Magento 2 via GitHub
We’ve already mentioned the Magento 2 installation guide by Ivan Veres on our website. The author provides a brief description of how to install Magento 2 via three different methods: from archive file, via Composer, and via GitHub. We’ve also decided to share this information via our blog but in three separate posts, so on Firebear, you can already find out How to Install Magento 2 via Composer and How to Install Magento 2 from Archive File. And below, we shed light on the last method – installation via GitHub. It is not the easiest way to get Magento 2 installed, but if problems do not scare you, continue reading.
We show how to install Magento 2 on Linux Ubuntu 16.04 with PHP 7.0.7, Composer 1.1.2, and MySQL 5.7.12. A virtual host is necessary to rule all your Magento 2 installations. Ivan Veres says that his installations can be found here: http://m2.loc/2.07/.
Third, and the last one, is cloning or downloading release from GitHub repository.
Also note that below we avoid using Setup Wizard, so quickly skip the tutorial and choose another approach to installation if this one seems too scary. Consider the following information before going any further:
- Magento 2 will be installed through terminal.
- Core code will be stored under app/code.
- It will be impossible to update Magento 2 via admin.
Why were these difficulties even created? If you are a vendor or a marketer, there is no need to suffer such digital austerities. But in case you are a developer or a contributor, feel free to leverage Magento 2 GitHub releases to make the platform better or at least get a deeper insight on how thing are done beneath the hood. So, let’s start!
How to Install Magento 2 via GitHub
1. Clone Magento 2 repo from
2. Create a new empty directory.
3. Run the following command:
1 |
git clone git@github.com:magento/magento2.git |
4. Wait until the deployment is finished.
5. Enter the following command:
1 |
composer install |
6. Install Magento 2.
Below, you can see the example of the command that installs Magento 2. You should change base-url, db-name, db-password, admin-email, and admin-password. They should match your local setup.
1 2 3 4 |
php -f bin/magento setup:install –base-url=http://m2.loc/2.07/github/ --backend-frontname=admin --db-host=localhost --db-name=m2git --db-user=root --db-password=inchoo --admin-firstname=Magento --admin-lastname=User --admin-email=ivan.veres@inchoo.net --admin-user=admin --admin-password=magento123 --language=en_US --currency=USD --timezone=America/Chicago –use-rewrites=1 |
7. Open your browser and visit you local link (in our case it is http://m2.loc/2.07/github/).
8. If everything is ok, Magento 2 was installed successfully.
Now, let’s figure out what to do with sample data in case of Magento 2 installation via GitHub.
1. Go to your web root (it’s not magento2).
2. Run this command:
1 |
git clone git@github.com:magento/magento2-sample-data.git |
3. Then, go to the cloned Magento 2 directory.
4. Run the following command:
1 |
php -f dev/tools/build-sample-data.php -- --ce-source="your Magento CE install dir" |
Symlinks to your Magento 2 installation are created.
5. For Linux machine, set ownership and permissions:
1 2 |
chown -R :your web server group name find . -type d -exec chmod g+ws {} \; |
6. Clear cache (static files):
- Go to Magento 2 var/ folder
- Run this command:
1 |
rm -rf cache/* page_cache/* generation/* |
7. Run the following commands to install sample data:
1 2 |
php bin/magento setup:upgrade php bin/magento setup:di:compile |
For further information, visit the official