I have a task to move a webservice (Matomo) running on a VM to its own physical server.

I am not that experienced with Linux or servers so I would like to know if I have thought of everything that might come up.

The new server is already running and has nothing but an ip-address, system utilities and sshd.

I would follow these steps:

apt-get install apache2
apt-get install mysql-server
apt-get install php5, php5-mysql
mysqldump -u username -p --all-databases > /path/to/alldatabases.sql
scp username@remotehost.com:/path/to/alldatabaes.sql /some/local/directory 
scp -r username@remotehost.com:/var/www/html /var/www

For the beginning I would like to be able to call the service on the new server using IP and Port without destroying the first one.

I guess I have to make some changes to the Apache config but don't really know how Apache works. Can I just scp the config from the old system?

The new server has: Ubuntu 16.04

The service running there has the following requirements:

  • PHP 5.5.9 or greater
  • MySQL version 5.5 or greater, or MariaDB
  • PHP extension pdo and pdo_mysql, or the MySQLi extension.
  • Matomo is OS / server independent

The old server has: Ubuntu 14.04

  • Apache/2.4.7 (Ubuntu)
  • mysql Ver 14.14 Distrib 5.5.59, for debian-linux-gnu (x86_64) using readline 6.3
  • PHP 5.5.9-1ubuntu4.23 (cli)
  • #5 will error out ;-) – Rinzwind Mar 13 '18 at 14:20
  • Should be fairly straight forward, you will likely need the apache config files as well. Ask a more specific question if you get stuck. – Panther Mar 13 '18 at 14:50
  • I think you're forgetting mysql users, triggers and stored procedures. Most probably your app won't work if you only restore the databases. If you are familiar with VMs, i will make an almost exact one with the new server specs, and will test all the migration there, ideally in a bash script so you won't miss any steps and it can be use to replicate as many times as you want. – bistoco Mar 13 '18 at 15:19

I'd get everything setup configuration wise. Get a good backup of your database stuff. Migrate all your files over and change any configurations for anything IP related as needed. You may also have to check the version differences between your environmental in case you need to tweak additional settings.


Not a simple task you're trying to accomplish. Migration is always hard because there's a lot of uncertainty and a lot of things can go wrong.

Answering your question regarding the apache configuration file: you could try to just copy it, but this would work 100% if you have the same version installed. And considering there are no another configuration files.

I would recommend the following steps:

  1. Try to replicate the old environment (version of apps) in the new one. Or at least try to install the 'most' similar version.
  2. From there, if everything is working, try to update the apps (php, apache, mysql, etc.)

It might take a while and it requires some testing to be sure the migration was correct. Sometimes just a slight difference in version numbers may carry a lot of headaches.

Good luck.


What I would do is to get backups of files and DB as you are planning, check requirements for CMS or whatever application you are moving and restore on the new server.

Look into apache logs and website that you will be restoring - all missing bits will be screaming about what they do not like. Resolve them one by one.

What might also help you is if you will modify on your desktop/laptop (on Linux) your /etc/hosts file and add the domain of websites/portals you are moving to new IP.
Sometimes CMS can get funny when accessing via IP

FYI - google reports that on Windows host file is located in C:\Windows\System32\Drivers\etc and open the host's file.

FYI 2 On some occasions it is a good idea to perform upgrades if there are no code dependencies, You are currently on 14.04, see if you can host it on 16.04 server, It really depends how complex migration is. It might actually be best just to move portal first and then build dev/staging environment to test new OS.


Actually it gonna work easier then I thought. Matomo(Piwik) just needs to be installed. I had to move the database using mysqldump and then install piwik and set db name in the configuration of piwik.

application is at least running with old database data.

The new server is going to get the old IP and DNS Name.

Next steps: making application running over https. I already have the certificates on the old server. Can I use them on the new one?

Thanks amit

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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