Show available networks
nmcli dev wifi list
# or
sudo iw dev wlan0 scan | grep SSID
Connect to available AP*
nmcli device wifi connect <SSID> password "PASSWORD"
# After these lines RPI will automatically connect to network if available
nmcli device set wlan0 autoconnect yes
sudo reboot
Turn off power managment for interface:
/sbin/iwconfig wlan0 power off
Add this line to /etc/rc.local
Then reboot.
Change host name if you wand
sudo hostnamectl set-hostname <newhostname>
Than add your hostname to /etc/hosts Like pointed in this