Let the present ages of father and son be x years and y years respectively.
Then,
Age of father 5 years ago = (x – 5) years
Age of his son 5 years ago = (y – 5) years
According to the question,
x – 5 = 7(y – 5) + 2
⇒ x – 5 = 7y – 35 + 2
⇒ x – 7y + 28 = 0
which is the required linear equation in two variables.