There are many ways of greeting people, both formal and informal. The speaker's tank is to choose an appropriate one situation. It is also useful to know lots of different ones so as to not repeat when you meet a number of people at the same time. As with any other aspect. you need to be careful about using informal expressions with people who you do not know well or whose rank or status is higher than yours.