Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an old Ubuntu LAMP server. I'd like to move the webpage over to a newer Ubuntu server and I'm wondering what the easiest way to backup and restore the webpage would be? Or just the easiest way to transfer the settings to a new server.

The first idea that came to my mind was just to set up a new LAMP server and then recreate the database, import the data,... but there must be a better way, right? :)

Thanks for your help!!

share|improve this question
Is it running LAMPP or did you install apache, php and mysql separately? – LasseValentini Dec 20 '10 at 10:10
up vote 5 down vote accepted
  • Your new server might not have the same hardware.
  • So install LAMPP server on the new system.
  • Shutdown the mysql service.

    sudo /etc/init.d/mysql stop

  • Then copy /var/lib/mysql from the old system over to the new system.
  • Then copy /var/www from the old system to the new system.
  • Start up mysql again.

    sudo /etc/init.d/mysql start


  • Most of the time copying /var/lib/mysql from one system to another system will work.
  • In anycase if that din work for you,then do mysqldump on the old server and run the resulting sql on the new server with mysqlimport.

    mysqldump --all-databases > db_name.sql
    mysqlimport db_name.sql

share|improve this answer
Thanks for your help! – Evan Dec 20 '10 at 17:51
Thanks! I've always been trying to find where the mysql databases are in the file system. – Azendale Sep 6 '11 at 17:05
Also, you might want to make sure the ownership is set right--it seemed to make my mysql not start when it was wrong. (Then I had to purge/reinstall all the mysql stuff after that). – Azendale Oct 11 '11 at 5:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.