How to backup a LAMP stack server

view story

http://superuser.com – What's the best way to backup a LAMP stack from SSH (if this is even possible)? Is it possible to create an image file for a remote server somehow, and then use wget to download this? (I am thinking similar to how vagrant uses .box files). Any advice/ideas appreciated. (HowTos)