STEP 1. Intall iw and check if your device supports AP mode
sudo aptitude install iw
iw list
iw wlan0 info
iwconfig
Install hostapd and enable AP
sudo apt-get install hostapd
Extract provided example conf to /etc/hostapd/hostapd.conf
zcat /usr/share/doc/hostapd/examples/hostapd.conf.gz | sudo tee -a /etc/hostapd/hostapd.conf
Setup hostapd.conf
sudo nano /etc/hostapd/hostapd.conf
interface=wlan0
ssid=Wireless
hw_mode=g
wpa=2
wpa_passphrase=PASS
wpa_key_mgmt=WPA-PSK WPA-EAP WPA-PSK-SHA256 WPA-EAP-SHA256
Setup wireless interface
sudo nano /etc/network/interfaces
auto wlan0
iface wlan0 inet static
hostapd /etc/hostapd/hostapd.conf
address 192.168.X.1
netmask 255.255.255.0
Enable forwarding
sudo nano /etc/sysctl.confnet.ipv4.ip_forward=1
Enable firewall (iptables)
iptables -t nat -A POSTROUTING -s 192.168.X.0/24 ! -d 192.168.X.0/24 -j MASQUERADE