Legally you can't without the EPA's Secton 609 certifacation, because any refrigerant in the system must be removed by a licensed technician. And even if its empty of refrigerant, after you relace the compressor you must pull a vacuum on the system to remove air and moisture. I would recomend taking it to a garage.
The guy above probably owns an AC garage. You need to have a certified mechanic "discharge" and "re-charge" the refrigerant. However, the act of replacing the AC compressor can be done by you (although this depends on "you"). My local shop charges $85 to remove the refrigerant and replace it again after I have changed out the compressor. Tomorrow I will take the old compressor off and put the new one in...from what I gather so far...this entails removing the plastic cover below the compressor, remove the belt, remove the compressor, replace the new one and use a wrench on the belt "auto-tensioner" to get the belt back on. Run the car and make sure it works properly...then take it back to the garage, get the refrigerant re-charged and you should be good to go!