Ago and back are used for past times from the present moment:
I graduated from high school ten years ago.
(ten years in the past from today)
We sent the package three days ago.
(three days in the past from today)
I moved here about five years back.
(informal - five years in the past from today)
Before and earlier are used for past times from another time in the past. Here are some examples:
Yesterday I missed my train. I got to the train station at 7:10, but the train had left ten minutes before. (or ten minutes earlier) or ( ten minutes before 7:10yesterday)
I was very happy when I got this job last January, because I had lost my previous job six months before. (or six months earlier). or ( six months before last January)