Created
June 17, 2020 18:36
-
-
Save medigeek/e89f83ff8b2fe52b75864ca96cc55421 to your computer and use it in GitHub Desktop.
magmi m2 magento2 semi-automated installation
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
#Where to install magmi (symlink to vendor/macopedia/magmi2/magmi folder) | |
MAGMIFOLDER="yourmagmifolder" | |
#find the version you want using: composer show --all macopedia/magmi2 | |
MAGMIVERSION="v200.7.26" | |
composer require macopedia/magmi2 $MAGMIVERSION | |
ln -s vendor/macopedia/magmi2/magmi $MAGMIFOLDER | |
ls -l $MAGMIFOLDER | |
#protect magmi from listing indexes | |
echo 'Options -Indexes' > $MAGMIFOLDER/.htaccess | |
# You can now login to your url: | |
# https://example.com/$MAGMIFOLDER/web/magmi.php | |
# Default user: magmi | |
# Default pass: magmi | |
# You can edit the global parameters with the default magmi user, | |
# or continue below to | |
# generate magmi.ini credentials | |
DBHOST=$(php -r '$f = require_once "app/etc/env.php"; echo($f["db"]["connection"]["default"]["host"]);') | |
DBUSER=$(php -r '$f = require_once "app/etc/env.php"; echo($f["db"]["connection"]["default"]["username"]);') | |
DBPASS=$(php -r '$f = require_once "app/etc/env.php"; echo($f["db"]["connection"]["default"]["password"]);') | |
DBNAME=$(php -r '$f = require_once "app/etc/env.php"; echo($f["db"]["connection"]["default"]["dbname"]);') | |
#Create magmi.ini | |
#You can edit the other parts that are default, port, etc. | |
MAGMIINI="[DATABASE] | |
connectivity = \"net\" | |
host = \"$DBHOST\" | |
port = \"3306\" | |
resource = \"default_setup\" | |
unix_socket = | |
dbname = \"$DBNAME\" | |
user = \"$DBUSER\" | |
password = \"$DBPASS\" | |
table_prefix = | |
[MAGENTO] | |
version = \"2.1.x\" | |
basedir = | |
[GLOBAL] | |
step = | |
multiselect_sep = \",\" | |
dirmask = \"755\" | |
filemask = \"644\" | |
noattsetupdate = \"off\" | |
" | |
echo "$MAGMIINI" > $MAGMIFOLDER/conf/magmi.ini | |
#Alternative way to create magmi.ini: | |
sed -e "s/\(host.=.*\)/\1$DBHOST/" \ | |
-e "s/\(user.=.*\)/\1$DBUSER/" \ | |
-e "s/\(password.=.*\)/\1$DBPASS/" \ | |
-e "s/\(dbname.=.*\)/\1$DBNAME/" \ | |
$MAGMIFOLDER/conf/magmi.ini.default > \ | |
$MAGMIFOLDER/conf/magmi.ini | |
# Then login to https://example.com/$MAGMIFOLDER/web/magmi.php | |
# with your admin user and password (not magmi magmi, but magento2 admin user and password) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment