Skip to content

Instantly share code, notes, and snippets.

@artmouse
Forked from LTroya/magento_installation.md
Created August 5, 2019 18:01
Show Gist options
  • Save artmouse/1444903d77be13b6a6e168bb50497b6b to your computer and use it in GitHub Desktop.
Save artmouse/1444903d77be13b6a6e168bb50497b6b to your computer and use it in GitHub Desktop.
Magento 2 installation guide

Magento 2 installation guide

Nginx configuration

https://gist.github.com/LTroya/a5a570a651c81697b28fdbca65ea51c2

Clone the repository

composer create-project --repository=https://repo.magento.com/ magento/project-community-edition <install-directory-name>

Magento Marketplace Keys

Access: afd1cceaf20b5b98f23fe19a1a2b4fff
Password: 07b02eab676c8354e005718e40efba22

Installation guide

First, configure magento with the following command:

php bin/magento setup:install \
    --backend-frontname="admin" \
    --key="6f798255dfa145f15cbc9721901a8e68" \
    --session-save="files" \
    --db-host="mysql" \
    --db-name="igsgroup" \
    --db-user="root" \
    --db-password="root" \
    --base-url="http://igsgroup-stores.io/" \
    --base-url-secure="https://igsgroup-stores.io/" \
    --admin-user="admin" \
    --admin-password="admin123" \
    --admin-email="[email protected]" \
    --admin-firstname="Magento" \
    --admin-lastname="User"

Second, change deployment mode to developer:

php bin/magento develop:mode:set developer

Third, execute the following query to disable signing assets on development mode:

INSERT INTO core_config_data (path, value) VALUES ('dev/static/sign', 0) ON DUPLICATE KEY UPDATE value = 0;

Next, force assets deployments to be able to enter into the admin panel:

php bin/magento setup:static-content:deploy -f

Last, flush cache:

php bin/magento cache:flush

Permissions

cd <magento install directory>
find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
chown -R :www-data . # Ubuntu
chmod u+x bin/magento

Sample data installation guide

Install dependencies:

php bin/magento sampledata:deploy

Upgrade and compile new dependencies:

php bin/magento setup:upgrade && \
    php bin/magento setup:di:compile && \
    php bin/magento setup:static-content:deploy -f && \
    php bin/magento c:f

If the images not load, run this command:

php bin/magento catalog:image:resize

Flush cache:

php bin/magento c:f

Configure redis as cache and session manager:

# Enabling Redis for cache
php bin/magento setup:config:set --no-interaction --cache-backend=redis --cache-backend-redis-server=redis --cache-backend-redis-db=0

# Enabling Redis for Full Page Cache
php bin/magento setup:config:set --no-interaction  --page-cache=redis --page-cache-redis-server=redis --page-cache-redis-db=1

# Enabling Redis for session
php bin/magento setup:config:set --no-interaction --session-save=redis --session-save-redis-host=redis --session-save-redis-log-level=4 --session-save-redis-db=2

Assets configuration with gulp

Create your theme with its corresponding files (registration.php, composer.json, theme.xml). Then, activate it through admin panel.

Next, copy package.json.sample to package.json, add gulp depencies to package.json and copy gulpfile.js from this repo https://github.com/subodha/magento-2-gulp

Cannot make a new magento installation after uninstall and removing database

Add --clean-database flag to the installation in order to clean files and database that magento create after each installation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment