Install or Reinstall Lion from Scratch
If possible backup your files to an external drive or second internal drive.
Boot to the Recovery HD:
Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
Erase the hard drive:
- Select Disk Utility from the main menu and click on the Continue button.
- After DU loads select your hard drive (this is the entry with the mfgr.'s ID and size) from the left side list. Note the SMART status of the drive in DU's status area. If it does not say "Verified" then the drive is failing or has failed and will need replacing. SMART info will not be reported on external drives. Otherwise, click on the Erase tab in the DU main window.
- Set the format type to Mac OS Extended (Journaled.) Click on the Erase button and wait until the process has completed.
- Quit DU and return to the main menu.
Reinstall Lion: Select Reinstall Lion and click on the Install button.
Note: You can also re-download the Lion installer by opening the App Store application. Hold down the OPTION key and click on the Purchases icon in the toolbar. You should now see an active Install button to the right of your Lion purchase entry. There are situations in which this will not work. For example, if you are already booted into the Lion you originally purchased with your Apple ID or if an instance of the Lion installer is located anywhere on your computer.
After this is completed install the Lion Server software.
I don't think you have to purchase it, but this is not something I've looked into carefully. If it's preinstalled then you should have access to it, but probably not until you install Lion. Reinstalling is done via the Internet.
To install a fresh copy of Lion you first boot to the Recovery HD, use Disk Utility to erase the drive, then use the Reinstall Lion option. Select the formatted volume as the install destination. This will provide a "clean" install as opposed to an "upgrade" install.