For Listen Servers
In 1.17, you must first enable g_syncronousclients. id fixed this command's spelling in 1.27 and is g_synchronousclients. Then, enter in "/demo demoname". And when you want to stop recording, enter "/stop".
For Dedicated Servers
First enable g_sync, then start recording. Right after starting the record, disable g_sync for better control. And when you're done, "/stop" is all 🙂
The demos will appear in your baseq3\demos dir, with the filename as whatever you put in for "/demo" and an extension of either dm3 for 1.17 or earlier, or dm_48 for 1.27 or later.