Can you duplicate a Drupal 7 site and database when a new user registers? I'm building a site that will be used as a template site for new users. Once someone signs up, they should receive a copy of the original master template site, including their own SQL database.

Ideally, the new sub-site would need to receive updates from the master site somehow.  

Is there a way to copy and entire site when someone registers? Can this be accomplished with Multi-sites?
Yes, using hook_user_insert() to start the process off.  From a custom module that implements hook_user_insert() you can run any code you want.  However to pull it off you're going to have to write quite a bit of custom code.

Your hook_user_insert() function would need to do quite a lot of steps:


Fetch the database connection information defined in settings.php
Run mysqldump to make a .SQL dump of the database
Run a tar command to make a .tar.gz file of the Drupal codebase (PHP files) and files directory.
Zip or tar or something the sql file, the .tar.gz file, and probably some kind of instructions
Present the file for download.  This is made trickier because you don't want to have the file inside your codebase.. or each time you clone the database you'll pick up all the .zip files from previous users in the next user's .zip file.  You either need to serve the file directly, exclude the zip files from future codebase archives, or serve the zip files out of a directory that won't get zipped into the zip file.
(optional) Clear the user out of the master site so that it doesn't exist for future signups.


You ask about Multi-Sites, that's only relevant if you plan to immediately start hosting the cloned site yourself.  If your plan is to have the user download their files and .SQL database, you don't need to worry about that. (The user will have to worry about loading the SQL dump and setting up a database username and password though, which you'll need to babysit them through or it will never end up working out).

If your plan is to clone the site on your server, then you could do it with a multi site.  Your steps would then be:


Fetch the database connection information defined in settings.php
Run mysqldump to make a .SQL dump of the database
Create a new MySQL database to hold the new cloned site 4. There are security implications here.. if your webserver is allowed to create mysql databases, is it really secure from hackers?
Create a new sites/new.example.com folder for the new site (if it were named new.example.com)
Create a new settings.php file for the new site's database in sites/new.example.com
Load the SQL dump from step 2 into the new database (using the command line mysql command)
Redirect user to the new site.  You will need to use Wildcard DNS (ie. *.example.com woudl match site1.example.com, site2.example.com, etc. and you wouldn't need to add DNS entries for each new site).


While this plan is not impossible, it will be quite hard to get working well.  Your biggest challenge will be helping the users get through the complicated task of creating a new database, setting up username and password for it, loading the SQL dump, configuring their webserver etc etc etc.