Migrating web from shared hosting (I read some questions but they are no help)

Posted July 19, 2016 4.2k views
Linux BasicsUbuntuMySQLWordPressDigitalOceanBackupsDeployment

Hi, there are a lot of questions about this topic, but none of them point at the questions I have. I’m migrating from hostmetro and I have a domain there. I’m following this guide:

but I’m stuck in the step 4: sudo nano /etc/apache2/sites-available/

My wordpress is installed on the OS ubuntu 14.04 using the IP address I can access to it, so to install the old wordpress on the server, do I write where it says “” my hostmetro .com domain? and on “sites-available” my ip address from digitalocean?

I’m also trying to transfer my domain, this guide includes that right?

Thanks for the help!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
4 answers

Actually, based on that tutorial, on step 4, if your domain is, you should write sudo nano /etc/apache2/sites-available/
But this tutorial is a little bit old, you should add the .conf extention at the end now, so sudo nano /etc/apache2/sites-available/

To see how to transfer the domain, take a look at the step 7 of that tutorial.
Hope this help, do not hesitate to reply here, I know it can be hard to setup your first server.

Perfect, it worked. Thanks you very much!

Another question please:

I’m on step 5 now, I can’t upload it thorugh the comand line because it keep saying no such file or directory, so I can do it ftp.

Where do I upload the files? (db and wp-content) and are these two the only files I need to migrate a whole web?? I have a backup of all the files.

On step 5 it says:

scp ~/Downloads/backupdb.sql.gz username@serveripaddress:
scp ~/Downloads/ username@server

but I’m trying to do it FTP, do I upload them in the root directory or the wordpress directory?

and when restoring the database:

mysql -h localhost -u databaseuser -p databasename < backup_db.sql.gz

on “databaseuser” do I write my user from the digitalocean sql wordpress or my old hosting sql?
on “database
name” do I create a new one or the same as above?

Oh one more thing, when I downloaded the sql from my old hosting I had it on the formal .sql, if I compress it, it will give me a format backup_db.sql.tar.gz and on the guide it says only .gz does it matter? I’m compressing it on ubuntu

Thanks again!

  • The scp command should be done on your computer… but this tutorial seem to be written by someone who use linux on their own computer.
    If you use linux / mac os, the command do exists, but if you are using windows, you will have to download a software such as winscp that will upload your file to the server.
    That command should be executed on your computer and not on the server
    scp <Path and file you want to upload> <username@ip:path and file of destination>

    In the tutorial, on step 3, you installed wordpress (and created an database username), if you follow the other tutorial, your username should be “wordpressuser”, same thing for the database name, on the tutorial, it was “wordpress”

    And for the compression, you actually don’t need to compress it at all, simply keep it as .sql, it will take a little bit more time to upload, but it might be easier in the end

    • It’s ok I use linux too, I was trying to upload it from putty and it didn’t work, I tried from the terminal and the upload worked.

      This guide should be updated…

      Now when I unzip the “” with: sudo unzip -d /var/www/

      it says: sudo: unzip: command not found

      Is there any other method? Or where do I unzip it through ftp?


      • The tutorial was created in 2013… a lots has changed in 3years!
        If unzip isn’t installed, you can install it with the commands
        sudo apt-get update
        sudo apt-get install unzip

        • Thanks it worked. I was also reading this:


          for everyone doing this on Ubuntu 14.04:

          Very important: Any step (4 & 5 namely) in this tutorial that refers to /var/www/ needs to refer to /var/www/html/ instead, since that’s the home directory for Ubuntu 14.04

          Step 4 of this tutorial remains the same, but you must configure your file as :

          sudo nano /etc/apache2/sites-available/

          and not

          sudo nano /etc/apache2/sites-available/

          The .conf extension is required in 14.04. For reasons I don’t understand and as a cookbook layperson may never understand ;)

          You may not be able to directly restore the database from a .sql.gz file in Step 5. You might first have to extract it using gunzip and then restore it as a .sql file.


          I included everything in case someone else has the same problem.

          Now I’m going to test the web and when I input:

          sudo service nscd restart

          on step 6 (testing) it says: nscd: unrecognized service

          And then I thought to go to the last step on the DNS and I’ve never changed DNS, on my hostmetro it says:

          Add an A Record



          Add a CNAME Record


          so what do I write here? On the guide says to write this:

          but hostmetro is asking me for an IP and name :/

          Thanks for all the help up to the end!

          I will most likely make a guide updated after I finish

lol I can’t reply to your post, too long.

That guide helped me. I updated the nameservers. Now I’m just waiting, finger crossed hahaha

Thank youuuuuuuuuuuuuu!

Lasst last last question, I need to upload the .sql manually, where do I upload it in the directory? It’s not compressed

  • It does not matter where you upload your sql file.
    If you devided to upload it in the folder /home/ and the .sql file is named backup.sql you have to do this command after: mysql -h localhost -u databaseuser -p databasename < /home/backup.sql