Best way to learn all notes on the fretboard

To be honest, I don‘t know what is the best way to learn the notes. I know what worked for me and what didn‘t. A long while ago, my guitar teacher gave me a figure and told me to learn the notes on the first string, then the notes on the second string, and so on.

The figure my teacher gave me, looked like this:

I can tell you, that I was really pissed off by this. Although there are only 12 notes in our system, I should have learned 72 notes on the fretboard. I can also tell you that I did not learn the notes for a very long time (and got through, like many other guitar players which cannot read notes or know what note is on which fret on which string on the fretboard).

Years later I recognized, that it was the overwhelming figure that caused me to skip all this theory stuff. I don't know if it the worst way to learn the notes on the fretboard, but I assume it.

One by one by one

I'm certain, that a better way to learn the notes is to learn it one by one. That means: don't mess around with all fucking 12 notes on the first string, but grab one note you want to learn, e.g. the C. Now identify where you can find the C on your fretboard and create a figure like this.

I'm sure you agree with the idea that this figure doesn't look as horrible as the one above. We have 6 positions to learn (in case of A, D, G and B there are 7 positions and in case of the E there are 8 positions).
That looks like something one can handle, and I highly reccomend to learn note by note this way. Be honestly to yourself: no one ever will ask you "hey, what's the note on the third fret of the fourth string?" They'll simple ask you for playing a C (or any other note).

How to learn that stuff?

But you still have to learn. There's no way out here. But you should learn it by doing.
Everytime you grab your guitar (and that should be at least once a day), play the note you're currently learning on all positions on the fretboard. You really don't have to learn which fret it is, but learn the position. Play all C notes beginning on the first string to the 6th string and vice versa. Play the C note on a random string. Don't do it for hours, but only for 3 minutes a day. And be sure to do it, until you really now the position whitout the need of counting frets. If you really have internalized one note, go on to the next one.

Yeah, still you have to learn and memorize, but I believe that this is a more simple way than the way of my guitar teacher.

Do I really have to learn that?

No, you don't have to. But also you don't have to play guitar. See, it always depends on what you want to reach. If you're happy with some power chords on the first two strings, then go for it. If you're into song writing and you manage to write a song without knowing the notes, then go for it.
But you can be sure that problems start, if a band member asks you what you're playing and you have to stumble "See, here, the fiths string in the fifth fret and the sixth string in the seventh fret". Wouldn't it be much easier to tell you second guitarist that you're playing an E chord on the highest strings?

What would happen, if someone ask you to play a D#m7 chord and you don't know how to play this as an open chord? Well, if you know where the notes are on your fretboard and you also have some knowledge in music theory, you can easily find out by yourself.