I have found that the best way to go about learning the fretboard is to commit several note names and frets to memory on each string.
For example, try remembering that on the sixth string:
- A is at the fifth fret
- C is at the eighth fret
If you can get comfortable finding these two notes quickly, you can more quickly find the notes in between.
So, if you are required to find the note D, instead of counting all the way up from the open string, you can count up two frets from C, which you know is at the eighth fret. This makes things much quicker. As time progresses, you will naturally start to remember where all the other notes are.
Eventually, it will become necessary to learn note names on all six strings of the guitar. When you're ready, take a look at learning the note names on the fourth, third, second and first strings.