The first step will be to install Raspbian (preferably the lite version) on your Raspberry Pi.

Once you have installed Raspbian, the first thing to do is to connect your Raspberry Pi to your internet box using the Ethernet cable, then take control of your Raspberry, either directly with a keyboard/screen or via SSH.

Once this is done, we will make sure that the Raspberry’s Wi-Fi connection remains available for the creation of the hotspot. For this purpose, we will simply create a copy of the configuration file allowing the connection to a box, in order to keep it aside, and modify the main file.
To do this, go to the Raspberry Pi terminal and run the following commands:

 sudo cp /etc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf.sav
 sudo cp /dev/null /etc/wpa_supplicant/wpa_supplicant.conf

Finally, edit in the file /etc/wpa_supplicant/wpa_supplicant.conf and add the following lines :

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

In this tutorial we will use the hostapd software, which allows to build an access point with the Raspberry Pi. And to facilitate the installation and administration of this access point, we will also install a web interface that will allow us to control our hotspot.

Now execute the following command:

wget -q https://git.io/voEUQ -O /tmp/raspap && bash /tmp/raspap

What if it still doesn’t work?

For some time now, we don’t know why, but it seems that Internet access is no longer functional by default after installation. To solve this problem you just need to do the following two things.

First, enable IPv4 packet forwarding. To do this, modify the /etc/sysctl.conf file and uncomment (i.e. remove the # at the beginning) the following line :

#net.ipv4.ip_forward=1

Once this is done, we will modify iptables to set the output IP that will be indicated so that servers know who to respond to (well, from what I understand, if I’m wrong, corrections are welcome). To do this, open the file /etc/rc.local and add the following line before the « exit 0 » part:

iptables -t nat -A POSTROUTING -j MASQUERADE

Enjoy!