Since you are a beginner, I would strongly suggest you start with aan electronic tuner. Take one and tune you guitar and then see how it's supposed to sound when it's tuned correctly. Play the natural harmonics over the 5th and the 7th frets and listen to the correct sound. Or, you can try playing the 5th fret and the open string below (these are supposed to be the same note); or, you can try playing the 7th fret and the open string above (these are supposed to be the same note, an octave apart).
Then, when it's out of tune, play one of the ways mentioned above again and try to see if you can match the correct ones. If not, use a tuner again and do the same process again.
When you tune just by ear, still use a tuner afterwards to check if the tuning is correct. This way you'll know for sure if you have it correct or not.
But, I remember when I was a beginner, I couldn't tune the guitar just by ear. I needed some help. Use the technology. You can even find tuners online.