++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 + INSTALL Apache
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sudo apt-get install apache2 apache2-utils
to test apache is working:
open your browser and visit http: //localhost
you should see the index.html page (from /var/www) displaying "it works!" on your browser
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 + HOTSPOT CONFIGURATION
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- Install Softwares
1) install the software [you need internet for that]
sudo apt-get install hostapd isc-dhcp-server
required packages (make sure are installed 'bridge-utils' 'iptables') they are installed by default with the raspberry pi wheezy.
2) download the hostapd driver. Lest's do it now since your wlan0 is activated.
wget http://www.adafruit.com/downloads/adafruit_hostapd.zip
-- Set up DHCP server
1) edit /etc/dhcp/dhcpd.conf: {this allows wifi connections to automatically get IP addresses, DNS, etc.}
sudo nano /etc/dhcp/dhcpd.conf
make sure you have the following configuration:
--->
ddns-update-style none;
option domain-name "local";
option domain-name-servers 8.8.8.8, 8.8.4.4;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.200;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;
}
<---
2) edit /etc/default/isc-dhcp-server
sudo nano /etc/default/isc-dhcp-server
scroll down to INTERFACES="" and update it to say INTERFACES="wlan0"
-- Configure Access Point
here we gonna choose the network name (ex: MEGA)
1) Create a new file in /etc/hostapd/ called hostapd.conf:
sudo nano /etc/hostapd/hostapd.conf
(past the following in that file):
--->
interface=wlan0
driver=rtl871xdrv
ssid=MEGA
hw_mode=g
channel=6
macaddr_acl=0
ignore_broadcast_ssid=0
auth_algs=1
<---
2) edit /etc/default/hostapd {to tell the Pi where to find this configuration file}
sudo nano /etc/default/hostapd
add the path to the DAEMON_CONF="/etc/hostapd/hostapd.conf"
Don't forget to remove the # in front of it
-- Set up wlan0 for static IP
1) turn off wlan0:
sudo ifdown wlan0
2) here we need to modify the /etc/network/interfaces files
** NOTE: this file will be generated automatically by the JAVA software so you can skip this step
!THE FILE WILL LOOKS LIKE THIS AT THE END
!--->
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
<---!
3) Assign a static IP address to the wifi adapter:
sudo ifconfig wlan0 192.168.1.1
-- Update hostapd
you must update the hostapd or you will get an invalid driver error
0) install the unzip package
# sudo apt-get install unzip
1) unzip the downloaded hostapd driver
unzip adafruit_hostapd.zip
2) backup the original:
sudo mv /usr/sbin/hostapd /usr/sbin/hostapd.ORIG
3) replace the new one:
sudo mv hostapd /usr/sbin
4) set it up so its valid to run with
sudo chmod 755 /usr/sbin/hostapd
-- Test it!
0) turn on wlan0:
sudo ifconfig wlan0 up
1) make sure hostapd service is running
sudo service hostapd start
you can chekc it's status if running or not:
sudo service hostapd status
2) make sure isc-dhcp-server service is running (VIP)
sudo service isc-dhcp-server start
you can chekc it's status if running or not:
sudo service isc-dhcp-server status
3) start the wifi broadcasting
sudo /usr/sbin/hostapd /etc/hostapd/hostapd.conf
4) for debugging run the following command {to watch the system log data, handy for checking and debugging whats going on}
tail -f /var/log/syslog
5) try to connect to it from another computer. to access the hosted web page go to 192.168.1.1
-- ERRORS FIXING
in case you got an error in starting the hostapd service or the wifi broadcasting: saying that /usr/sbin/hostapd doesn't exist {and you know that it exists}
that means the version of the hostapd is not compatible with the machine
SOLUTION:
install different hostapd driver that is compatible with the wifi dongle and the board
NOW YOU OPEN ANY BROWSER AND GO TO 192.168.1.1 YOU SHOULD SEE YOUR APPLICATION ;)