Reputation:
i have just began on working with vagrant. I have this clients ssh and db info.
I would like to know what files do i need to copy using ssh or ftp to my vagrant box? To be able to completely replicate the target wordpress server.
Is is as simple as copying entire wordpress related folders and editing wp-config for database as well as importing the database?
Thanks
Upvotes: 0
Views: 311
Reputation: 53713
As pointing from the link in my comment and using the suggested tool on VVV, they suggest the following procedure
Using this tool you can easily create a clone of an existing live site. Here are some steps to make that happen.
From there you need to get to your docroot. This is done with:
cd /srv/www/
To check to make sure your SQL file is there you can simply do:
ls
and it should list everything in there. Once you see your SQL file you can type:
wp db import my_sql_file.sql
where my_sql_file.sql
gets replaced by the real name of your file. This will import your database file from your live site.
IMPORTANT: at this point your local site will be broken, because it thinks that it is your live site, since your live site URLs are in the database. We can fix that with a quick search and replace.
While still in your SSH connection, you need to cd into the root of your new site. Your previous ls should have shown you the directory for that site, simply cd into it.
Once you're in there, do this:
wp search-replace olddomainname newdomainname --dry-run
where olddomainname would be the domain name of your live site, and newdomainname would be the domain name of your local dev site. The --dry-run means it won't actually do anything, merely tell you what it WOULD have done.
If the results look good, run it again without the --dry-run.
At that point you should be able to go to your local domain name for your site in your browser and see a local copy of your live site.
Upvotes: 1