Upgrading to the latest Magento 1.9.x Release with rsync via commandline

If you want more tutorial like this, be sure to subscribe to our YouTube Channel. This video can be found here: https://www.youtube.com/watch?v=GRm8wYt3T-8&feature=youtu.be and will help in the process of demystifying some of the common Magento administration tasks and making your life as a Magento Merchant or Admin a little bit easier. Be sure to subscribe for the latest tutorials.

This is a brief tutorial on how to Upgrade Magento from to, the newest release. –This will not work for upgrading from 1x to 2x.–

If you don’t already have an account at Magento.com, just know that it is required for the latest releases of the Magento code. Also, I highly suggest you setup notifications at https://magento.com/security so that you will be notified anytime there is an update. You can find more detail in the description.

I’ve already downloaded the zip file and unzipped it on my Linux server so that I can initiate the upgrade. (If you need help with Zip files, head over to our tutorial about unzipping files on any platform.)

If you are less technically inclined, be sure to check out our tutorial on How to Upgrade Magento on Windows or Mac with Beyond Compare.

Let’s get started on the Magento upgrade using rsync!

First we are going to the remote server, which is our destination, to make sure we have the git repo setup so that we can revert our changes if something goes awry.

ssh un@destination
dbbackup.sh (this is a little script I wrote to make life easier and it is available exclusively to members of the Variux Automation Club)
cd public_html
git status
git branch
git checkout -b 1938upgrade

(All code can be found in the video description)
Now that the destination is ready for the new code, we will go to the source folder and send it along

rsync -avPn --exclude=".htaccess" . un@destination:~public_html/

This is your chance to review the files and folders that will be processed and make sure you don’t have any conflicts with any of your custom code. Your custom code should never be added within the core or default files for Magento. As long as you follow that practice, then an upgrade like this will be safe.
Now we are going to run the live update.

rsync -avP --exclude=".htaccess" . alscodev:~/public_html/

Next we clear the var/cache/ and var/sessions/ folders

rm -rf var/cache/* var/sessions/*

Now we login to the Magento admin and front end to begin testing that all of our features are there.

Until next time…Automate Everything!