If you ever have the need to move or migrate complete websites from one server to another, you know what a hassle it is using FTP. For one, it takes a long time, especially for larger sites, plus most of the time, we lose connection and our FTP program stalls, meaning we have to start all over again. So here’s how to do it using SSH /Telnet.
- First log in to your old server via SSH. If necessary, you may need to login as a “super user”.
- Change directories to the directory where your website resides.
- Type in the following code:
- tar -cvf sitepack.tar ./ This creates a tar file of all files in that directory.
- Login to your new server.
- Navigate to the directory where you want to place the website you are moving.
- Type in:
- wget yourdomain.com/sitepack.tar (Of course, yourdomain.com is replaced with your actual domain name). This transfers the tar file from the old server to the new server.
- tar -xvf sitepack.tar
- This will unpack the tar file onto the new server in the directory that you placed it.
There you go. Within seconds you have moved all your site files from one server to another using SSH, which makes migrating a website as easy as ever.
Keep in mind, you MUST perform separate actions for copying or moving databases as well as adding email addresses.