how do I get my module to install a view?
Create the MODULENAME.views_default.inc file (replace MODULENAME with the name of your module), and copy the exported code in the implementation of hook_views_default_views() you write in that file.

For example, the Views module implements node_views_default_views() for the Node module. The relevant parts for the front page view are the following ones.

  $views = array();

  // Omissis

  $view = new view;
  $view-&gt;name = 'frontpage';
  $view-&gt;description = 'Emulates the default Drupal front page; you may set the default home page path to this view to make it your front page.';
  $view-&gt;tag = 'default';
  $view-&gt;base_table = 'node';
  $view-&gt;human_name = 'Front page';
  $view-&gt;core = 0;
  $view-&gt;api_version = '3.0';
  $view-&gt;disabled = TRUE; /* Edit this to true to make a default view disabled initially */

  // Omissis

  $views['frontpage'] = $view;


The hook then returns the content of $views.

If the view has not been overwritten by a user, it should not be shown in the view list, once the module implementing the hook is uninstalled.