If you have line of sight then it should be possible to set up a wireless link over a few kilometers. You would want high gain antennas on both ends, you could either (ab)use wi-fi gear or look for gear designed for the purpose.
Getting the antennas as high off the ground as possible is nearly always a good idea to ensure you get the line of sight path and to reduce the impact of ground reflections.
Be aware that simply slapping high gain antennas on wifi gear may exceed effective radiated power limitations in radio regulations. If you care about being legal you would need to check your local laws and quite probablly turn down the transmit power. Having the high gain antennas still helps even with reduced transmit power because high gain antennas help both transmission and reception.
If you want to connect devices wirelessly at the endpoint you would use a seperate wifi network with an omnidirectional anntena for that.