This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

Introducing Cloudways Community Forum. Start Discussions and Get Instant Help From Cloudways Community. JOIN NOW
Enhance your managed hosting experience with fast performance, 24x7 support and managed security. Start for Free

How to Migrate Your Magento Store to Cloudways via SSH (Command Line)June 30, 2017


In this KB

  • How to create backup of webfiles before migration
  • How to download webfiles backup to Cloudways server
  • How to backup database before migration
  • How to restore backup to your new Cloudways server
  • How to configure Magento post-migration
  • How to take your Magento site live from Cloudways


In this guide, we will show you how you can migrate your Magento store to Cloudways using an SSH terminal (command line). You need some basic knowledge of command line usage to be able to complete the process.

Step 1: Creating Backup of Webfiles

If you have SSH access to your current server, you can simplify the process by making an archive of your entire site first by using tar command. Run the following in your Magento’s webroot/public_html directory.

tar -czf backup.tar.gz *

This will create a compressed file which we will need to download to our Cloudways server.

Creating backup

Step 2: Downloading the Backup File to Your Cloudways Server

You can transfer the backup file to your Cloudways servers by using the wget or scp command. In this guide, we are using wget to transfer the backup.

To do this, log into your Cloudways server using your SSH user, Make sure you are in the Public_html directory where your site should be located. Then run the following commands.

wget http://your_domain_or_ip address/backup.tar.gz
This will download the backup file we created in the previous step to your Cloudways server.

tar -xzf backup.tar.gz
This will decompress contents in the current folder.

Once above is done, you should remove the backup.tar.gz from your old server.

Download backup

Step 3: Backup the Database

In this step, you will make a backup of the database in your old server. To backup your database, we recommend using SSH or a tool like phpMyAdmin.

Log into your old server with SSH as we did in Step 1. Once you are there, run the following command (replace dbUsername and dbName with the database name and database username from your old setup):

mysqldump -u dbUsername -p dbName > db_backup.sql

This will create a dump of your database  and save it as db_backup.sql in the current directory. If you don’t have SSH access, contact your current host for assistance on how to backup the database.

Backup database

Step 4: Restoring the Database on Your New Cloudways Server

Now we will restore the database dump we took into our Cloudways server. Again, open an SSH session to your Cloudways server with the appropiate credentials and run the following commands (replace dbUsername and dbName with the database name and user name that you can find in the application tab of your Cloudways console):

wget http://your_domain_or_ip/db_backup.sql

mysql -u dbUsername -p password dbName < db_backup.sql

This will download the backup file from your old server to your Cloudways server and restore the data into the database named as dbName.

Remove the db_backup.sql from your old server once you successfully restored the database.

database restore

Step 5: Update Magento Configuration Settings

Edit the Magento configuration file to use the cloudways server database.

Open the file local.xml under the public_html/app/etc/ directory with your favorite text editor. Here we have used vim to edit the local.xml file as shown above. Remove the old entries and input the new cloudways application details.

Note: You can also use the SFTP File Manager for file modification).

Save the file and exit.

Update Magento configuration settings

 Step 6: Clear the Magento Cache

Go to the folder var/cache inside your magento root directory (Public_html“) and remove any file or folder that may exist.

Make sure you are in /var/cache before running the command above!

That’s it! You should now be able to open your Magento website from your Cloudways server. You can check that all is working fine updating your local hosts file and pointing to your Cloudways server.

Once you are happy with how your site works on the new server, you can proceed to make the necessary DNS changes to take your website live from Cloudways.

Clear the Magento cache
Please insert Content
Have Questions? Ask From Our Helpful Community

2 Responses

  1. lei says:

    Hi after we did this.. my magento store still benefit from Vanish and mencasch?

Do you still need help?

Our Technical Support team is always at work.