How to change OS from Debian to Ubuntu?

December 23, 2014 2.6k views

Is there any tutorial how to change OS? I want to switch Debian 6 to the latest Ubuntu (14.10x64). I guess I'll have to backup all my sites (9) with MySQL databases somewhere, then recreate droplet with the same IP but new OS (Ubuntu) and restore all my sites. Is there most painless and quickest way to do that, cause I can't keep my sites offline for a long time?

2 Answers

Since changing your OS replaces your filesystem there is no way of getting around backing up and restoring your files and databases as part of this process. You should not have to destroy your droplet though. Once you have completed your backups click on your droplet in the control panel, then on the Destroy tab. Click on the Rebuild sub-tab, select your new OS from the drop-down menu and click on Rebuild From Image and your droplet will be rebuilt in place with your new OS. You can then set up your configuration and upload your backed up files.

  • Thanks for your answer. I thought it should be much more complicated ))) Well it looks like I just need to rebuild my droplet from image, but what about Apache, MySQL and PHP? I thought AMP depends on OS somehow and I have to install AMP on new OS from scratch. Is it possible to upgrade PHP and MySQL on rebuilded droplet?

  • We only provide a pre-built LAMP image for Ubuntu 14.04 currently. You can set up your LAMP stack easily on Debian however by just running the following commands as root.

    apt-get update
    apt-get install apache2 mysql-server libapache2-mod-auth-mysql php5-mysql php5 libapache2-mod-php5 php5-mcrypt php5-gd

    When prompted enter (Y)es to install these packages. You will be prompted to create a new MySQL root password and when complete you will have a fully functional LAMP stack on your new Debian droplet.

  • But if I will install mysql it will erase all data in my databases?

  • Yes. Changing your OS will completely wipe your disk so you will need to back up your files and database before doing it.

Personally I would not destroy your current droplet just yet.

I would create a new droplet with Ubuntu, using one of the prebuilt apps if you desire. Then set your sites up on the new droplet and once you are sure they are 100% done destroy your old droplet.

Whilst this will mean you will have to change the DNS, that is preferable than having extended downtime for your sites while you setup the new environment.

  • Is there way to use new droplet without domain name and test sites by refering to them by IP?

  • With a single site this would certainly be possible. Since apache/nginx use the domain/subdomain name to map virtualhosts you would encounter problems trying to preview multiple sites on a single IP but there is a workaround.

    To test your new configuration locally you could create a host file entry on your local computer. This would allow you to browse the sites on the new server with their correct domain name without re-pointing the domain publicly. On Linux and OS X the host file can be found at /etc/hosts and on Windows it can be found in C:\Windows\system32\drivers\etc\hosts

  • I have 9 sites on my current droplet, so my hosts file on the local machine should contain something like this? site1 site2 site3

    And if so, then how server will know which site am I referring to?

  • That's correct. Name based virtual hosting is based on the request sent from your browser which indicates the domain it is looking for. If you have virtualhosts set up for those domains on your server and host file entries on your local computer, when you send a request via a browser it is routed to the IP address in your hosts file but still indicates that it is a request for the domain you typed even when the public DNS is pointed elsewhere. It makes for a very handy tool to test your site and configuration without first changing your DNS settings.

Have another answer? Share your knowledge.