Home > Blog > Ben > How to create a duplicate development staging server of a Magento Store

Open Source Web Design & Online Business Marketing

Joomla, Magento and Wordpress Web Design focusing on the major Australian Business Centres including Sydney, Brisbane, Melbourne, Gold Coast, Perth & Adelaide. We enjoy writing about the latest business marketing techniques along with Social Media Marketing, Google Adsense, PPC and Search Engine Optimsation.

09
Jun

How to create a duplicate development staging server of a Magento Store

Posted by Ben
Ben
Joomla / Magento Web designs. SEO guru and Social Media Marketing Entrepreneur.
User is currently offline
in Magento Web Development

magentoIn many cases when developing a Magento website you will need to create a staging server to work from to make changes and modifications. From this you can then transfer the changes to your live website, which does not get effected during your development stages.

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.

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 www.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.

 

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 ->)
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 http://dev.domain_name.com/
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 .

 

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.

 


 

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 

Rate this blog entry
Ben
Joomla / Magento Web designs. SEO guru and Social Media Marketing Entrepreneur.
Trackback URL for this blog entry
  • file comparison software

    Posted by synchronize folders on Tuesday, 30 November 1999
    How to create a duplicate development staging server of a Magento Store - Open Source Web Design | SEO | Search Engine Marketing ...
  • file sync

    Posted by file sync on Tuesday, 30 November 1999
    How to create a duplicate development staging server of a Magento Store - Open Source Web Design | SEO | Search Engine Marketing ...
  • auto usb backup

    Posted by auto usb backup on Tuesday, 30 November 1999
    How to create a duplicate development staging server of a Magento Store - Open Source Web Design | SEO | Search Engine Marketing ...
  • social bookmarking

    Posted by social bookmarking on Tuesday, 30 November 1999
    How to create a duplicate development staging server of a Magento Store - Open Source Web Design | SEO | Search Engine Marketing ...
  • seo blog

    Posted by seo blog on Tuesday, 30 November 1999
    How to create a duplicate development staging server of a Magento Store - Open Source Web Design | SEO | Search Engine Marketing ...
  • Antivirus

    Posted by Antivirus on Tuesday, 30 November 1999
    How to create a duplicate development staging server of a Magento Store - Open Source Web Design | SEO | Search Engine Marketing ...
  • buy articles

    Posted by buy articles on Tuesday, 30 November 1999
    How to create a duplicate development staging server of a Magento Store - Open Source Web Design | SEO | Search Engine Marketing ...
  • unlock iphone

    Posted by unlock iphone on Tuesday, 30 November 1999
    How to create a duplicate development staging server of a Magento Store - Open Source Web Design | SEO | Search Engine Marketing ...
  • web designer melbourne

    Posted by web designer melbourne on Tuesday, 30 November 1999
    How to create a duplicate development staging server of a Magento Store - Open Source Web Design | SEO | Search Engine Marketing ...
  • female libido

    Posted by female libido on Tuesday, 30 November 1999
    How to create a duplicate development staging server of a Magento Store - Open Source Web Design | SEO | Search Engine Marketing ...
  • Soft

    Posted by Soft on Tuesday, 30 November 1999
    How to create a duplicate development staging server of a Magento Store - Open Source Web Design | SEO | Search Engine Marketing ...
  • click here

    Posted by click here on Tuesday, 30 November 1999
    How to create a duplicate development staging server of a Magento Store - Open Source Web Design | SEO | Search Engine Marketing ...
  • Web Development UK

    Posted by Web Development UK on Tuesday, 30 November 1999
    How to create a duplicate development staging server of a Magento Store - Open Source Web Design | SEO | Search Engine Marketing ...
  • police officer

    Posted by police officer on Tuesday, 30 November 1999
    How to create a duplicate development staging server of a Magento Store - Open Source Web Design | SEO | Search Engine Marketing ...
  • click here

    Posted by click here on Tuesday, 30 November 1999
    How to create a duplicate development staging server of a Magento Store - Open Source Web Design | SEO | Search Engine Marketing ...
blog comments powered by Disqus