I cut the barrel channel on a pistol I made from a blank, but except for that, I buy the stock blank with the barrel channel and ramrod hole drilled by the supplier.
On the pistol, I used a router with a 5/16 carbide straight cutting bit and a fence.
Except for smoothing and truing the edges of the block, this was the first cut I made to the blank.
The first cut created the center (deepest) groove and was made with a large number of passes to get to the full depth.
This depth was about 1/8 deeper from the top of the blank, than the barrel was tall. (for the 13/16 barrel I used, the cut was about 15/16 deep from the top surface of the blank). This eventually will position the top of the barrel 1/8 inch below the top of the blank which gives a lot of wood to play with when matching the wood to the barrel at the breech end.
The next cut I made was made by adjusting the fence so the side of the cut would become the wood that the side flat on the barrel would fit against. This cut was just deep enough to stop where the barrels side flat stops measured from the top surface of the block.
For my 13/16 barrel the depth was 15/16-7/32=23/32.
This cut was also made with multiple passes.
The fence was readjusted to position the cutter so it would cut the other sides barrel side flat also to 23/32 depth.
This leaves material which will become the 45 degree flats along the bottom of the barrel.
I could have used a 45 degree cutter to remove this wood, but instead I chose to just use a good chisel.
Because I didn't trust the router to finish all of these surfaces, all of the surfaces were cut leaving about .020 of extra wood to allow me to "fit" the barrel with chisels and sandpaper. Scraping would also be a good method to make these finishing cuts.
Using a router is not without its dangers. It can screw up a lot of wood in a heartbeat unless extreme caution is used.
If your installing a straight barrel, the formulas for calculating some of the numbers you would need are:
Barrel Flat Width= barrel octagon width times .414= A
This would be the maximum cutter diameter to use.
Center Channel depth = barrel octagon width plus 1/8= B
Side Channel depth = B minus (A times .707)= C