In Ecommerce Applications, Hosting Guides

How to create a duplicate (testing/development) Magento store on a VPS

Stefan Posted by

OVERVIEW

Please note we do not accept any responsibility for any unintended consequence of following or failing to follow these instructions. These instructions if followed correctly will duplicate your current Magento store without harming it in any way. However failure to follow these instructions correctly could result in significant harm to your live install. If you are not confident following these instructions then you should not undertake this how-to.

We offer this as a professional service – if you wish for us to undertake this duplication please contact us via the usual support channels.


REQUIREMENTS

  • Your live site should be fully backed up before attempting this
  • DNS is pointing at the VPS
  • Shell access
  • Magento is in web root. If the Magento install is not in web root then you will need to add the subdirectory to all the file paths.

Step 1: Create the domain in Plesk

Create New Domain of the format : dev.domain_name.com where your live domain is domain_name.com

  • Add a database
  • Make a note of all login details.

Step 2: Access the shell

Ensure /bin/bash shell access is enabled in your Hosting Account (Setup > Shell access to server with FTP user’s credentials – /bin/bash) Access your VPS using Putty, logging in as the new domain user.


Step 3: Duplicate files

Shell commands:

You will need to replace DEV.DOMAIN_NAME.COM and DOMAIN_NAME.COM as appropriate.

(Ignore any errors relating to plesk-stat or var/cache/mage…).

Shell commands:

Dump a copy of the live database

Import it into the new dev database


Step 4: Point dev domain at duplicated database and update base URLs

Edit file : /var/www/vhosts/dev.domain_name.com/httpdocs/app/etc/local.xml
(If unsure use Plesk CP > File Manager > Navigate to file > Pencil Image )
Change db_name, db_username, and db_password from live_db settings to the dev_db details.
Save the file.

Using Hosting Control Panel / phpMyAdmin
Login > Home/Domains > dev.domain_name.com > Databases > database > DB WebAdmin
Click on core_config_data
Click on the Search tab
Enter %base_url in path and click Search/Go
Change all entries to point to dev.domain_name.com
(Further information on using phpMyAdmin)
Reset the magento cache using the “Magento Cache Reset” button for dev.domain_name.com


Step 5: Enable caching and Magento Connect

Configure file permissions and the pear.ini

TEST REPEATEDLY!
Note : All absolute links entered into the CMS component of Magento will remain wrong.
Login details should be changed so that the logins for the dev site are different to the live site.
Consider using “Protected Directories” to prevent viewing of the dev site.


Addition for Magento 1.5.x +

It’s worth pointing out that since the release of the 1.5.x family of Magento Community Edition, pear is no longer used. Instead Varien are using a customised build, and it’s now called mage. It’s a bit leaner and presumably will be in use by all future versions of Magento.

Therefore, any duplications of a Magento store that is version 1.5.x or higher should use the following commands for Step 6: Enable caching and Magento Connect:

 

 

Stefan

Author Stefan

More posts by Stefan

Talk with one of our hosting experts today


Or call 0800 033 7074