As stated in the comments, the legality depends on your location, as well as type of refrigerant used in the system. R-12 is only available to professionals, where as R-134a is available at your parts store. If for some reason that R-134a is not available in your area, that would be a good indication that it is illegal there.
This is alot harder to answer as it depends on your specific vehicle, as well as how the previous compressor failed. If the compressor clutch failed (this would be the pulley and engagement mechanism at the front of the compressor), then you would only need to replace the compressor, and either the receiver/dryer or accumulator (you will only have one of these). I would also recommend you replace the orifice tube if your system has one, simply because it is an inexpensive part that can become clogged. Note that replacing the orifice tube is optional. You could also skip flushing the system and would not need to install an aftermarket filter (I don't like them anyway as they introduce more places for leaks to develop,but they do serve a purpose).
If the compressor was failing internally, it likely dumped a significant amount of debris into the system and this is where your headache starts. I will break up the repair depending of the type of system you have; either receiver/dryer and expansion valve, or accumulator and orifice tube. Note that for both systems, replacement of the condenser may be required as some designs have proven difficult/impossible to properly flush. Unfortunately, that needs to be evaluated on a case-by-case basis. If your system was still functional before you removed the compressor, that could be a good sign.
Receiver/dryer and expansion valve: The parts would include compressor, receiver/dryer, mandatory flush(es), possibly the condenser, and possibly a filter. The replacement of the expansion valve can be necessary also. In this type of system, the receiver/dryer is between the compressor and the expansion valve, and therefore will catch some of the debris. Note about the flushes: You would want to disconnect the expansion valve before flushing as you do not want to get debris inside it. That would make it stop working and require replacement. When you are disconnecting the expansion valve, if you see debris, then the likelihood of needing replacement goes up.
Accumulator and orifice tube: The parts would include compressor, accumulator, orifice tube, mandatory flush(es), possibly the condenser, and possibly a filter. In this type of system, the orifice tube will become clogged with debris.
Note for both types of systems: There are some vehicle specific kits that have all of the o-rings needed for your system(and the some extras). I would recommend trying to find one of these for your vehicle. Also, don't forget that the compressor and receiver/dryer or accumulator store oil and that oil must be replenished in the new system WITH THE PROPER TYPE AND QUANTITY or your new compressor will die due to a lack of lubrication.
Assuming you can get the needed refrigerant, there are still some tools you likely don't have. The first would be a vacuum pump. That is used to pull moisture from the system before charging it as any moisture will cause system failure. One of the reasons for replacing the receiver/dryer or accumulator is because they contain desiccant which removes moisture from the system. I have seen systems recharged without pulling the vacuum first, but I won't recommend it. Also, some of the fittings require rather large wrenches so check those sizes as well. You may also need flare-nut wrenches for the expansion valve fittings. The A/C system is not the place for channel-locks, vise-grips, or pipe wrenches and if the fittings look corroded, removal can be difficult. Finally, an air-compressor would go along ways towards blowing out any debris in the lines.
For parts replacement, since the system does not have any pressure on it, if you can change an alternator and water pump, and have access to the above needed tools, this should be okay for you to attempt. Follow the directions for the flush, and replace all o-rings on any fitting that you touch. Also, if any fitting looks like it has been leaking a bit of oil, replace those o-rings as well. Once you get the system put back together, you can take it somewhere for the final charging and leak testing.
If you are still reading after all of that, as a previous ASE Master Tech, I never liked doing AC work because of all of the things that may be wrong. I didn't like taking an estimate to the customer that was full of what may be wrong with the vehicle, but at the same time, you couldn't price in all of the maybe's because you would price yourself out of the job.
As a final note, if your system still had freon in it, I should point out that the intentional venting of CFC's and HCFC's during the maintenance, service, repair, or disposal of air-conditioning or refrigeration equipment is a violation of federal law.