Skip to content

Instantly share code, notes, and snippets.

@matthewhaworth
Last active January 1, 2016 06:09
Show Gist options
  • Select an option

  • Save matthewhaworth/bfc300ecb5a75618d0d5 to your computer and use it in GitHub Desktop.

Select an option

Save matthewhaworth/bfc300ecb5a75618d0d5 to your computer and use it in GitHub Desktop.
Magento Install Script
#!/bin/sh
MAGENTO_VERSION=1.7.0.2
MAGENTO_VERSION_RAW=$(echo $MAGENTO_VERSION | tr -d '.')
TARGET_PATH=/var/www/projects/app55/magento$MAGENTO_VERSION
TEMP_MAGE_PATH=/tmp/mage$(date +"%s").tar.gz
wget http://www.magentocommerce.com/downloads/assets/$MAGENTO_VERSION/magento-$MAGENTO_VERSION.tar.gz -O $TEMP_MAGE_PATH
tar -C $TARGET_PATH -xvf $TEMP_MAGE_PATH
rm -rf $TEMP_MAGE_PATH
# Actual script
MAGENTO_VERSION=1.7.0.2
MAGENTO_VERSION_RAW=$(echo $MAGENTO_VERSION | tr -d '.')
mkdir SUBDIRECTORY
cd SUBDIRECTORY
wget http://www.magentocommerce.com/downloads/assets/$MAGENTO_VERSION/magento-downloader-$MAGENTO_VERSION.tar.gz
tar -zxvf magento-downloader-$MAGENTO_VERSION.tar.gz
if [$MAGENTO_VERSION_RAW -lt 1610]
then
wget http://www.magentocommerce.com/downloads/assets/1.2.0/magento-sample-data-1.2.0.tar.gz
tar -zxvf magento-sample-data-1.2.0.tar.gz
mv magento-sample-data-1.2.0/media/* magento/media/
mv magento-sample-data-1.2.0/magento-sample-data-1.2.0.sql magento/data.sql
else
wget http://www.magentocommerce.com/downloads/assets/1.6.1.0/magento-sample-data-1.6.1.0.tar.gz
tar -zxvf magento-sample-data-1.6.1.0.tar.gz
mv magento-sample-data-1.6.1.0/media/* magento/media/
mv magento-sample-data-1.6.1.0/magento_sample_data_for_1.6.1.0.sql magento/data.sql
fi
mv magento/* magento/.htaccess .
chmod -R o+w media
mysql -h DBHOST -u DBUSER -pDBPASS DBNAME < data.sql
# .. download and install
touch var/.htaccess | mkdir app/etc
chmod o+w var var/.htaccess app/etc
rm -rf downloader/pearlib/cache/* downloader/pearlib/download/*
rm -rf magento/ magento-sample-data-1.6.1.0/
rm -rf magento-downloader-1.7.0.0.tar.gz magento-sample-data-1.6.1.0.tar.gz data.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment