Cook it longer, and watch your proportions. If it's too dry (not enough fat), it's hard to cook through without burning it. You want to get to a golden brown color throughout. You can cook it until it's darker and it'll add more caramel/nutty flavor (don't burn it), but it has to be at least a golden color before it's cooked enough to not taste of raw flour. When in doubt, taste it. If it tastes raw still, go a bit longer.
A good start for proportions is 1 part flour to one part fat--by weight, not by volume. Start with your fat in the pot, and get it nice and warm but not blazing hot, then add your flour a bit at a time, stirring (or better yet, whisking) for a couple of seconds to incorporate it smoothly before adding more. Stop adding (no matter how much flour you've used) when you get a slightly soft paste. Not too runny, but not as stiff as toothpaste either. I've yet to find a common thing people can agree on that has the right consistency to describe it, unfortunately. When you get the right consistency you need to keep stirring it over the heat until you get that golden brown color.
I admit that it's a little imprecise, but it really is a thing I do by feel and experience, based on what I said above as my original starting point. I've learned how I like it over the years, but I started with that.
Flour will whiten over time when stored. It generally takes several months to get a whiter color. Most flour manufacturers wish to speed this process up and so they actually bleach the flour using cholrine or benzoyl peroxide. This bleaching process also removes nutrietns which is why flour in the U.S. that has been bleached must also be "fortified" by having nutrients added back in.
There isn't much you can do beforehand. After milling, you can either bleach for immediate affect or store and allow it to whiten naturally. Keep in mind that different flours are usually bleached with different chemicals depending on what you plan to do with the flour.
I'll leave it to you to decide if it's worth the time and nutritional value to mix chemicals in to your flour for what is purely a cosmetic benefit.
Best Answer
Over half of the weight of hazelnuts consists of oil. So just:
and whatever is left after you've pressed all the oil out of the nuts is very dry though still coarse so the only thing left to do is just use a grain grinder to grind that into the smoothest most wonderful flour you've ever seen and tasted.
Tip: if you're only interested in the nut flour, start selling the hazelnut oil as it's a fantastic product to make all kinds of fried desserts like fried chocolate to offset the 2 new items you had to buy