Sorry if this starts too basic, I’m not really sure what level you’re at, it is a great question to ask though, I certainly didn’t learn the locations of the notes early enough.
First things first is what @Daniel_360 said, the fret markers are your friend. As you look down on your guitar you should be looking at the smaller markers on the side of the fretboard. I’m not sure how vital it is to know specifically what those notes are, but it is vital to know what fret numbers they represent. You can’t know which note is where if you don’t know where you are, start by trying to hit fret numbers.
Build it up slowly. The most important notes to know at the beginning are those on the two bass strings, as they’ll be the root notes for 95% of your early chords. Think about them in terms of the natural notes (i.e. not sharp or flat) they will be obvious once you’ve learnt the more important part. Even if it isn’t your style, try to play some power chord songs slowly, they will all be based on the notes on the bottom two strings, from there you will be able to play all bar chords which will get you a long way
Next learn scales and arpeggios and say the notes as you play them. Start with C major and A minor, as they are have only got natural notes. The scales should be easy enough to find online. From there, improvise while saying the notes - it will sound terrible but that isn’t the point - go the tiniest bit quicker than you need to to get them all correct easily and you will start to say them naturally
Then play the scales on one string. It’s the best exercise for dexterity but that isn’t why you’re doing it, it puts you out of the positions you’ve learned from playing scales and teaches you to string them together. Again, say the notes as you play them, then improvise while saying notes as you play them. The point isn’t to sound good, it’s to surprise yourself into thinking of the notes which had left your mind, while learning the scales, i.e. the context in which you’ll actually use the notes
You may be disappointed with this advice. After all, it’s not the sort of way that we tend to think about memory on this site. But it isn’t the knowledge that’s difficult to get, so a system would become irrelevant after a couple of hours. If you learned the string names, and knew 1 fret was a semi tone and they repeated after 12 frets, you could work out any note within 10 seconds anyway. What you want is to be able to identify the notes within fractions of a second and developing the understanding to get there means that you will be better placed when you do get to that point