If you're not wanting to use a dedicated chip to do it (as per the examples above), there's a method which was standard when I worked at a company making equipment for national grids. This was in the 1990s, and they were just in the process of changing over from analogue to software. One of my first jobs was to work through all the analogue protection circuits and turn them into design documents for software - not just the details of what they did, but the intent behind them.
Anyway, your standard method starts with a DC blocking capacitor so that you've only got the AC part. After that, the sine wave goes into a full-wave precision rectifier. This gives you a series of positive half-sine "humps". You then put that through a low-pass filter with a time constant much slower than the sine-wave frequency. The result is a DC level that's the average of the sine-wave amplitude (plus a little ripple).
Note that the DC level is the average of a rectified sine-wave (integral over time divided by time), which is (2/pi)*Vpk=0.637*Vpk. The RMS of course is (1/root2)*Vpk=0.707*Vpk. So if you want to output the actual RMS, you're going to need a non-inverting amplifier with a gain of 1.11. Or build that gain into your precision rectifier or low-pass filter.
(Thanks to @aconcernedcitizen for correcting my scaling factors!)