Creating a local environment from an existing droplet?

Posted September 22, 2021 107 views
PHPLAMP StackGitUbuntu 16.04SQLGitHub Actions

I have a custom site running on an Ubuntu LAMP 16.04 droplet. The site is built with PHP and has entries in a SQL database.

What’s the best way to clone this droplet as-is (SQL database and all) and run it locally? Once local I’ll configure it with Git and use GitHub Actions to rsync back to the production server.

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
1 answer


It would depend on what OS you are using on your local environment. For example, if you have a Windows PC, you could install the WAMP stack which would allow you to have Apache/PHP/MySQL on your laptop. If you have a Mac, you could do the same with MAMP:

Once you have your local dev environment up and running, you could download your website files via SFTP with a tool like FileZilla:

Regarding your database, you could use the mysqldump command-line tool to export a backup of your database and import it to your local environment after that:

How to export/backup a MySQL/MariaDB database with mysqldump

Alternatively, what I like to do personally is to have an exact copy of my production server rather than run my projects on my laptop. So what I usually do is to restore a backup of my production server and use it as a development environment/server.

Then I use VS Code with an extension called Remote-SSH, which allows me to connect to my server via SSH through VS Code and I am able to make changes to my project directly on the dev server just as I would if it was an actual local project.

Here is a great tutorial on how to do that:

Hope that this helps!

by Mason Egger
In this tutorial, you'll enable the Remote-SSH plugin, configure Visual Studio Code to execute code on the remote server, and execute code from your local Visual Studio Code installation on the remote server.