First off, you must have the "craft wonderous item" feat. This
allows you to create what is called a phylactery. You must be an
11th level sorcerer, wizard, or cleric. And finally, the phylactery
costs 120,000gp and 4,800xp in order to create it (nothing states
how long this takes to make, but using the "creating magic items"
rules in the DMG my guess would be 120 days).
For some more rules on how a lich works and what you need to do
to become one, look in the monster manual under the templates
section. The most important part is making your phylactery.