*something very simplified coming across*
A wise sentence I once heard (IIRC it's from Gandhi): "A human must be willing to die for something but he also must not be willing to kill for something"
Now to my simplification:
Our western (oppressing) country's people prototype mostly lacks the ambition to die for a cause (may it be freedom, their country, their lover or just their fancy SUV) but DOES hesitate to kill for a cause (in Europe we do

)
The terrorist prototype is always willing to die for his cause but sadly also to kill for it.
I strongly believe that you can't extinct this threat with violence. Death Penalty is NOT a proper deterrent for suicide bombers.
What you can do by force (i.e. "Crusades" to Afghanistan, Iraq, Iran) is damage large terrorist organizations and thus keep the problem away from the western hemisphere.
In short: Destroying Al-Quaeda will ensure that terrorist acts in the US, France, Germany, Spain, Canada, ... are minimized. It won't stop suicide bombers in Gaza or at embassies in Kenia.
According to my upper statements there are two ways of quelling terrorism.
1.)
Make people unwilling to kill:
To achieve that you need education as Harley noted correctly. And not any but "good" education. Good education does NOT mean a Ph.D, it means teaching people philosophy, religion or in short values like "life may no be taken deliberately by humans". EVERY major religion and philosophical movement teaches that "thou shalt not kill" (they also make the exception that there may be legal requirement to do so but that's another story).
You can train people to be highly skille pilots, sappers, doctors, lawyers, engineers,... and still NOT educate them. This is to be avoided.
2.)
Make people unwilling to die:
Like Timber said: Throw money at the problem. Once every Palestinian drives a Volvo they won't be willing to die anymore. Why should I die for "insert religious or political cause here" when I can still live a good life without a major change. The richer people get the more expensive get their lives (this is sad but true) and idealist who will throw away a well provided family life for the good of their country or their fellow men are rare.
So once people in Mali, Chechnya and Afghanistan start worrying about their retirement funds and stop worrying about getting food for tomorrow there'll be a lot less terrorists around.
There is of course the irrealistic way of combinig both. Providing people from the poor countries with education, leave their religious values mostly untouched AND support their economy to increase their quality of life -
but who would sew all these footballs then? Nike stocks would plummet and then we'd be poor. Ah - a vicious circle.