Ubuntu – How to move a LAMP setup to a new Ubuntu server

lampserver

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!!

Best Answer

  • 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

Note:

  • 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

Related Question