To drill a deep, straight hole, requires a special drill appropriately called a gun drill. A gun drill is a hollow, carbide tipped, single flute drill with a v-groove running the length of the shank. To use it, the barrel blank is rotated and the stationary drill fed into it. To keep the chips cleaned out, high pressure coolant is pumped through the drill and exits through the V-groove taking the chips with it. The bore is drilled a few thousandths undersize and then reamed. To cut the rifling, a carbide button is pulled through which forms the rifling and puts a super finish on the bore. Then, as Mac pointed out, the barrel is chambered so the cartridge sits at the proper depth.
Tom