Starfleet's headquarters are in San Francisco, CA and was established around 2160. Prior to Enterprise it was conjectured that both Starfleet and the United Federation of Planets were created in 2161. (The date for the UFP is canon, thanks to Deanna Troi in The Outcast" (TNG) but as for the establishing of Starfleet, The First Duty (TNG) shows the Starfleet Academy logo with the date 2161 on it. Enterprise, however, shows that the United Federation of Planets was created several years after than Starfleet so we can assume the Academy came about the same time as the Federation but that Starfleet itself was around beforehand.)
Starfleet's primary mission is exploration, however they also serve as the military of the United Federation of Planets. While only four vessels have been designed specifically as warships (the Defiant Class Starships), most Starfleet ships are armed with phaser arrays and torpedoes.
Starfleet Academy, as mentioned, was established in 2161 and is also in San Francisco.
Although, as Cletus mentions, Starfleet is largely free of corruption, there is Section 31, a splinter organisation that 'protects' the Federation from its enemies through espionage, sabotage, manipulating foreign politics and even genocidal war tactics.
See also: Star Trek