Skip to content

Instantly share code, notes, and snippets.

@mcnamee
Created April 20, 2018 00:46
Show Gist options
  • Save mcnamee/900d7b2d6c8cdf7c8cb19bd72b72c111 to your computer and use it in GitHub Desktop.
Save mcnamee/900d7b2d6c8cdf7c8cb19bd72b72c111 to your computer and use it in GitHub Desktop.
Install Magento2, our way
#
#
# Installs Magento2 "the Pivotal Way"
#
# Simply run the following from your CLI:
# `bash <(curl -s <URL TO THE 'RAW' VERSION OF THIS GIST>)`
#
# You get Magento2 installed and the Pivotal Theme
#
# Prereq's: Composer, WP-CLI, Git, Unix
#
#
GREEN='\033[0;32m'
echo "\n${GREEN}•• We'll create a new directory for the project. What shall we call the new directory? (eg. wordpress)"
read DIR_NAME
echo "\n${GREEN}•• What shall we set the URL as?"
read URL
# Make the directory
mkdir $DIR_NAME && cd $DIR_NAME
# Down the latest@Magento
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition magento2
# Set the permissions
find var vendor pub/static pub/media app/etc -type f -exec chmod u+w {} \;
find var vendor pub/static pub/media app/etc -type d -exec chmod u+w {} \;
chmod u+x bin/magento
# Install Magento
php bin/magento setup:install \
--admin-firstname=Pivotal \
--admin-lastname=Admin \
--admin-email=tech@pvtl.io \
--admin-user=pivotal_admin \
--admin-password='123Abc123' \
--base-url=$URL \
--backend-frontname=admin \
--db-host=db \
--db-name=magento2 \
--db-user=root \
--db-password=dbroot \
--currency=AUD \
--timezone='Australia/Brisbane' \
--use-rewrites=1 \
--language=en_US
# Configure the env
php bin/magento deploy:mode:set developer && \
php bin/magento cache:enable && \
php bin/magento cache:disable layout block_html full_page
# Install the Boilerplate theme
mkdir app/design/frontend/Pivotal/Store --parents && cd app/design/frontend/Pivotal/Store
git init && \
git remote add origin git@bitbucket.org:pvtl/magento2-theme-boilerplate.git && \
git fetch && \
git checkout -t origin/master && \
rm -rf .git
# Install Wordpress
mkdir wp && cd wp && \
wp core download --allow-root
# Back Up
cd ../
# Add the following to the .wp-config-sample.php
echo '
define('DISALLOW_FILE_MODS', true); // Disable plugin/theme installs
define('WP_AUTO_UPDATE_CORE', false); // Disable core updates
' >> wp/wp-config-sample.php
# Add the following to the .gitignore
echo '
# Wordpress
# ------------------------------------------------------
/wp/wp-config.php
/wp/wp-content/uploads/*
!/wp/wp-content/uploads/.gitkeep
/wp/wp-content/upgrade/*
!/wp/wp-content/upgrade/.gitkeep
' >> .gitignore
# Next steps:
# - Enable the theme in the backend - `Content > Configuration > Edit`
# - Setup /package.json for Grunt.JS to Compile LESS
# - Turn off session sharing - `Store > Configuration > General > Web > Session Validation Settings > "Use SID on Storefront"`
# - Setup Aus settings - https://www.fontis.com.au/blog/how-to-set-up-a-magento2-store-for-australia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment