-
-
Save hiephm/ccf8da5e4126e184fea0 to your computer and use it in GitHub Desktop.
Install script for magento2 with database, assumes you are running from www.localhost.com/20
This file contains 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
#!/bin/bash | |
# Sets up a database with a magento2 installation. This assumes you are running from under your httpdocs/20 location and have www.localhost.com in your /etc/hosts file | |
# To run type : install_magento2 <dirname><password> | |
# password is used for the datbase user and the magento admin password | |
if [ $# -eq 0 ]; then | |
echo "No arguments supplied" | |
echo "Usage: `basename $0` <dirname><password>" | |
exit 1 | |
fi | |
if [ "$1" == "-h" ]; then | |
echo "Usage: `basename $0` <dirname><password>" | |
exit 0 | |
fi | |
Q1="CREATE DATABASE IF NOT EXISTS $120;" | |
Q2="CREATE USER $120@'localhost' IDENTIFIED by '$2';" | |
Q3="GRANT USAGE ON *.* TO $120@localhost IDENTIFIED BY '$2';" | |
Q4="GRANT ALL PRIVILEGES ON $120.* TO $120@localhost;" | |
Q5="FLUSH PRIVILEGES;" | |
SQL="${Q1}${Q2}${Q3}${Q4}${Q5}" | |
echo $SQL; | |
MYSQL -uroot -p -e "$SQL" | |
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition $1 | |
cd $1 | |
chmod -R 775 * | |
bin/magento setup:install --base-url=http://www.localhost.com/20/$1/ --db-host=localhost --db-name=$120 --db-user=$120 --db-password=$2 --admin-firstname=Magento --admin-lastname=User [email protected] --admin-user=admin --admin-password=$2 --backend-frontname=admin --language=en_US --currency=USD --timezone=America/Chicago --use-sample-data --use-rewrites=1 | |
bin/magento deploy:mode:set developer | |
# run this after you have setup phpstorm | |
#bin/magento dev:urn-catalog:generate .idea/misc.xml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment