How to create a wifi hotspot / router to share your media and files. This is a localized hotspot where everyone can connect to and upload or download file to the Raspberry Pi 2, or even watch media using plex. thanks for the view!

The Steps

Install iw to check wifi dongle

sudo apt-get install iw sudo iw list

Remove WPA Supplicant

sudo apt-get purge wpasupplicant

install dhcp server

sudo apt-get install isc-dhcp-server

setup dhcp

subnet 10.10.0.0 netmask 255.255.255.0 {
range 10.10.0.25 10.10.0.50;
option domain-name-servers 8.8.4.4;
option routers 10.10.0.1;
interface wlan0;
}

install hostapd for hosting access point

sudo apt-get install hostapd

configure hostapd

to create/edit hostapd.conf

 nano /etc/hostapd/hostapd.conf

add these lines to hostapd.conf file

 interface=wlan0
driver=nl80211
ssid=YOUR_STATION
hw_mode=g
channel=11
wpa=1
wpa_passphrase=SECRETPASSWORD
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
wpa_ptk_rekey=600
macaddr_acl=0

to Test:
*remember to reboot before attempting these steps*

sudo ifconfig wlan0 10.10.0.1
sudo /etc/init.d/isc-dhcp-server restart

-d is for debug mode so you can see if any errors appear
sudo hostapd -d /etc/hostapd/hostapd.conf

to make persistent
nano /etc/network/interfaces

add or eidt these following line
auto wlan0
iface wlan0 inet static
address 10.10.0.1
netmask 255.255.255.0


nano /etc/rc.local

add these lines

hostapd -B /etc/hostapd/hostapd.conf
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

add this line to sysctl.conf
nano /etc/sysctl.conf
net.ipv4.ip_forward = 0