Magento Update Using SSH

Manager's picture

Had to update a Magento store today, always forget how to do this so here is a reminder. Magento OS Store http://magentocommerce.com. This is best done using ssh

Log into ssh

ssh -2 X.X.X.X -p 22 -l YOURUSENAME

Switch to the directory your Magento files are in, mine are usually in the public_html folder

I find it best to use these commands

chmod 550 ./mage
./mage mage-setup .
./mage sync
./mage install http://connect20.magentocommerce.com/community Mage_All_Latest --force
./mage upgrade-all --force
rm -rf downloader/.cache/* downloader/pearlib/cache/* downloader/pearlib/download/* var/cache/*
php shell/indexer.php reindexall

Run the below to reset all files to the correct permissions

find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

THEN MAKE SURE YOU CHANGE /app/etc/~/public_html/app/etc to 640

If you see the Service Temporarily Unavailable page after refreshing the frontend, open the Magento installation directory on the server and remove the maintenance.flag file.

Then run

rm -rf var/cache/*

To clear the cache

just upgraded to Magento ver. Magento ver. 1.9.0.1