Last active
January 21, 2019 17:12
-
-
Save guz-anton/5ec194762439c3763931d13052651b58 to your computer and use it in GitHub Desktop.
Install Magento 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name {}; | |
set $MAGE_MODE developer; | |
set $MAGE_RUN_TYPE website; | |
set $MAGE_RUN_CODE {}; | |
set $MAGE_ROOT /var/www/{}; | |
include magento-locations.conf; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "<Vendor>/<theme>", | |
"description": "N/A", | |
"config": { | |
"sort-packages": true | |
}, | |
"require": { | |
"php": "~7.1.3||~7.2.0", | |
"magento/framework": "*", | |
"magento/theme-frontend-blank": "*" | |
}, | |
"type": "magento2-theme", | |
"license": [ | |
"OSL-3.0", | |
"AFL-3.0" | |
], | |
"autoload": { | |
"files": [ | |
"registration.php" | |
] | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# 1. Create dirs | |
mkdir "../b.mtheme.gcp" | |
cd /var/www | |
sudo ln -s /home/webexample/work/b.mtheme.gcp | |
# 2 Create nginx config | |
cd /etc/nginx/sites-enabled | |
sudo cp ../sites-available/000-blank ../sites-available/010-b.mtheme.gcp.conf | |
sudo ln -s ../sites-available/010-b.mtheme.gcp.conf | |
cd ../sites-available | |
sudo sed -i 's/{host}/b.mtheme.gcp/g' 010-b.mtheme.gcp.conf | |
sudo sed -i 's/{folder}/b.mtheme.gcp/g' 010-b.mtheme.gcp.conf | |
sudo sed -i 's/{site}/mtheme/g' 010-b.mtheme.gcp.conf | |
sudo nginx -t | |
sudo service nginx restart | |
# 3 Composer create project | |
cd /home/webexample/work/b.mtheme.gcp | |
sudo rm -rf ./* | |
sudo rm ./.gitignore | |
sudo rm ./.htaccess | |
sudo rm ./.htaccess.sample | |
sudo rm ./.php_cs.dist | |
sudo rm ./.travis.yml | |
sudo rm ./.user.ini | |
ls -la | |
php /opt/composer/composer.phar create-project \ | |
--repository-url=https://repo.magento.com/ \ | |
magento/project-community-edition=2.2 \ | |
. | |
# 4 Mysql | |
sudo mysql -uroot -e ' | |
CREATE DATABASE `b_mtheme` | |
CHARACTER SET utf8 | |
COLLATE utf8_general_ci;' | |
sudo mysql -uroot -e ' | |
GRANT ALL PRIVILEGES | |
ON b_mtheme.* | |
TO user@localhost | |
IDENTIFIED BY "password";' | |
# GRANT SELECT, INSERT, UPDATE, DELETE, \ | |
# CREATE, DROP, REFERENCES, INDEX, ALTER, \ | |
# CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, \ | |
# CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, \ | |
# EVENT, TRIGGER \ | |
# ON `magento_local`.* \ | |
# TO magento@"localhost" IDENTIFIED BY 'magentoPass'; | |
# 5 Install Magento | |
cd /home/webexample/work/b.mtheme.gcp | |
php bin/magento setup:install \ | |
--base-url="http://b.mtheme.gcp/" \ | |
--backend-frontname="b" \ | |
--db-host="localhost" \ | |
--db-name="b_mtheme" \ | |
--db-user="user" \ | |
--db-password="password" \ | |
--language="en_US" \ | |
--timezone="UTC" \ | |
--currency="GBP" \ | |
--use-rewrites="1" \ | |
--use-secure="1" \ | |
--admin-user="user" \ | |
--admin-password="password1" \ | |
--admin-email="[email protected]" \ | |
--admin-firstname="A" \ | |
--admin-lastname="B" | |
# | |
cd /home/webexample/work/b.mtheme.gcp | |
sudo chown -R www-data:www-data var app/etc generated pub/static pub/media | |
sudo rm -rf var/* generated/* pub/static/* | |
# 6 Create a theme | |
cd /home/webexample/work/b.mtheme.gcp | |
mkdir -p app/design/frontend/Vendor/CheTheme | |
cd app/design/frontend/Vendor/CheTheme | |
# | |
# | |
cp /home/webexample/work/mtheme/composer.json composer.json | |
cp /home/webexample/work/mtheme/theme.xml theme.xml | |
cp /home/webexample/work/mtheme/registration.php registration.php | |
pwd | |
sed -i 's/<Vendor>/Vendor/g' composer.json | |
sed -i 's/<theme>/CheTheme/g' composer.json | |
sed -i 's/<Vendor>/Vendor/g' theme.xml | |
sed -i 's/<theme>/CheTheme/g' theme.xml | |
sed -i 's/<Vendor>/Vendor/g' registration.php | |
sed -i 's/<theme>/CheTheme/g' registration.php | |
mkdir media | |
cp /home/webexample/work/mtheme/media/preview.jpg \ | |
./media/preview.jpg | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
\Magento\Framework\Component\ComponentRegistrar::register( | |
\Magento\Framework\Component\ComponentRegistrar::THEME, | |
'frontend/<Vendor>/<theme>', | |
__DIR__ | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd"> | |
<title><Vendor> <theme></title> <!-- your theme's name --> | |
<parent>Magento/blank</parent> <!-- the parent theme, in case your theme inherits from an existing theme --> | |
<media> | |
<preview_image>media/preview.jpg</preview_image> <!-- the path to your theme's preview image --> | |
</media> | |
</theme> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment