You are not logged in. Please login or register.
Web Hosting » Support » NuBlue » e-Commerce » Creating a development copy of your Magento Store
Creating a development copy of your Magento Store
How to Create a Duplicate (Testing/Development) Magento Store on a VPS
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 HowTo.
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.
(Further information if required)
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.
cd /var/www/vhosts/DEV.DOMAIN_NAME.COM/httpdocs/ cp -r /var/www/vhosts/DOMAIN_NAME.COM/httpdocs/* /var/www/vhosts/DOMAIN_NAME.COM/httpdocs/.ht* /var/www/vhosts/DEV.DOMAIN_NAME.COM/httpdocs/ chown -R DEV_FTP_USERNAME:psacln /var/www/vhosts/DEV.DOMAIN_NAME.COM/httpdocs/* /var/www/vhosts/DEV.DOMAIN_NAME.COM/httpdocs/.ht*
(Ignore any errors relating to plesk-stat or var/cache/mage...).
Step 4 : Duplicate Database
Shell Commands :
Dump a copy of the live database
cd /var/www/vhosts/DEV.DOMAIN_NAME.COM/private/ mysqldump -u LIVE_DB_USERNAME -pLIVE_DB_PASSWORD LIVE_DB_NAME > LIVE_DB_NAME.sql
Import it into the new dev database
mysql -u DEV_DB_USER -pDEV_DB_PASSWORD DEV_DB_NAME < LIVE_DB_NAME.sql rm LIVE_DB_NAME.sql
Step 5 : 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 6 : Enable caching and Magento Connect
Configure file permissions and the pear.ini
find /var/www/vhosts/DEV.DOMAIN_NAME.COM/httpdocs/ -type d -exec chmod 775 {} \;
find /var/www/vhosts/DEV.DOMAIN_NAME.COM/httpdocs/ -type f -exec chmod 664 {} \;
chmod a+x /var/www/vhosts/DEV.DOMAIN_NAME.COM/httpdocs/pear
/var/www/vhosts/DEV.DOMAIN_NAME.COM/httpdocs/pear mage-setup .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.
~Paul
Last edited by NuBlue-Tom (2011-10-24 14:09:07)
Update - 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 :
find /var/www/vhosts/DEV.DOMAIN_NAME.COM/httpdocs/ -type d -exec chmod 775 {} \;
find /var/www/vhosts/DEV.DOMAIN_NAME.COM/httpdocs/ -type f -exec chmod 664 {} \;
chmod a+x /var/www/vhosts/DEV.DOMAIN_NAME.COM/httpdocs/mage
/var/www/vhosts/DEV.DOMAIN_NAME.COM/httpdocs/mage mage-setup .Hi,
I'm running Magento ver. 1.5.1.0. Does this still apply for my version?
Best regards
Hi Cadmium,
Yes it does - you need to use the mage rather than the pear commands, and the rest of the process is still valid.
If you're still having problems, just let us know.
Hi,
Thanks alot.
I've followed your titorial successfully. But, when i click on a category of product link, i get the following error:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and entity_id=152' at line 1
Hi Cadmium!
Have you re-indexed your data for the products in the system? Also which method did you use to dump your MySQL database? its entirely possible that the data imported is incorrect, since its a key issue it might be that the export you did had auto incremented values or something similar.
Let me know, I'm sure its a simple fix.
Hi Luke,
The method i used was from the tutorial above by your colleague above, Paul.
cd /var/www/vhosts/DEV.DOMAIN_NAME.COM/private/ mysqldump -u LIVE_DB_USERNAME -pLIVE_DB_PASSWORD LIVE_DB_NAME > LIVE_DB_NAME.sql
And then i imported using the following:
mysql -u DEV_DB_USER -pDEV_DB_PASSWORD DEV_DB_NAME < LIVE_DB_NAME.sql rm LIVE_DB_NAME.sql
When i look in the admin area, evrything seems to be ok, all product and category data is correct?
I would really appreciate your thoughts and help.
Best regards
Hi cadmium,
From what I can tell this most likely relates to the indexes and a re-index of the data should fix it for you, followed by clearing the cache, if that doesn't work for you, please do drop me using - http://www.nublue.co.uk/web-hosting/contact-us with your admin details for the store and I'll take a closer look for you.
Kind Regards
Web Hosting » Support » NuBlue » e-Commerce » Creating a development copy of your Magento Store







