Scales, chords, and chord progressions. Once you understand the chord you are currently in allows you to improvise freely within that chord to make melodies all day. You can layer on top of that chord to harmonize by adding notes within the scale of the chord.
You need to train the ears to hear when keys are off, this comes with the understanding of the above.
Practice, and a bit more practice.
Where you go really depends on what you want to do, do you want to sample or compose music?
Or both?
Sampling takes some practice to learn all the little tricks to do it well and composing and layering samples takes either a good ear and/or an understanding of the theroy behind the practice, and a bit more practice, and a bit more.
If making the music is for you, then learn an instrument, a keyboard is a good place to start for a beat maker as most is done with one if you wish to compose music. If sampling is more your thing then the mpd style midi controller might be more for you.
Id go the software route at first, its not so expensive, you can start out pretty cheaply, so then if you find out once you have tried it whether its not for you, then no great loss you can try something else, at least you had a go.
If it is for you and you enjoy it then you can start taking things further.
Every journey starts with taking the first step.
And yeah, something about practice, and practice and more practice, practice until the people you look up to for inspiration reach higher leagues and give you more goals to set yourself and achieve, and keep going and going, it can take a lifetime to master. Most importantly, express yourself, put your heart and soul into it, thats how the best music is made, even if that means using somebody elses music or words to do it in a fresh new way like with sampling.