Capital ships are built from capital ship components, which are in turn manufactured from minerals. There is no restriction on where capital ship components can be built, and apart from the increased skill requirement there is no difference from other T1 manufacturing. Freighters and the Orca can then be constructed in any manufacturing facility using the relevant T1 ship BPO or BPC, from the components previously built.
Capital ship construction can be an extremely lucrative business, although requiring a large initial investment, and, depending on what capital you are constructing, may need to be based in losec, or even sovereign nullsec.
Carriers, dreadnoughts & the Rorqual are capital ships that may not enter hisec, and so you cannot build them in hisec either. They can be constructed in any station in losec or nullsec with a manufacturing facility, but apart from that restriction, are constructed in the same way as freighters or the Orca. These ships (plus freighters, battleships, & the Orca) can also be constructed at a Capital Ship Assembly Array at a POS. This assembly array may only be anchored in 0.4 security space or lower, and contains a most excellent 25% reduction to manufacturing time and a 2% reduction to required materials.
Supercarriers and Titans cannot even dock in stations, never mind enter hisec, and so you cannot build them in stations either. They must be built at a Supercapital Ship Assembly Array. This assembly array does not contain any bonuses to construction (supercapital construction takes an exceedingly long time). It may only be anchored in systems where your alliance holds sovereignty, and has upgraded that sovereignty to allow supercapital construction facilities. Because supercapital ship construction is POS-based, this means it is vulnerable to attack, unless you can defend your POS effectively. Many titans have been 'aborted' by a hostile force destroying the POS and assembly array during construction.
Imagine a combination of invention, T2 production and capital ship construction, and you'll have a fair idea of the process to create jump freighters - the only T2 capital ship. Fortunately, because jump freighters can dock and enter hisec, you can also build them in hisec station facilities.