Option 1: Install Magento 2 with Composer
1) Install Composer
The first step is to install Composer if you haven’t already.
$ curl -sS https://getcomposer.org/installer | php
2) Install Magento
Run the following to install the version of Magento you would like. In our example below we are installing version 2.3.4.
$ composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.3.4 ./
3) Install Sample Data (optional)
For testing and demo purposes you can install the sample data. Do not run this for development of a site you will be using since you cannot uninstall the sample data. (Requires running with PHP 7+)
3) Run the Setup
Wizard Option for Setup
You can do this with the web setup wizard by going to your Magento URL and following the steps on screen. One note here is make sure to run this using Chrome incognito or your browser of choice’s private browsing option as if you have run this before, Magento will auto fill some options and cause errors such as “Unable to enable modules because of the following constraints: …” Also of note, I’ve had issues with this method where the progress bar get stuck at a percentage. If so, let it run for a little while to make sure it does in fact seem stuck after which it might have actually completed so try visiting your site to see if it’s working. See Magento 2 Install Stuck at 73% from Magento Stack Exchange for more details.
Command Line Option for Setup
The recommended method would be to run via command line using the command below. Update any text like <DB_USER> with the value you want to set.
$ bin/magento setup:install --base-url=https://magento.dev/ --db-host=localhost --db-name=mage2 --db-user=<DB_USER> --db-password=<DB_PWD> --admin-firstname=<ADMIN_FIRSTNAME> --admin-lastname=<ADMIN_LASTNAME> --admin-email=<ADMIN_EMAIL> --admin-user=<ADMIN_USER> --admin-password=<ADMIN_PWD> --language=en_US \--currency=USD --timezone=America/Chicago --use-rewrites=1 $ php -dmemory_limit=2048M bin/magento setup:upgrade $ php -dmemory_limit=2048M bin/magento setup:di:compile
If you find you are running into memory limits when running bin/magento, you will probably need to prefix all these commands with something like…
Option 2: Install Magento 2 with Git
Follow the github version of this: http://inchoo.net/magento-2/how-to-install-magento-2/