This was added as another answer because the other answer created so much controversy.
Most and foremost, you need to know the name of our wireless adapter. Use the below command to get it:
iwconfig
It would be most probably wlan0 or wlan1.
There are cases that we use old WiFi adapter and we want to know the driver it uses. We can use the below commands in accordance with it's type that is either USB or PCI.
lsusb
lspci
Use the below command to see which driver you currently use:
lsmod
Need to install a programs. Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:
sudo apt-get install hostapd
Open the main network adapter configuration file by this command:
sudo gedit /etc/hostapd/hostapd.conf
And edit it like this:
interface=wlan0
driver=nl80211
country_code=US
ssid=mySSID
hw_mode=g
channel=1
wpa=2
wpa_passphrase=MyWiFiPassword
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
auth_algs=1
macaddr_acl=0
The first line should be your network adapter name. The 2nd line should not be changed in most cases, unless you were not lucky and you require a 3rd party driver. The 3rd line does not require explanation. The 4th line should be your WiFi access point name (SSID). The fifth line identifies your network as a/b/g/n mode. The next line is your network channel. The remaining lines set security and encryption. In most cases, you only require to change pass phrase.
Open the 2nd configuration file by this command:
sudo gedit /etc/default/hostapd
And change it like this:
DAEMON_CONF="/etc/hostapd/hostapd.conf"
RUN_DAEMON="yes"
DAEMON_OPTS="-dd"
First line points to main network adapter configuration file. 2nd line tells hostapd to run in DAEMON mode in background on boot. The last line tells hostapd to log every message. The important trick here is if you like to use two different wireless network adapters to setup a Dual Band Access Point, you should create to separate original config files (1st file) for each ard and change it like this:
DAEMON_CONF="/etc/hostapd/hostapd.conf /etc/hostapd/hostapd2.conf"
The configurations are finished.
Running DAEMON
Now you have to ensure that hostapd DAEMON starts on boot (1st command below), you should also run it now to avoid a mandatory reboot.
sudo update-rc.d hostapd defaults
sudo /etc/init.d/hostapd start
And it is finished. Now we can connect to our newly built access point.
Sources:Hostapd:The Linux Way to create Virtual Wifi Access Point & Hostapd Linux documentation page